From fe0a4c0495cf9f1a65343158c2a8c2d4a163e045 Mon Sep 17 00:00:00 2001 From: qirong <2032486488@qq.com> Date: 星期二, 28 十一月 2023 21:16:21 +0800 Subject: [PATCH] 优化查询 --- src/main/resources/mapper/ExamTemplatesMapper.xml | 25 ++++++++++++++----------- 1 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/main/resources/mapper/ExamTemplatesMapper.xml b/src/main/resources/mapper/ExamTemplatesMapper.xml index 0933165..c6a450a 100644 --- a/src/main/resources/mapper/ExamTemplatesMapper.xml +++ b/src/main/resources/mapper/ExamTemplatesMapper.xml @@ -32,17 +32,20 @@ <select id="gets" resultMap="BaseResultMap" parameterType="com.mindskip.xzs.domain.vo.ExamTemplatesVO"> select - <include refid="Base_Column_List"/> - from t_exam_templates - where - <choose> - <when test="status != null"> - status = 0 - </when> - <otherwise> - status is null - </otherwise> - </choose> + e.* + from t_exam_templates e + inner join t_exam_templates_user u on e.id = u.templates_id + <where> + <if test="status != null"> + and e.status = 0 + </if> + <if test="status == null"> + and e.status is null + </if> + <if test="userId != null"> + and u.user_id = #{userId} + </if> + </where> </select> <select id="getById" resultMap="BaseResultMap"> -- Gitblit v1.8.0