Przeglądaj źródła

用户分页查询条件优化

hubin 4 miesięcy temu
rodzic
commit
c3b77e5cf8
1 zmienionych plików z 9 dodań i 6 usunięć
  1. 9 6
      src/main/resources/mapper/SysUserMapper.xml

+ 9 - 6
src/main/resources/mapper/SysUserMapper.xml

@@ -15,24 +15,27 @@
         </if>
         WHERE u.deleted = 0
         <if test="vo != null">
-            <if test="vo.username != null">
+            <if test="vo.username != null and vo.username != ''">
                 AND u.username LIKE CONCAT(CONCAT('%',#{vo.username}),'%')
             </if>
-            <if test="vo.realName != null">
+            <if test="vo.realName != null and vo.realName != ''">
                 AND  u.real_name LIKE CONCAT(CONCAT('%',#{vo.realName}),'%')
             </if>
-            <if test="vo.nickName != null">
+            <if test="vo.nickName != null and vo.nickName != ''">
                 AND u.nick_name LIKE CONCAT(CONCAT('%',#{vo.nickName}),'%')
             </if>
-            <if test="vo.jobNum != null">
+            <if test="vo.jobNum != null and vo.jobNum != ''">
                 AND u.job_num LIKE CONCAT(CONCAT('%',#{vo.jobNum}),'%')
             </if>
-            <if test="vo.phone != null">
+            <if test="vo.phone != null and vo.phone != ''">
                 AND u.phone LIKE CONCAT(CONCAT('%',#{vo.phone}),'%')
             </if>
-            <if test="vo.email != null">
+            <if test="vo.email != null and vo.email != ''">
                 AND u.email LIKE CONCAT(CONCAT('%',#{vo.email}),'%')
             </if>
+            <if test="vo.status != null">
+                AND u.status = #{vo.status}
+            </if>
         </if>
         ORDER BY u.update_time DESC
     </select>