kongzy
2024-09-23 d015cc0b48ca51a2b93b6c60c91dc352a104b1e7
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
<?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.emergency.repository.EmergencyPlanFileInfoRepository">
 
    <insert id="addEmergencyPlanFile">
        insert into emergency_plan_file
        <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="planId != null ">plan_id,</if>
            <if test="fileUrl != null and fileUrl != ''">file_url,</if>
            <if test="fileName != null and fileName != ''">file_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="planId != null ">#{planId},</if>
            <if test="fileUrl != null and fileUrl != ''">#{fileUrl},</if>
            <if test="fileName != null and fileName != ''">#{fileName}</if>
        </trim>
    </insert>
 
    <resultMap type="com.gkhy.safePlatform.emergency.entity.EmergencyPlanFileInfoDO" id="emergencyPlanFileInfoDOResult">
        <id column="id" property="id" jdbcType="BIGINT"/>
        <result column="plan_id" property="planId" />
        <result column="file_url" property="fileUrl" />
        <result column="file_name" property="fileName" />
    </resultMap>
 
    <select id="selectEmergencyPlanFileByPlanId" resultMap="emergencyPlanFileInfoDOResult">
        select id,`plan_id`,`file_url`,`file_name` from emergency_plan_file where del_flag = 0 and plan_id = #{planId}
    </select>
 
    <update id = "deleteEmergencyPlanFileByIds" >
        update emergency_plan_file set del_flag = 1 where id in
        <foreach item="id" collection="ids" open="(" separator="," close=")">
            #{id}
        </foreach>
    </update>
 
    <update id="deleteEmergencyPlanFileByPlanId">
        update emergency_plan_file set del_flag = 1 where plan_id = #{planId}
    </update>
 
</mapper>