From a36f6ad6070b8230673eab6a01c7bdbcc5e3e640 Mon Sep 17 00:00:00 2001 From: mg <maokecheng@163.com> Date: 星期五, 28 十月 2022 12:04:36 +0800 Subject: [PATCH] 添加条件判断 --- ycl-common/src/main/resources/mapper/user/UmsAdminMapper.xml | 25 +++++++++++++------------ 1 files changed, 13 insertions(+), 12 deletions(-) diff --git a/ycl-common/src/main/resources/mapper/user/UmsAdminMapper.xml b/ycl-common/src/main/resources/mapper/user/UmsAdminMapper.xml index 8f02c2e..c62face 100644 --- a/ycl-common/src/main/resources/mapper/user/UmsAdminMapper.xml +++ b/ycl-common/src/main/resources/mapper/user/UmsAdminMapper.xml @@ -77,18 +77,19 @@ LEFT JOIN ums_depart ud ON udm.depart_id = ud.id LEFT JOIN ums_admin_role_relation uarr ON ua.id = uarr.admin_id LEFT JOIN ums_role ur ON uarr.role_id = ur.id - where 1=1 - <if test="umsAdmin.keyword !=null and umsAdmin.keyword =''"> - AND (ua.username LIKE concat('%',#{umsAdmin.keyword,jdbcType=VARCHAR},'%') - or ua.nick_name LIKE concat('%',#{umsAdmin.keyword,jdbcType=VARCHAR},'%') - or ua.mobile ua.nick_name LIKE concat('%',#{umsAdmin.keyword,jdbcType=VARCHAR},'%')) - </if> - <if test="umsAdmin.userType !=null and umsAdmin.userType >=0 "> - AND ua.user_type = #{umsAdmin.userType} - </if> - <if test="umsAdmin.jobTitle !=null and umsAdmin.jobTitle=''"> - AND ua.job_title = #{umsAdmin.jobTitle} - </if> + <where> + <if test="umsAdmin.keyword !=null and umsAdmin.keyword !=''"> + AND (ua.username LIKE concat('%',#{umsAdmin.keyword,jdbcType=VARCHAR},'%') + or ua.nick_name LIKE concat('%',#{umsAdmin.keyword,jdbcType=VARCHAR},'%') + or ua.mobile LIKE concat('%',#{umsAdmin.keyword,jdbcType=VARCHAR},'%')) + </if> + <if test="umsAdmin.userType !=null and umsAdmin.userType >=0 "> + AND ua.user_type = #{umsAdmin.userType} + </if> + <if test="umsAdmin.jobTitle !=null and umsAdmin.keyword !=''"> + AND ua.job_title = #{umsAdmin.jobTitle} + </if> + </where> ORDER BY ua.id DESC </select> -- Gitblit v1.8.0