aijinhui
2023-12-22 2cfcb15fdff730140b6a03a874466802704078eb
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
<?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.ruoyi.app.patrolplan.mapper.ArdAppPatrolpointMapper">
    
    <resultMap type="ArdAppPatrolpoint" id="ArdAppPatrolpointResult">
        <result property="id"    column="id"    />
        <result property="patrolplanId"    column="patrolplan_id"    />
        <result property="alarmpointsId"    column="alarmpoints_id"    />
        <result property="type"    column="type"    />
    </resultMap>
 
    <sql id="selectArdAppPatrolpointVo">
        select id, patrolplan_id, alarmpoints_id, type from ard_app_patrolpoint
    </sql>
 
    <select id="selectArdAppPatrolpointList" parameterType="ArdAppPatrolpoint" resultMap="ArdAppPatrolpointResult">
        <include refid="selectArdAppPatrolpointVo"/>
        <where>  
            <if test="patrolplanId != null  and patrolplanId != ''"> and patrolplan_id = #{patrolplanId}</if>
            <if test="alarmpointsId != null  and alarmpointsId != ''"> and alarmpoints_id = #{alarmpointsId}</if>
            <if test="type != null  and type != ''"> and type = #{type}</if>
        </where>
    </select>
    
    <select id="selectArdAppPatrolpointById" parameterType="String" resultMap="ArdAppPatrolpointResult">
        <include refid="selectArdAppPatrolpointVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertArdAppPatrolpoint" parameterType="ArdAppPatrolpoint">
        insert into ard_app_patrolpoint
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="patrolplanId != null">patrolplan_id,</if>
            <if test="alarmpointsId != null">alarmpoints_id,</if>
            <if test="type != null">type,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="patrolplanId != null">#{patrolplanId},</if>
            <if test="alarmpointsId != null">#{alarmpointsId},</if>
            <if test="type != null">#{type},</if>
         </trim>
    </insert>
 
    <update id="updateArdAppPatrolpoint" parameterType="ArdAppPatrolpoint">
        update ard_app_patrolpoint
        <trim prefix="SET" suffixOverrides=",">
            <if test="patrolplanId != null">patrolplan_id = #{patrolplanId},</if>
            <if test="alarmpointsId != null">alarmpoints_id = #{alarmpointsId},</if>
            <if test="type != null">type = #{type},</if>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteArdAppPatrolpointById" parameterType="String">
        delete from ard_app_patrolpoint where patrolplan_id = #{id}
    </delete>
 
    <delete id="deleteArdAppPatrolpointByIds" parameterType="String">
        delete from ard_app_patrolpoint where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
 
    <insert id="insertArdAppPatrolpointList" parameterType="ArdAppPatrolpoint">
        insert into ard_app_patrolpoint (id,patrolplan_id,alarmpoints_id,type) values
        <foreach collection="ardAppPatrolpointList" separator="," item="ardAppPatrolpoint">
            (#{ardAppPatrolpoint.id},#{ardAppPatrolpoint.patrolplanId},
            #{ardAppPatrolpoint.alarmpointsId},#{ardAppPatrolpoint.type})
        </foreach>
    </insert>
    <delete id="deleteArdAppPatrolpointByPlanId" parameterType="String">
        delete from ard_app_patrolpoint aap where aap.patrolplan_id = #{id}
    </delete>
</mapper>