wang-hao-jie
2022-08-25 57dcc73636bb7d8dce89c808eb8cc988a7512264
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
<?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.station.mapper.MjDoorControlMapper">
    
    <resultMap type="MjDoorControl" id="MjDoorControlResult">
        <result property="id"    column="id"    />
        <result property="doorControlName"    column="door_control_name"    />
        <result property="areaId"    column="area_id"    />
        <result property="areaName"    column="area_name"    />
        <result property="doorId"    column="door_id"    />
        <result property="doorName"    column="door_name"    />
        <result property="readheadId"    column="readHead_id"    />
        <result property="readheadName"    column="readHead_name"    />
        <result property="brand"    column="brand"    />
        <result property="model"    column="model"    />
        <result property="ip"    column="ip"    />
        <result property="port"    column="port"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateTime"    column="update_time"    />
        <result property="createBy"    column="create_by"    />
        <result property="updateBy"    column="update_by"    />
        <result property="delFlag"    column="del_flag"    />
    </resultMap>
 
    <sql id="selectMjDoorControlVo">
        select id, door_control_name, area_id, area_name, door_id, door_name, readHead_id, readHead_name, brand, model, ip, port, create_time, update_time, create_by, update_by, del_flag from mj_door_control
    </sql>
 
    <select id="selectMjDoorControlList" parameterType="MjDoorControl" resultMap="MjDoorControlResult">
        <include refid="selectMjDoorControlVo"/>
        <where>
            <if test="doorControlName != null  and doorControlName != ''"> and door_control_name like concat('%', #{doorControlName}, '%')</if>
            <if test="areaName != null  and areaName != ''"> and area_name like concat('%', #{areaName}, '%')</if>
            <if test="doorName != null  and doorName != ''"> and door_name like concat('%', #{doorName}, '%')</if>
            <if test="readheadName != null  and readheadName != ''"> and readHead_name like concat('%', #{readheadName}, '%')</if>
            <if test="brand != null  and brand != ''"> and brand like concat('%', #{brand}, '%')</if>
            <if test="model != null  and model != ''"> and model like concat('%', #{model}, '%')</if>
        </where>
    </select>
    
    <select id="selectMjDoorControlById" parameterType="String" resultMap="MjDoorControlResult">
        <include refid="selectMjDoorControlVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertMjDoorControl" parameterType="MjDoorControl">
        insert into mj_door_control
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="doorControlName != null">door_control_name,</if>
            <if test="areaId != null">area_id,</if>
            <if test="areaName != null">area_name,</if>
            <if test="doorId != null">door_id,</if>
            <if test="doorName != null">door_name,</if>
            <if test="readheadId != null">readHead_id,</if>
            <if test="readheadName != null">readHead_name,</if>
            <if test="brand != null">brand,</if>
            <if test="model != null">model,</if>
            <if test="ip != null">ip,</if>
            <if test="port != null">port,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="createBy != null">create_by,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="delFlag != null">del_flag,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="doorControlName != null">#{doorControlName},</if>
            <if test="areaId != null">#{areaId},</if>
            <if test="areaName != null">#{areaName},</if>
            <if test="doorId != null">#{doorId},</if>
            <if test="doorName != null">#{doorName},</if>
            <if test="readheadId != null">#{readheadId},</if>
            <if test="readheadName != null">#{readheadName},</if>
            <if test="brand != null">#{brand},</if>
            <if test="model != null">#{model},</if>
            <if test="ip != null">#{ip},</if>
            <if test="port != null">#{port},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="delFlag != null">#{delFlag},</if>
         </trim>
    </insert>
 
    <update id="updateMjDoorControl" parameterType="MjDoorControl">
        update mj_door_control
        <trim prefix="SET" suffixOverrides=",">
            <if test="doorControlName != null">door_control_name = #{doorControlName},</if>
            <if test="areaId != null">area_id = #{areaId},</if>
            <if test="areaName != null">area_name = #{areaName},</if>
            <if test="doorId != null">door_id = #{doorId},</if>
            <if test="doorName != null">door_name = #{doorName},</if>
            <if test="readheadId != null">readHead_id = #{readheadId},</if>
            <if test="readheadName != null">readHead_name = #{readheadName},</if>
            <if test="brand != null">brand = #{brand},</if>
            <if test="model != null">model = #{model},</if>
            <if test="ip != null">ip = #{ip},</if>
            <if test="port != null">port = #{port},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="delFlag != null">del_flag = #{delFlag},</if>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteMjDoorControlById" parameterType="String">
        delete from mj_door_control where id = #{id}
    </delete>
 
    <delete id="deleteMjDoorControlByIds" parameterType="String">
        delete from mj_door_control where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
 
    <select id="countSum"  resultType="java.lang.Integer" parameterType="int">
        SELECT COUNT(*) FROM mj_door_control
        where del_flag=0
    </select>
</mapper>