zhangf
2024-05-08 0414ddb0b2b3a7199ae6181a770f97ac140dbd73
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<?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.gkhy.safePlatform.incidentManage.repository.WorkInjuryDeclarationInfoRepository">
 
    <resultMap type="com.gkhy.safePlatform.incidentManage.entity.WorkInjuryDeclarationInfoPageDO" id="WorkInjuryDeclarationInfoPageDOResult">
        <id column="id" property="id" jdbcType="BIGINT"/>
        <result column="declare_user_name" property="declareUserName"/>
        <result column="declare_department_id" property="declareDepartmentId"/>
        <result column="accident_express_id" property="accidentExpressId"/>
        <result column="work_injury_type" property="workInjuryType"/>
        <result column="declare_date" property="declareDate"/>
        <result column="visit_hospital" property="visitHospital"/>
    </resultMap>
 
    <select id="selectWorkInjuryDeclarationList" resultMap="WorkInjuryDeclarationInfoPageDOResult">
        SELECT
        a.id,
        a.`declare_user_name`,
        a.`declare_department_id`,
        a.`accident_express_id`,
        a.work_injury_type,
        a.declare_date,
        a.visit_hospital,
        b.accident_name AS accidentName
        FROM
        work_injury_declaration a
        LEFT JOIN accident_express b ON a.accident_express_id = b.id
        WHERE
        a.del_flag = 0
        <if test="query.accidentExpressId != null">and a.`accident_express_id` = #{query.accidentExpressId}</if>
    </select>
 
    <insert id="addWorkInjuryDeclaration" parameterType="com.gkhy.safePlatform.incidentManage.entity.WorkInjuryDeclarationInfo"
            keyProperty="id" useGeneratedKeys="true">
        insert into work_injury_declaration
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null ">id,</if>
            <if test="delFlag != null ">del_flag,</if>
            <if test="gmtCreate != null ">gmt_create,</if>
            <if test="gmtModitify != null ">gmt_moditify,</if>
            <if test="createUid != null ">create_uid,</if>
            <if test="updateUid != null ">update_uid,</if>
            <if test="declareUserName != null and declareUserName != ''">declare_user_name,</if>
            <if test="declareUserGender != null ">declare_user_gender,</if>
            <if test="declareDepartmentId != null ">declare_department_id,</if>
            <if test="accidentExpressId != null ">accident_express_id,</if>
            <if test="workInjuryType != null and workInjuryType != ''">work_injury_type,</if>
            <if test="declareDate != null ">declare_date,</if>
            <if test="lostTime != null ">lost_time,</if>
            <if test="visitHospital != null and visitHospital != ''">visit_hospital,</if>
            <if test="visitResult != null and visitResult != ''">visit_result,</if>
            <if test="mattersNeedingAttention != null and mattersNeedingAttention != ''">matters_needing_attention,</if>
            <if test="completeMaterials != null ">complete_materials,</if>
            <if test="remark != null and remark != ''">remark,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null ">#{id},</if>
            <if test="delFlag != null ">#{delFlag},</if>
            <if test="gmtCreate != null ">#{gmtCreate},</if>
            <if test="gmtModitify != null ">#{gmtModitify},</if>
            <if test="createUid != null ">#{createUid},</if>
            <if test="updateUid != null ">#{updateUid},</if>
            <if test="declareUserName != null and declareUserName != ''">#{declareUserName},</if>
            <if test="declareUserGender != null ">#{declareUserGender},</if>
            <if test="declareDepartmentId != null ">#{declareDepartmentId},</if>
            <if test="accidentExpressId != null ">#{accidentExpressId},</if>
            <if test="workInjuryType != null and workInjuryType != ''">#{workInjuryType},</if>
            <if test="declareDate != null ">#{declareDate},</if>
            <if test="lostTime != null ">#{lostTime},</if>
            <if test="visitHospital != null and visitHospital != ''">#{visitHospital},</if>
            <if test="visitResult != null and visitResult != ''">#{visitResult},</if>
            <if test="mattersNeedingAttention != null and mattersNeedingAttention != ''">#{mattersNeedingAttention},</if>
            <if test="completeMaterials != null ">#{completeMaterials},</if>
            <if test="remark != null and remark != ''">#{remark},</if>
        </trim>
    </insert>
 
 
    <resultMap type="com.gkhy.safePlatform.incidentManage.entity.WorkInjuryDeclarationInfoDetailDO" id="WorkInjuryDeclarationInfoDetailDOResult">
        <id column="id" property="id" jdbcType="BIGINT"/>
        <result column="declare_user_name" property="declareUserName"/>
        <result column="declare_user_gender" property="declareUserGender"/>
        <result column="declare_department_id" property="declareDepartmentId"/>
        <result column="accident_express_id" property="accidentExpressId"/>
        <result column="work_injury_type" property="workInjuryType"/>
        <result column="declare_date" property="declareDate"/>
        <result column="lost_time" property="lostTime"/>
        <result column="visit_hospital" property="visitHospital"/>
        <result column="visit_result" property="visitResult"/>
        <result column="matters_needing_attention" property="mattersNeedingAttention"/>
        <result column="complete_materials" property="completeMaterials"/>
        <result column="remark" property="remark"/>
    </resultMap>
 
    <select id="selectWorkInjuryDeclarationById" resultMap="WorkInjuryDeclarationInfoDetailDOResult">
        SELECT
            a.id,
            a.declare_user_name,
            a.`declare_user_gender`,
            a.`declare_department_id`,
            a.`accident_express_id`,
            a.`work_injury_type`,
            a.declare_date,
            a.lost_time,
            a.`visit_hospital`,
            a.`visit_result`,
            a.`matters_needing_attention`,
            a.`complete_materials`,
            a.remark,
            b.accident_name AS accidentName,
            b.occurrence_time AS occurrenceTime
        FROM
            work_injury_declaration a
            LEFT JOIN accident_express b ON a.accident_express_id = b.id
        WHERE a.del_flag = 0 and a.id = #{id}
    </select>
 
    <update id="updateWorkInjuryDeclaration" parameterType="com.gkhy.safePlatform.incidentManage.entity.WorkInjuryDeclarationInfo">
        update work_injury_declaration
        <trim prefix="SET" suffixOverrides=",">
            <if test="gmtModitify != null ">gmt_moditify = #{gmtModitify},</if>
            <if test="updateUid != null ">update_uid = #{updateUid},</if>
 
            <if test="declareUserName != null and declareUserName != ''">declare_user_name = #{declareUserName},</if>
            <if test="declareUserGender != null "> declare_user_gender = #{declareUserGender},</if>
            <if test="declareDepartmentId != null ">declare_department_id = #{declareDepartmentId},</if>
            <if test="accidentExpressId != null ">accident_express_id = #{accidentExpressId},</if>
            <if test="workInjuryType != null and workInjuryType != ''">work_injury_type = #{workInjuryType},</if>
            <if test="declareDate != null ">declare_date = #{declareDate},</if>
            <if test="lostTime != null ">lost_time = #{lostTime},</if>
            <if test="visitHospital != null and visitHospital != ''">visit_hospital = #{visitHospital},</if>
            <if test="visitResult != null and visitResult != ''">visit_result = #{visitResult},</if>
            <if test="mattersNeedingAttention != null and mattersNeedingAttention != ''">matters_needing_attention = #{mattersNeedingAttention},</if>
            <if test="completeMaterials != null ">complete_materials = #{completeMaterials},</if>
            <if test="remark != null and remark != ''">remark = #{remark},</if>
        </trim>
        where id = #{id}
    </update>
 
    <update id="deleteWorkInjuryDeclarationById">
        update work_injury_declaration set del_flag = 1 where id = #{id}
    </update>
</mapper>