liujie
3 天以前 d130547c1f3b64cf8544261cdf1d9146ff319756
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/resources/mapper/ComplaintMapper.xml
@@ -602,15 +602,32 @@
    </select>
    <select id="queryRejectRecordPage" resultType="com.panzhihua.sangeshenbian.model.vo.AppComplaintRejectVO">
        SELECT
            scar.*,
            sc.serial_number,
            sc.latitude,
            sc.longitude,
            sc.location,
            sc.detailed_address,
            sc.problem_type,
            sc.name,
            sc.contact_number
        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
        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
@@ -636,4 +653,87 @@
        </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) &lt;= date(sc.create_time)
                    </when>
                    <when test="query.timeType == 2">
                        and date_sub(curdate(), INTERVAL 15 DAY) &lt;= date(sc.create_time)
                    </when>
                    <when test="query.timeType == 3">
                        and date_sub(curdate(), INTERVAL 30 DAY) &lt;= date(sc.create_time)
                    </when>
                </choose>
            </if>
        </where>
        ORDER BY sc.create_time DESC
    </select>
</mapper>