lyhzzz 2 年之前
父節點
當前提交
1d3b5a0e86
共有 2 個文件被更改,包括 14 次插入7 次删除
  1. 7 3
      src/main/resources/mapper/LogMapper.xml
  2. 7 4
      src/main/resources/mapper/UserMapper.xml

+ 7 - 3
src/main/resources/mapper/LogMapper.xml

@@ -23,9 +23,13 @@
         <if test="param.endTime != null and param.endTime != ''">
             and l.create_time  &lt;=   #{param.endTime}
         </if>
-        <foreach collection="param.deptIds" item="deptId" open="(" separator="," close=")">
-            and u.dept_id in #{deptId}
-        </foreach>
+        <if test="param.deptIds != null and param.deptIds.length >0 ''">
+            and u.dept_id in
+            <foreach collection="param.deptIds" item="deptId" open="(" separator="," close=")">
+                #{deptId}
+            </foreach>
+        </if>
+
         order by l.create_time desc
     </select>
 </mapper>

+ 7 - 4
src/main/resources/mapper/UserMapper.xml

@@ -22,10 +22,13 @@
         <if test="param.endTime != null and param.endTime != ''">
             and u.create_time  &lt;=   #{param.endTime}
         </if>
-        and u.dept_id in
-        <foreach collection="param.deptIds" item="deptId" open="(" separator="," close=")">
-            #{deptId}
-        </foreach>
+        <if test="param.deptIds != null and param.deptIds.length >0 ''">
+            and u.dept_id in
+            <foreach collection="param.deptIds" item="deptId" open="(" separator="," close=")">
+                #{deptId}
+            </foreach>
+        </if>
+
         order by u.create_time desc
     </select>
 </mapper>