|
|
|
@ -57,4 +57,63 @@ |
|
|
|
ORDER BY plan_date DESC |
|
|
|
</select> |
|
|
|
|
|
|
|
<!-- 重叠计划列表:查找与当前用户计划同一时间段、同一企业的其他用户的计划 --> |
|
|
|
<select id="selectOverlapPageList" resultType="com.zdxt.enforcementcode.domain.vo.EfcodeCpPlanVo"> |
|
|
|
SELECT |
|
|
|
id, plan_type, plan_date, plan_time, |
|
|
|
enforce_content, enterprise_name, enterprise_number, enterprise_id, |
|
|
|
enforce_user_names, enforce_user_ids, enforce_user_codes, enforce_user_tels, |
|
|
|
is_public, is_union, union_bureau_dept_names, |
|
|
|
reserve_status, system_reserved, manual_reserved, |
|
|
|
bureau_dept_id, bureau_dept_name, |
|
|
|
organ_id, organ_name, dept_id, dept_name, |
|
|
|
is_delete, remark, my_remark, |
|
|
|
create_by, create_dept, create_time, update_by, update_time |
|
|
|
FROM efcode_cp_plan cp |
|
|
|
<where> |
|
|
|
cp.is_delete = 0 |
|
|
|
<!-- 排除当前用户自己的计划 --> |
|
|
|
<if test="currentUserId != null"> |
|
|
|
AND cp.create_by != #{currentUserId} |
|
|
|
</if> |
|
|
|
<!-- 只查当前用户有计划的时间段和企业的重叠计划 --> |
|
|
|
<if test="currentUserId != null"> |
|
|
|
AND EXISTS ( |
|
|
|
SELECT 1 FROM efcode_cp_plan myp |
|
|
|
WHERE myp.create_by = #{currentUserId} |
|
|
|
AND myp.is_delete = 0 |
|
|
|
AND myp.plan_date = cp.plan_date |
|
|
|
AND myp.plan_time = cp.plan_time |
|
|
|
AND myp.enterprise_id = cp.enterprise_id |
|
|
|
) |
|
|
|
</if> |
|
|
|
<!-- 可见性:本单位全部 OR 其他单位公开 --> |
|
|
|
<choose> |
|
|
|
<when test="bureauDeptId != null and bureauDeptId != ''"> |
|
|
|
AND ( |
|
|
|
cp.bureau_dept_id = #{bureauDeptId} |
|
|
|
OR (cp.bureau_dept_id != #{bureauDeptId} AND cp.is_public = 1) |
|
|
|
) |
|
|
|
</when> |
|
|
|
<otherwise> |
|
|
|
AND cp.is_public = 1 |
|
|
|
</otherwise> |
|
|
|
</choose> |
|
|
|
<!-- 搜索条件 --> |
|
|
|
<if test="bo.planDate != null"> |
|
|
|
AND cp.plan_date = #{bo.planDate} |
|
|
|
</if> |
|
|
|
<if test="bo.enterpriseId != null and bo.enterpriseId != ''"> |
|
|
|
AND cp.enterprise_id = #{bo.enterpriseId} |
|
|
|
</if> |
|
|
|
<if test="bo.enterpriseName != null and bo.enterpriseName != ''"> |
|
|
|
AND cp.enterprise_name LIKE CONCAT('%', #{bo.enterpriseName}, '%') |
|
|
|
</if> |
|
|
|
<if test="bo.enforceContent != null and bo.enforceContent != ''"> |
|
|
|
AND cp.enforce_content LIKE CONCAT('%', #{bo.enforceContent}, '%') |
|
|
|
</if> |
|
|
|
</where> |
|
|
|
ORDER BY cp.plan_date DESC, cp.plan_time DESC |
|
|
|
</select> |
|
|
|
|
|
|
|
</mapper> |
|
|
|
|