| | |
| | | </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> |