zss
2024-12-24 8216fd30e7eb970fd175f658c502ec2563174c37
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yuanchu.mom.mapper.PersonSupervisionProcessingSheetMapper">
 
    <!-- 查询人员监督记录处理单 -->
    <select id="selectProcessingSheet" resultType="com.yuanchu.mom.dto.PersonSupervisionProcessingSheetDto">
        select sps.*,
               dl1.name                                                     proposing_department,
               dl2.name                                                     causeAnalysisDepartment,
               dl3.name                                                     corrective_action,
               dl4.name                                                     verification_department,
               DATE_FORMAT(sps.proposing_department_date, '%Y-%m-%d')    AS proposing_department_date_string,
               DATE_FORMAT(sps.cause_analysis_date, '%Y-%m-%d')          AS cause_analysis_date_string,
               DATE_FORMAT(sps.corrective_action_date, '%Y-%m-%d')       AS corrective_action_date_string,
               DATE_FORMAT(sps.verification_department_date, '%Y-%m-%d') AS verification_department_date_string
        from cnas_person_supervision_processing_sheet sps
                 left join user u1 on u1.id = sps.proposing_department_person_id
                 left join user u2 on u2.id = sps.cause_analysis_person_id
                 left join user u3 on u3.id = sps.corrective_action_id
                 left join user u4 on u4.id = sps.verification_department_person_id
                 left join department_lims dl1 on dl1.id = SUBSTRING_INDEX(SUBSTRING_INDEX(u1.depart_lims_id, ',', -2), ',', 1) and dl1.id != 1
                 left join department_lims dl2 on dl2.id = SUBSTRING_INDEX(SUBSTRING_INDEX(u2.depart_lims_id, ',', -2), ',', 1) and dl2.id != 1
                 left join department_lims dl3 on dl3.id = SUBSTRING_INDEX(SUBSTRING_INDEX(u3.depart_lims_id, ',', -2), ',', 1) and dl3.id != 1
                 left join department_lims dl4 on dl4.id = SUBSTRING_INDEX(SUBSTRING_INDEX(u4.depart_lims_id, ',', -2), ',', 1) and dl4.id != 1
        where sps.supervision_record_id = #{supervisionRecordId}
    </select>
 
</mapper>