Browse Source

执法端-优化查询计划通知接口

dev-v1.0.2
niujiyi 5 months ago
parent
commit
e7e31eff6d
  1. 34
      zdxt-modules/zdxt-enforcement-code/src/main/resources/mapper/enforcementcode/EnforcementInspectionProgramMapper.xml

34
zdxt-modules/zdxt-enforcement-code/src/main/resources/mapper/enforcementcode/EnforcementInspectionProgramMapper.xml

@ -161,15 +161,33 @@
order by create_time desc
</select>
<!-- 分页查询计划列表(包含权限控制) -->
<!-- 分页查询计划列表(包含权限控制) - 优化版本 -->
<select id="selectPlanPage" resultType="com.zdxt.enforcementcode.domain.vo.EnforcementInspectionProgramVo">
<include refid="selectEnforcementInspectionProgramVo"/>
where (is_publish = 1 or enforcement_department_id IN ( SELECT dept_id FROM sys_dept WHERE dept_id = #{bo.deptId} or find_in_set( #{bo.deptId} , ancestors ) != 0 ))
<if test="bo.searchText != null and bo.searchText != ''">
and (plan_name like concat('%', #{bo.searchText}, '%')
or enforcement_department like concat('%', #{bo.searchText}, '%')
or bureau_dept_name like concat('%', #{bo.searchText}, '%'))
</if>
order by create_time desc
<where>
<!-- 使用 UNION 替代 OR,提升查询性能 -->
id IN (
<!-- 已发布的计划 -->
SELECT id FROM enforcement_inspection_program WHERE is_publish = 1
UNION
<!-- 本部门及下级部门的计划 -->
SELECT id FROM enforcement_inspection_program
WHERE enforcement_department_id IN (
SELECT dept_id FROM sys_dept
WHERE dept_id = #{bo.deptId}
OR FIND_IN_SET(#{bo.deptId}, ancestors) != 0
)
)
<!-- 搜索条件 -->
<if test="bo.searchText != null and bo.searchText != ''">
AND (plan_name LIKE CONCAT('%', #{bo.searchText}, '%')
OR enforcement_department LIKE CONCAT('%', #{bo.searchText}, '%')
OR bureau_dept_name LIKE CONCAT('%', #{bo.searchText}, '%'))
</if>
</where>
ORDER BY create_time DESC
</select>
</mapper>

Loading…
Cancel
Save