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
<?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.AccidentExpressInfoRepository">
 
    <resultMap type="com.gkhy.safePlatform.incidentManage.entity.AccidentExpressInfoPageDO" id="AccidentExpressInfoPageDOResult">
        <id column="id" property="id" jdbcType="BIGINT"/>
        <result column="gmt_moditify" property="gmtModitify"/>
        <result column="create_uid" property="createUid"/>
        <result column="create_name" property="createName"/>
        <result column="accident_cause" property="accidentCause"/>
        <result column="occurrence_time" property="occurrenceTime"/>
        <result column="occurrence_place" property="occurrencePlace"/>
        <result column="accident_department_id" property="accidentDepartmentId"/>
        <result column="accident_name" property="accidentName"/>
    </resultMap>
 
    <select id="selectAccidentExpressList" resultMap="AccidentExpressInfoPageDOResult">
        select id,`gmt_moditify`,`create_uid`,`accident_cause`,`occurrence_time`,occurrence_place ,accident_department_id ,accident_name ,create_name
          from accident_express where del_flag = 0
        <if test="query.accidentName != null  and query.accidentName != ''">and `accident_name` like concat('%', #{query.accidentName}, '%')</if>
    </select>
 
    <insert id="addAccidentExpress" parameterType="com.gkhy.safePlatform.incidentManage.entity.AccidentExpressInfo"
            keyProperty="id" useGeneratedKeys="true">
        insert into accident_express
        <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="createName != null and createName != ''">create_name,</if>
            <if test="emergencyPrecautions != null and emergencyPrecautions != ''">emergency_precautions,</if>
            <if test="accidentCausesPreliminaryAnalysis != null and accidentCausesPreliminaryAnalysis != ''">accident_causes_preliminary_analysis,</if>
            <if test="accidentBriefProcess != null and accidentBriefProcess != ''">accident_brief_process,</if>
            <if test="casualties != null ">casualties,</if>
            <if test="accidentCause != null and accidentCause != ''">accident_cause,</if>
            <if test="occurrenceTime != null ">occurrence_time,</if>
            <if test="occurrencePlace != null and occurrencePlace != ''">occurrence_place,</if>
            <if test="accidentDepartmentId != null ">accident_department_id,</if>
            <if test="accidentName != null and accidentName != ''">accident_name,</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="createName != null and createName != ''">#{createName},</if>
            <if test="emergencyPrecautions != null and emergencyPrecautions != ''">#{emergencyPrecautions},</if>
            <if test="accidentCausesPreliminaryAnalysis != null and accidentCausesPreliminaryAnalysis != ''">#{accidentCausesPreliminaryAnalysis},</if>
            <if test="accidentBriefProcess != null and accidentBriefProcess != ''">#{accidentBriefProcess},</if>
            <if test="casualties != null ">#{casualties},</if>
            <if test="accidentCause != null and accidentCause != ''">#{accidentCause},</if>
            <if test="occurrenceTime != null ">#{occurrenceTime},</if>
            <if test="occurrencePlace != null and occurrencePlace != ''">#{occurrencePlace},</if>
            <if test="accidentDepartmentId != null ">#{accidentDepartmentId},</if>
            <if test="accidentName != null and accidentName != ''">#{accidentName},</if>
        </trim>
    </insert>
 
 
    <resultMap type="com.gkhy.safePlatform.incidentManage.entity.AccidentExpressInfoDetailDO" id="AccidentExpressInfoDetailDOResult">
        <id column="id" property="id" jdbcType="BIGINT"/>
        <result column="emergency_precautions" property="emergencyPrecautions"/>
        <result column="accident_causes_preliminary_analysis" property="accidentCausesPreliminaryAnalysis"/>
        <result column="accident_brief_process" property="accidentBriefProcess"/>
        <result column="casualties" property="casualties"/>
        <result column="accident_cause" property="accidentCause"/>
        <result column="occurrence_time" property="occurrenceTime"/>
        <result column="occurrence_place" property="occurrencePlace"/>
        <result column="accident_department_id" property="accidentDepartmentId"/>
        <result column="accident_name" property="accidentName"/>
    </resultMap>
 
    <select id="selectAccidentExpressById" resultMap="AccidentExpressInfoDetailDOResult">
        select id ,`emergency_precautions`,`accident_causes_preliminary_analysis`,`accident_brief_process`,`casualties`,accident_cause,
        occurrence_time ,occurrence_place ,accident_department_id ,accident_name from accident_express
        where del_flag = 0 and id = #{id}
    </select>
 
    <update id="updateAccidentExpress" parameterType="com.gkhy.safePlatform.incidentManage.entity.AccidentExpressInfo">
        update accident_express
        <trim prefix="SET" suffixOverrides=",">
            <if test="gmtModitify != null ">gmt_moditify = #{gmtModitify},</if>
            <if test="updateUid != null ">update_uid = #{updateUid},</if>
            <if test="emergencyPrecautions != null and emergencyPrecautions != ''">emergency_precautions = #{emergencyPrecautions},</if>
            <if test="accidentCausesPreliminaryAnalysis != null and accidentCausesPreliminaryAnalysis != ''"> accident_causes_preliminary_analysis= #{accidentCausesPreliminaryAnalysis},</if>
            <if test="accidentBriefProcess != null and accidentBriefProcess != ''">accident_brief_process = #{accidentBriefProcess},</if>
            <if test="casualties != null ">casualties = #{casualties},</if>
            <if test="accidentCause != null and accidentCause != ''">accident_cause = #{accidentCause},</if>
            <if test="occurrenceTime != null ">occurrence_time = #{occurrenceTime},</if>
            <if test="occurrencePlace != null and occurrencePlace != ''">occurrence_place = #{occurrencePlace},</if>
            <if test="accidentDepartmentId != null ">accident_department_id = #{accidentDepartmentId},</if>
            <if test="accidentName != null and accidentName != ''">accident_name = #{accidentName},</if>
        </trim>
        where id = #{id}
    </update>
 
    <update id="deleteAccidentExpressById">
        update accident_express set del_flag = 1 where id = #{id}
    </update>
</mapper>