| | |
| | | sc.images, |
| | | sc.videos, |
| | | CASE |
| | | /* 当诉求是当前用户处理的,显示正常状态 */ |
| | | WHEN (scar.superior_id = #{targetId} OR scar.create_by = #{query.userId}) THEN |
| | | CASE |
| | | WHEN sc.status = 0 and scar.audit_type = 1 AND scar.audit_status = 0 THEN 7 |
| | | WHEN sc.status = 0 and scar.audit_type = 2 AND scar.audit_status = 0 THEN 5 |
| | | WHEN sc.status = 0 and scar.audit_status = 2 THEN 6 |
| | | WHEN sc.status = 0 and scar.audit_status = 2 and scar.audit_type = 2 THEN 6 |
| | | WHEN sc.status = 0 and scar.audit_status = 2 and scar.audit_type = 1 THEN 9 |
| | | ELSE sc.status |
| | | END |
| | | /* 当诉求不是当前用户处理的,已办结(3)保持不变,其他状态都显示为正在办理(0) */ |
| | | ELSE |
| | | CASE |
| | | WHEN sc.status = 3 THEN 3 |
| | | ELSE 0 |
| | | END |
| | | END AS status, |
| | | sc.report_type, |
| | | sc.superior_id, |
| | |
| | | sc.longitude, |
| | | scar.audit_type, |
| | | scar.audit_status, |
| | | scar.reporter_level, |
| | | scar.comment, |
| | | scar.create_time AS reportTime, |
| | | scar.system_user_id, |
| | | scar.create_by as auditCreateBy, |
| | | scar.reporter, |
| | | scar.reporter_id, |
| | | scar.superior_id superiorId2, |
| | | scar.department_name, |
| | | scar.department_id |
| | | FROM sgsb_complaint sc |
| | | INNER JOIN sgsb_complaint_audit_record scar ON scar.complaint_id = sc.id and scar.latest_flag = 1 |
| | | LEFT JOIN sgsb_complaint_audit_record scar ON scar.complaint_id = sc.id and scar.latest_flag = 1 |
| | | <where> |
| | | scar.latest_flag = 1 |
| | | <if test="1 == accountLevel"> |
| | | and sc.city_code = #{targetId} |
| | | </if> |
| | | <if test="2 == accountLevel"> |
| | | and (sc.districts_code = #{targetId} || sc.id in (select complaint_id from sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = #{accountLevel} and superior_id = #{targetId})) |
| | | and (sc.districts_code = #{targetId} OR sc.id in (select complaint_id from sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = #{accountLevel} and superior_id = #{targetId})) |
| | | </if> |
| | | <if test="null != streetId"> |
| | | and (sc.street_id = #{streetId} || sc.id in (select complaint_id from sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = #{accountLevel} and superior_id = #{targetId})) |
| | | <if test="3 == accountLevel"> |
| | | and (sc.street_id = #{targetId} OR sc.id in (select complaint_id from sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = #{accountLevel} and superior_id = #{targetId})) |
| | | </if> |
| | | <if test="null != communityId"> |
| | | and (sc.community_id = #{communityId} || sc.id in (select complaint_id from sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = #{accountLevel} and superior_id = #{targetId})) |
| | | <if test="4 == accountLevel"> |
| | | and (sc.community_id = #{targetId} OR sc.id in (select complaint_id from sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = #{accountLevel} and superior_id = #{targetId})) |
| | | </if> |
| | | <if test="null != partyMemberId"> |
| | | and (sc.party_member_id = #{partyMemberId} || sc.id in (select complaint_id from sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = #{accountLevel} and superior_id = #{targetId})) |
| | | <if test="5 == accountLevel"> |
| | | and (sc.party_member_id = #{targetId} OR sc.id in (select complaint_id from sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = #{accountLevel} and superior_id = #{targetId})) |
| | | </if> |
| | | <if test="query.type!=null and query.type == 0"> |
| | | AND (scar.superior_id = #{targetId} or scar.create_by = #{query.userId}) |
| | | AND sc.status IN(0,1,2) and scar.audit_status = 0 |
| | | </if> |
| | | <if test="query.type!=null and query.type == 1"> |
| | | AND sc.status IN(0,1,2) and scar.audit_status != 0 |
| | | AND ( |
| | | /* 如果是当前用户处理的诉求,正常显示正在办理的诉求 */ |
| | | ((scar.superior_id = #{targetId} OR scar.create_by = #{query.userId}) AND sc.status IN(0,1,2)) |
| | | OR |
| | | /* 如果不是当前用户处理的诉求,只要不是已办结(3)或已评价(8)的都算作正在办理 */ |
| | | ((scar.superior_id != #{targetId} AND scar.create_by != #{query.userId} OR scar.superior_id IS NULL) AND sc.status NOT IN(3,8)) |
| | | ) |
| | | </if> |
| | | <if test="query.type!=null and query.type == 2"> |
| | | AND sc.status = 3 |
| | | AND sc.status IN (3,8) |
| | | </if> |
| | | </where> |
| | | ORDER BY sc.create_time DESC |
| | |
| | | sc.over_time_days, |
| | | sc.latitude, |
| | | sc.longitude, |
| | | sc.report_user_name, |
| | | sc.report_user_phone, |
| | | scar.audit_type, |
| | | scar.audit_status, |
| | | scar.comment, |
| | | scar.images, |
| | | scar.videos, |
| | | scar.create_time AS reportTime, |
| | | scar.system_user_id, |
| | | scar.create_by as auditCreateBy, |
| | | scar.reporter, |
| | | su2.phone reporterPhone, |
| | | scar.department_name, |
| | | scar.department_id, |
| | | scar.comment, |
| | | scar.auditor_name, |
| | | scar.auditor_phone, |
| | | scar.reporter_id, |
| | | scar.superior_id superiorId2, |
| | | ifnull((select a.create_time from sgsb_complaint_audit_record a where a.audit_status != 0 and a.complaint_id = #{id} order by a.sort desc limit 0, 1), "") AS auditTime, |
| | | ifnull((select a.reject_reason from sgsb_complaint_audit_record a where a.audit_status != 0 and a.complaint_id = #{id} order by a.sort desc limit 0, 1), "") as rejectReason, |
| | | su.nick_name, |
| | | su.phone, |
| | | ifnull((select b.nick_name from sgsb_complaint_audit_record a left join sys_user b on (a.create_by = b.user_id) where a.audit_status != 0 and a.complaint_id = #{id} order by a.sort desc limit 0, 1), "") AS auditorName, |
| | | ifnull((select b.phone from sgsb_complaint_audit_record a left join sys_user b on (a.create_by = b.user_id) where a.audit_status != 0 and a.complaint_id = #{id} order by a.sort desc limit 0, 1), "") AS auditorPhone |
| | | su.phone |
| | | FROM sgsb_complaint sc |
| | | LEFT JOIN sys_user su ON su.user_id = sc.create_by |
| | | LEFT JOIN sgsb_complaint_audit_record scar ON scar.complaint_id = sc.id and scar.latest_flag = 1 |
| | | LEFT JOIN sys_user su2 ON su2.user_id = scar.create_by |
| | | <where> |
| | | sc.id = #{id} |
| | | </where> |
| | |
| | | sc.images, |
| | | sc.videos, |
| | | CASE |
| | | WHEN sc.status = 0 and scar.audit_type = 1 AND scar.audit_status = 0 THEN 7 |
| | | WHEN sc.status = 0 and scar.audit_type = 2 AND scar.audit_status = 0 THEN 5 |
| | | WHEN sc.status = 0 and scar.audit_status = 2 THEN 6 |
| | | WHEN sc.status = 0 and scar.audit_type = 1 AND scar.audit_status = 0 THEN 4 |
| | | WHEN sc.status = 0 and scar.audit_type = 2 AND scar.audit_status = 0 THEN 4 |
| | | ELSE sc.status |
| | | END AS status, |
| | | sc.report_type, |
| | | sc.report_user_name, |
| | | sc.report_user_phone, |
| | | sc.superior_id, |
| | | sc.city_code, |
| | | sc.districts_code, |
| | | sc.street_id, |
| | | sc.community_id, |
| | | sc.party_member_id, |
| | | sc.create_by, |
| | | sc.create_time, |
| | | sc.update_by, |
| | | sc.update_time, |
| | | sc.completion_description, |
| | | sc.completion_images, |
| | | sc.completion_videos, |
| | | sc.completion_other_description, |
| | | sc.completion_time, |
| | | sc.completion_user_id, |
| | | sc.completion_username, |
| | | sc.completion_user_phone, |
| | | sc.closing_time, |
| | | sc.over_time_days, |
| | | sc.latitude, |
| | | sc.longitude, |
| | | scar.audit_type, |
| | | scar.audit_status, |
| | | scar.comment, |
| | | scar.create_time AS reportTime, |
| | | scar.system_user_id, |
| | | scar.reporter, |
| | | scar.department_name, |
| | | scar.department_id, |
| | | scc.rate |
| | | FROM sgsb_complaint sc |
| | | LEFT JOIN sgsb_complaint_audit_record scar ON scar.complaint_id = sc.id and scar.latest_flag = 1 |
| | | LEFT JOIN sgsb_complaint_comment scc ON sc.id = scc.complaint_id |
| | | ) AS t |
| | | <where> |
| | | <if test="1 == loginUserInfo.accountLevel"> |
| | | and t.city_code = 510400 |
| | | </if> |
| | | <if test="2 == loginUserInfo.accountLevel"> |
| | | and (t.districts_code = #{loginUserInfo.districtsCode} OR t.id in (select complaint_id from |
| | | sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = |
| | | #{loginUserInfo.accountLevel} and superior_id = #{loginUserInfo.districtsCode})) |
| | | </if> |
| | | <if test="3 == loginUserInfo.accountLevel"> |
| | | and (t.street_id = #{loginUserInfo.streetId} OR t.id in (select complaint_id from |
| | | sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = |
| | | #{loginUserInfo.accountLevel} and superior_id = #{loginUserInfo.streetId})) |
| | | </if> |
| | | <if test="4 == loginUserInfo.accountLevel"> |
| | | and (t.community_id = #{loginUserInfo.communityId} OR t.id in (select complaint_id from |
| | | sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = |
| | | #{loginUserInfo.accountLevel} and superior_id = #{loginUserInfo.communityId})) |
| | | </if> |
| | | <if test="query.status!=null and query.status!=''"> |
| | | AND t.status = #{query.status} |
| | | </if> |
| | | <if test="query.reportUserName != null and query.reportUserName!=''"> |
| | | AND t.report_user_name LIKE CONCAT('%',#{query.reportUserName},'%') |
| | | </if> |
| | | <if test="query.reportUserPhone != null and query.reportUserPhone!=''"> |
| | | AND t.report_user_phone LIKE CONCAT('%',#{query.reportUserPhone},'%') |
| | | </if> |
| | | <if test="query.name != null and query.name!=''"> |
| | | AND t.name LIKE CONCAT('%',#{query.name},'%') |
| | | </if> |
| | | <if test="query.contactNumber != null and query.contactNumber!=''"> |
| | | AND t.contact_number LIKE CONCAT('%',#{query.contactNumber},'%') |
| | | </if> |
| | | <if test="query.startTime != null and query.endTime!=null"> |
| | | AND t.create_time BETWEEN #{query.startTime} AND #{query.endTime} |
| | | </if> |
| | | <if test="query.problemType != null and query.problemType!=''"> |
| | | AND t.problem_type =#{query.problemType} |
| | | </if> |
| | | </where> |
| | | GROUP BY t.id |
| | | ORDER BY t.create_time DESC |
| | | </select> |
| | | <select id="getList" resultType="com.panzhihua.sangeshenbian.model.vo.ComplaintVO"> |
| | | SELECT * FROM( |
| | | SELECT sc.id, |
| | | sc.serial_number, |
| | | sc.time, |
| | | sc.problem_type, |
| | | sc.name, |
| | | sc.contact_number, |
| | | sc.location, |
| | | sc.detailed_address, |
| | | sc.description_title, |
| | | sc.description_content, |
| | | sc.images, |
| | | sc.videos, |
| | | CASE |
| | | WHEN sc.status = 0 and scar.audit_type = 1 AND scar.audit_status = 0 THEN 4 |
| | | WHEN sc.status = 0 and scar.audit_type = 2 AND scar.audit_status = 0 THEN 4 |
| | | ELSE sc.status |
| | | END AS status, |
| | | sc.report_type, |
| | | sc.report_user_name, |
| | | sc.report_user_phone, |
| | | sc.superior_id, |
| | | sc.city_code, |
| | | sc.districts_code, |
| | |
| | | scar.department_name, |
| | | scar.department_id |
| | | FROM sgsb_complaint sc |
| | | INNER JOIN sgsb_complaint_audit_record scar ON scar.complaint_id = sc.id and scar.latest_flag = 1 |
| | | LEFT JOIN sgsb_complaint_audit_record scar ON scar.complaint_id = sc.id and scar.latest_flag = 1 |
| | | ) AS t |
| | | <where> |
| | | scar.latest_flag = 1 |
| | | <if test="1 == loginUserInfo.accountLevel"> |
| | | and t.city_code = 510400 |
| | | </if> |
| | | <if test="2 == loginUserInfo.accountLevel"> |
| | | and (t.districts_code = #{loginUserInfo.districtsCode} || t.id in (select complaint_id from |
| | | and (t.districts_code = #{loginUserInfo.districtsCode} OR t.id in (select complaint_id from |
| | | sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = |
| | | #{loginUserInfo.accountLevel} and superior_id = #{loginUserInfo.districtsCode})) |
| | | </if> |
| | | <if test="3 == loginUserInfo.accountLevel"> |
| | | and (t.street_id = #{loginUserInfo.streetId} || t.id in (select complaint_id from |
| | | and (t.street_id = #{loginUserInfo.streetId} OR t.id in (select complaint_id from |
| | | sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = |
| | | #{loginUserInfo.accountLevel} and superior_id = #{loginUserInfo.streetId})) |
| | | </if> |
| | | <if test="4 == loginUserInfo.accountLevel"> |
| | | and (t.community_id = #{loginUserInfo.communityId} || t.id in (select complaint_id from |
| | | and (t.community_id = #{loginUserInfo.communityId} OR t.id in (select complaint_id from |
| | | sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = |
| | | #{loginUserInfo.accountLevel} and superior_id = #{loginUserInfo.communityId})) |
| | | </if> |
| | | <if test="query.status!=null and query.status == 0"> |
| | | AND t.status = #{query.status} |
| | | </if> |
| | | <if test="query.nickname != null and query.nickname!=''"> |
| | | |
| | | <if test="query.reportUserName != null and query.reportUserName!=''"> |
| | | AND t.report_user_name LIKE CONCAT('%',#{query.reportUserName},'%') |
| | | </if> |
| | | <if test="query.phone != null and query.phone!=''"> |
| | | |
| | | <if test="query.reportUserPhone != null and query.reportUserPhone!=''"> |
| | | AND t.report_user_phone LIKE CONCAT('%',#{query.phone},'%') |
| | | </if> |
| | | <if test="query.name != null and query.name!=''"> |
| | | AND t.name LIKE CONCAT('%',#{query.name},'%') |
| | | </if> |
| | | <if test="query.contactNumber != null and query.contactNumber!=''"> |
| | | AND t.contact_number LIKE CONCAT('%',#{query.contactNumber},'%') |
| | | </if> |
| | | <if test="query.startTime != null and query.endTime!=null"> |
| | | AND t.create_time BETWEEN #{query.startTime} AND #{query.endTime} |
| | |
| | | AND t.problem_type =#{query.problemType} |
| | | </if> |
| | | </where> |
| | | GROUP BY t.id |
| | | ORDER BY t.create_time DESC |
| | | </select> |
| | | <select id="getList" resultType="com.panzhihua.sangeshenbian.model.vo.ComplaintVO"> |
| | | |
| | | |
| | | <select id="getTimeoutAndNotComment" resultType="com.panzhihua.sangeshenbian.model.entity.Complaint"> |
| | | select * from sgsb_complaint where status = 3 and DATE_ADD(completion_time, INTERVAL 10 DAY) <= NOW() and id not in (select complaint_id from sgsb_complaint_comment where del_flag = 0) |
| | | </select> |
| | | <select id="getDetailBg" resultType="com.panzhihua.sangeshenbian.model.vo.ComplaintVO" |
| | | parameterType="java.lang.Long"> |
| | | SELECT * FROM( |
| | | SELECT sc.id, |
| | | sc.serial_number, |
| | | sc.time, |
| | | sc.problem_type, |
| | | sc.name, |
| | | sc.contact_number, |
| | | sc.location, |
| | | sc.detailed_address, |
| | | sc.description_title, |
| | | sc.description_content, |
| | | sc.images, |
| | | sc.videos, |
| | | CASE |
| | | WHEN sc.status = 0 and scar.audit_type = 1 AND scar.audit_status = 0 THEN 4 |
| | | WHEN sc.status = 0 and scar.audit_type = 2 AND scar.audit_status = 0 THEN 4 |
| | | ELSE sc.status |
| | | END AS status, |
| | | sc.report_type, |
| | | sc.report_user_name, |
| | | sc.report_user_phone, |
| | | sc.superior_id, |
| | | sc.city_code, |
| | | sc.districts_code, |
| | | sc.street_id, |
| | | sc.community_id, |
| | | sc.party_member_id, |
| | | sc.create_by, |
| | | sc.create_time, |
| | | sc.update_by, |
| | | sc.update_time, |
| | | sc.completion_description, |
| | | sc.completion_images, |
| | | sc.completion_videos, |
| | | sc.completion_other_description, |
| | | sc.completion_time, |
| | | sc.completion_user_id, |
| | | sc.completion_username, |
| | | sc.completion_user_phone, |
| | | sc.completion_user_level, |
| | | sc.closing_time, |
| | | sc.over_time_days, |
| | | sc.latitude, |
| | | sc.longitude, |
| | | scar.audit_type, |
| | | scar.audit_status, |
| | | scar.comment, |
| | | scar.create_time AS reportTime, |
| | | scar.system_user_id, |
| | | scar.reporter, |
| | | scar.department_name, |
| | | scar.department_id |
| | | FROM sgsb_complaint sc |
| | | LEFT JOIN sgsb_complaint_audit_record scar ON scar.complaint_id = sc.id and scar.latest_flag = 1 |
| | | ) AS t |
| | | WHERE t.id = #{id} |
| | | GROUP BY t.id |
| | | </select> |
| | | <select id="queryProcessingRecordPage" resultType="com.panzhihua.sangeshenbian.model.vo.ComplaintVO"> |
| | | SELECT sc.id, |
| | | sc.serial_number, |
| | | sc.time, |
| | |
| | | END AS status, |
| | | sc.report_type, |
| | | sc.superior_id, |
| | | sc.city_code, |
| | | sc.districts_code, |
| | | sc.street_id, |
| | | sc.community_id, |
| | | sc.party_member_id, |
| | | sc.create_by, |
| | | sc.create_time, |
| | | sc.update_by, |
| | |
| | | sc.longitude, |
| | | scar.audit_type, |
| | | scar.audit_status, |
| | | scar.reporter_level, |
| | | scar.comment, |
| | | scar.create_time AS reportTime, |
| | | scar.system_user_id, |
| | | scar.create_by as auditCreateBy, |
| | | scar.reporter, |
| | | scar.reporter_id, |
| | | scar.superior_id superiorId2, |
| | | scar.department_name, |
| | | scar.department_id |
| | | scar.department_id, |
| | | (SELECT COUNT(*) FROM sgsb_complaint_progress WHERE complaint_id = sc.id) AS progress_count, |
| | | (SELECT COUNT(*) FROM sgsb_complaint_audit_record WHERE complaint_id = sc.id AND audit_type = 3 AND audit_status = 1) AS assignment_count, |
| | | (SELECT COUNT(*) FROM sgsb_complaint_audit_record WHERE complaint_id = sc.id AND audit_type = 2 AND audit_status = 1) AS report_count |
| | | FROM sgsb_complaint sc |
| | | INNER JOIN sgsb_complaint_audit_record scar ON scar.complaint_id = sc.id and scar.latest_flag = 1 |
| | | ) AS t |
| | | LEFT JOIN sgsb_complaint_audit_record scar ON scar.complaint_id = sc.id and scar.latest_flag = 1 |
| | | <where> |
| | | scar.latest_flag = 1 |
| | | <if test="1 == loginUserInfo.accountLevel"> |
| | | and t.city_code = 510400 |
| | | <if test="1 == accountLevel"> |
| | | and sc.city_code = #{targetId} |
| | | </if> |
| | | <if test="2 == loginUserInfo.accountLevel"> |
| | | and (t.districts_code = #{loginUserInfo.districtsCode} || t.id in (select complaint_id from |
| | | sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = |
| | | #{loginUserInfo.accountLevel} and superior_id = #{loginUserInfo.districtsCode})) |
| | | <if test="2 == accountLevel"> |
| | | and (sc.districts_code = #{targetId} or sc.id in (select complaint_id from sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = #{accountLevel} and superior_id = #{targetId})) |
| | | </if> |
| | | <if test="3 == loginUserInfo.accountLevel"> |
| | | and (t.street_id = #{loginUserInfo.streetId} || t.id in (select complaint_id from |
| | | sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = |
| | | #{loginUserInfo.accountLevel} and superior_id = #{loginUserInfo.streetId})) |
| | | <if test="3 == accountLevel"> |
| | | and (sc.street_id = #{targetId} or sc.id in (select complaint_id from sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = #{accountLevel} and superior_id = #{targetId})) |
| | | </if> |
| | | <if test="4 == loginUserInfo.accountLevel"> |
| | | and (t.community_id = #{loginUserInfo.communityId} || t.id in (select complaint_id from |
| | | sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = |
| | | #{loginUserInfo.accountLevel} and superior_id = #{loginUserInfo.communityId})) |
| | | <if test="4 == accountLevel"> |
| | | and (sc.community_id = #{targetId} or sc.id in (select complaint_id from sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = #{accountLevel} and superior_id = #{targetId})) |
| | | </if> |
| | | <if test="query.status!=null and query.status == 0"> |
| | | AND t.status = #{query.status} |
| | | </if> |
| | | <if test="query.nickname != null and query.nickname!=''"> |
| | | |
| | | </if> |
| | | <if test="query.phone != null and query.phone!=''"> |
| | | |
| | | </if> |
| | | <if test="query.startTime != null and query.endTime!=null"> |
| | | AND t.create_time BETWEEN #{query.startTime} AND #{query.endTime} |
| | | </if> |
| | | <if test="query.problemType != null and query.problemType!=''"> |
| | | AND t.problem_type =#{query.problemType} |
| | | <if test="keyword!=null and keyword != ''"> |
| | | AND (sc.name like concat('%',#{keyword},'%') |
| | | or sc.id in (select complaint_id from sgsb_complaint_progress where create_by_name like concat('%',#{keyword},'%')) |
| | | or sc.report_user_name like concat('%',#{keyword},'%')) |
| | | </if> |
| | | </where> |
| | | ORDER BY t.create_time DESC |
| | | ORDER BY sc.create_time DESC |
| | | </select> |
| | | |
| | | |
| | | <select id="getTimeoutAndNotComment" resultType="com.panzhihua.sangeshenbian.model.entity.Complaint"> |
| | | select * from sgsb_complaint where status = 3 and DATE_ADD(completion_time, INTERVAL 10 DAY) <= NOW() and id not in (select complaint_id from sgsb_complaint_comment where del_flag = 0) |
| | | <select id="queryRejectRecordPage" resultType="com.panzhihua.sangeshenbian.model.vo.AppComplaintRejectVO"> |
| | | SELECT |
| | | scar.id, |
| | | scar.complaint_id, |
| | | scar.auditor_id, |
| | | scar.audit_type, |
| | | scar.audit_status, |
| | | scar.reject_reason, |
| | | scar.comment, |
| | | scar.images, |
| | | scar.videos, |
| | | scar.create_time AS applyTime, |
| | | scar.system_user_id, |
| | | scar.reporter, |
| | | scar.department_name, |
| | | scar.department_id, |
| | | scar.latest_flag, |
| | | scar.report_type, |
| | | scar.superior_id, |
| | | scar.sort, |
| | | scar.auditor_phone, |
| | | scar.apply_phone AS reporterPhone, |
| | | sc.serial_number, |
| | | sc.latitude, |
| | | sc.longitude, |
| | | sc.location, |
| | | sc.detailed_address, |
| | | sc.problem_type, |
| | | sc.name, |
| | | sc.contact_number |
| | | FROM |
| | | sgsb_complaint_audit_record scar |
| | | LEFT JOIN sgsb_complaint sc ON scar.complaint_id = sc.id |
| | | <where> |
| | | scar.audit_type != 3 |
| | | AND scar.audit_status = 2 |
| | | <if test="1 == accountLevel"> |
| | | and sc.city_code = #{targetId} |
| | | </if> |
| | | <if test="2 == accountLevel"> |
| | | and (sc.districts_code = #{targetId} |
| | | </if> |
| | | <if test="3 == accountLevel"> |
| | | and (sc.street_id = #{targetId}) |
| | | </if> |
| | | <if test="4 == accountLevel"> |
| | | and (sc.community_id = #{targetId}) |
| | | </if> |
| | | <if test="keyword!=null and keyword != ''"> |
| | | AND (scar.reporter like concat('%',#{keyword},'%') or scar.auditor_name like concat('%',#{keyword},'%') |
| | | or sc.name like concat('%',#{keyword},'%')or sc.report_user_name like concat('%',#{keyword},'%')) |
| | | </if> |
| | | </where> |
| | | ORDER BY sc.create_time DESC |
| | | </select> |
| | | <select id="queryCompliantList" resultType="com.panzhihua.sangeshenbian.model.entity.Complaint"> |
| | | SELECT sc.id, |
| | | sc.serial_number, |
| | | sc.time, |
| | | sc.problem_type, |
| | | sc.name, |
| | | sc.contact_number, |
| | | sc.location, |
| | | sc.detailed_address, |
| | | sc.description_title, |
| | | sc.description_content, |
| | | sc.images, |
| | | sc.videos, |
| | | CASE |
| | | WHEN sc.status = 0 and scar.audit_type = 1 AND scar.audit_status = 0 THEN 7 |
| | | WHEN sc.status = 0 and scar.audit_type = 2 AND scar.audit_status = 0 THEN 5 |
| | | WHEN sc.status = 0 and scar.audit_status = 2 THEN 6 |
| | | ELSE sc.status |
| | | END AS status, |
| | | sc.superior_type, |
| | | sc.superior_id, |
| | | sc.report_user_name, |
| | | sc.report_user_phone, |
| | | sc.report_type, |
| | | sc.voice_file, |
| | | sc.city_code, |
| | | sc.districts_code, |
| | | sc.street_id, |
| | | sc.community_id, |
| | | sc.party_member_id, |
| | | sc.create_time, |
| | | sc.create_by, |
| | | sc.update_time, |
| | | sc.update_by, |
| | | sc.completion_description, |
| | | sc.completion_images, |
| | | sc.completion_videos, |
| | | sc.completion_other_description, |
| | | sc.completion_time, |
| | | sc.completion_user_id, |
| | | sc.completion_username, |
| | | sc.completion_user_phone, |
| | | sc.closing_time, |
| | | sc.over_time_days, |
| | | sc.longitude, |
| | | sc.latitude, |
| | | sc.completion_user_level, |
| | | sc.handling_day, |
| | | sc.comment_rate |
| | | FROM sgsb_complaint sc |
| | | LEFT JOIN sgsb_complaint_audit_record scar ON scar.complaint_id = sc.id and scar.latest_flag = 1 |
| | | <where> |
| | | <if test="1 == accountLevel"> |
| | | and sc.city_code = #{targetId} |
| | | </if> |
| | | <if test="2 == accountLevel"> |
| | | and (sc.districts_code = #{targetId} || sc.id in (select complaint_id from sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = #{accountLevel} and superior_id = #{targetId})) |
| | | </if> |
| | | <if test="3 == accountLevel"> |
| | | and (sc.street_id = #{targetId} || sc.id in (select complaint_id from sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = #{accountLevel} and superior_id = #{targetId})) |
| | | </if> |
| | | <if test="4 == accountLevel"> |
| | | and (sc.community_id = #{targetId} || sc.id in (select complaint_id from sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = #{accountLevel} and superior_id = #{targetId})) |
| | | </if> |
| | | <if test="5 == accountLevel"> |
| | | and (sc.party_member_id = #{targetId} || sc.id in (select complaint_id from sgsb_complaint_audit_record where audit_type = 3 and audit_status = 1 and report_type = #{accountLevel} and superior_id = #{targetId})) |
| | | </if> |
| | | <if test="query.timeType !=null"> |
| | | <choose> |
| | | <when test="query.timeType == 1"> |
| | | and date_sub(curdate(), INTERVAL 7 DAY) <= date(sc.create_time) |
| | | </when> |
| | | <when test="query.timeType == 2"> |
| | | and date_sub(curdate(), INTERVAL 15 DAY) <= date(sc.create_time) |
| | | </when> |
| | | <when test="query.timeType == 3"> |
| | | and date_sub(curdate(), INTERVAL 30 DAY) <= date(sc.create_time) |
| | | </when> |
| | | </choose> |
| | | </if> |
| | | </where> |
| | | ORDER BY sc.create_time DESC |
| | | </select> |
| | | </mapper> |