| | |
| | | <mapper namespace="com.panzhihua.sangeshenbian.dao.ComplaintMapper"> |
| | | |
| | | <select id="selectComplaintPage" 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 scar.audit_type = 1 AND scar.audit_status = 0 THEN 7 |
| | | WHEN scar.audit_type = 2 AND scar.audit_status = 0 THEN 5 |
| | | WHEN scar.audit_status = 2 THEN 6 |
| | | ELSE sc.status |
| | | END AS status, |
| | | sc.report_type, |
| | | sc.superior_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 |
| | | FROM sgsb_complaint sc |
| | | LEFT JOIN sgsb_complaint_audit_record scar ON scar.complaint_id = sc.id AND scar.latest_flag = 1 |
| | | WHERE |
| | | ((scar.audit_type = 2 AND scar.audit_status != 1) OR (scar.audit_type = 1) OR |
| | | (scar.id IS NULL) OR (scar.audit_type = 2 AND scar.audit_status = 1 AND scar.auditor_id = #{query.userId})) |
| | | ) AS t |
| | | 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 scar.audit_type = 1 |
| | | AND scar.audit_status = 0 THEN |
| | | 7 |
| | | WHEN scar.audit_type = 2 |
| | | AND scar.audit_status = 0 THEN |
| | | 5 |
| | | WHEN scar.audit_status = 2 THEN |
| | | 6 ELSE sc.STATUS |
| | | END AS STATUS, |
| | | sc.report_type, |
| | | sc.superior_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 |
| | | FROM |
| | | sgsb_complaint sc |
| | | LEFT JOIN sgsb_complaint_audit_record scar ON sc.id = scar.complaint_id and scar.latest_flag = 1 |
| | | <where> |
| | | <if test="isSuperior == 1 and targetId != null"> |
| | | AND superior_id = #{targetId} |
| | | </if> |
| | | <if test="isSuperior == 0 and targetId != null"> |
| | | AND create_by = #{targetId} |
| | | <if test="isSuperior == 1"> |
| | | and sc.superior_id = #{targetId} |
| | | </if> |
| | | <if test="isSuperior == 0"> |
| | | and sc.create_by = #{targetId} |
| | | </if> |
| | | <if test="query.type!=null and query.type == 0"> |
| | | AND(audit_type = 1 AND audit_status = 0) OR (audit_type = 2 AND audit_status = 0) |
| | | and audit_type = 1 AND audit_status = 0) OR (audit_type = 2 AND audit_status = 0 |
| | | </if> |
| | | <if test="query.type!=null and query.type == 1"> |
| | | AND (status IN(0,1,2) ) |
| | | and sc.status IN(0,1,2) |
| | | </if> |
| | | <if test="query.type!=null and query.type == 2"> |
| | | AND status = 3 |
| | | and sc.status = 3 |
| | | </if> |
| | | </where> |
| | | ORDER BY create_time DESC |
| | | ORDER BY sc.create_time DESC |
| | | </select> |
| | | <select id="getDetail" resultType="com.panzhihua.sangeshenbian.model.vo.ComplaintVO"> |
| | | SELECT sc.id, |