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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
<?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.MjDoorMapper">
    
    <resultMap type="MjDoor" id="MjDoorResult">
        <result property="id"    column="id"    />
        <result property="doorName"    column="door_name"    />
        <result property="areaId"    column="area__id"    />
        <result property="areaName"    column="area_name"    />
        <result property="organizationName"    column="organization_name"    />
        <result property="organizationId"    column="organization_id"    />
        <result property="brand"    column="brand"    />
        <result property="model"    column="model"    />
        <result property="doorDescription"    column="door_description"    />
        <result property="doorBeforeId"    column="door_before_id"    />
        <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"    />
        <result property="expandStatus"    column="expand_status"    />
        <result property="expandStatus1"    column="expand_status1"    />
        <result property="hnweId"    column="hnwe_id"    />
        <result property="hnweIp"    column="hnwe_ip"    />
        <result property="hid1"    column="hid1"    />
        <result property="hid2"    column="hid2"    />
        <result property="hid3"    column="hid3"    />
        <result property="hid4"    column="hid4"    />
        <result property="hid5"    column="hid5"    />
        <result property="hid6"    column="hid6"    />
        <result property="hid7"    column="hid7"    />
        <result property="hid8"    column="hid8"    />
    </resultMap>
 
    <sql id="selectMjDoorVo">
        select id, door_name, area__id, area_name, organization_name, organization_id, brand, model, door_description, door_before_id, create_time, update_time, create_by, update_by, del_flag, expand_status, expand_status1,hnwe_id,hnwe_ip,hid1,hid2,hid3,hid4,hid5,hid6,hid7,hid8 from mj_door
    </sql>
 
    <select id="selectMjDoorList" parameterType="MjDoor" resultMap="MjDoorResult">
        <include refid="selectMjDoorVo"/>
        <where>
          del_flag = 0
            <if test="doorName != null  and doorName != ''"> and door_name like concat('%', #{doorName}, '%')</if>
            <if test="areaId != null  and areaId != ''"> and area__id = #{areaId}</if>
            <if test="areaName != null  and areaName != ''"> and area_name like concat('%', #{areaName}, '%')</if>
            <if test="organizationName != null  and organizationName != ''"> and organization_name like concat('%', #{organizationName}, '%')</if>
            <if test="organizationId != null  and organizationId != ''"> and organization_id = #{organizationId}</if>
            <if test="brand != null  and brand != ''"> and brand = #{brand}</if>
            <if test="model != null  and model != ''"> and model = #{model}</if>
            <if test="doorDescription != null  and doorDescription != ''"> and door_description = #{doorDescription}</if>
            <if test="doorBeforeId != null  and doorBeforeId != ''"> and door_before_id = #{doorBeforeId}</if>
            <if test="expandStatus != null "> and expand_status = #{expandStatus}</if>
            <if test="expandStatus1 != null "> and expand_status1 = #{expandStatus1}</if>
            <if test="hnweIp != null "> and hnwe_ip = #{hnweIp}</if>
            <if test="hnweId != null "> and hnwe_id = #{hnweId}</if>
            <if test="hid1 != null "> and hid1 = #{hid1}</if>
            <if test="hid2 != null "> and hid2 = #{hid2}</if>
            <if test="hid3 != null "> and hid3 = #{hid3}</if>
            <if test="hid4 != null "> and hid4 = #{hid4}</if>
            <if test="hid5 != null "> and hid5 = #{hid5}</if>
            <if test="hid6 != null "> and hid6 = #{hid6}</if>
            <if test="hid7 != null "> and hid7 = #{hid7}</if>
            <if test="hid8 != null "> and hid8 = #{hid8}</if>
 
        </where>
        order by create_time desc
    </select>
    
    <select id="selectMjDoorById" parameterType="String" resultMap="MjDoorResult">
        <include refid="selectMjDoorVo"/>
        where id = #{id}
    </select>
    <select id="selectMjDoorListByAreaId" resultMap="MjDoorResult">
        <include refid="selectMjDoorVo"/>
        where area__id = #{areaId} and del_flag='0'
    </select>
 
    <insert id="insertMjDoor" parameterType="MjDoor">
        insert into mj_door
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="doorName != null">door_name,</if>
            <if test="areaId != null">area__id,</if>
            <if test="areaName != null">area_name,</if>
            <if test="organizationName != null">organization_name,</if>
            <if test="organizationId != null">organization_id,</if>
            <if test="brand != null">brand,</if>
            <if test="model != null">model,</if>
            <if test="doorDescription != null">door_description,</if>
            <if test="doorBeforeId != null">door_before_id,</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>
            <if test="expandStatus != null">expand_status,</if>
            <if test="expandStatus1 != null">expand_status1,</if>
            <if test="hnweIp != null">hnwe_ip,</if>
            <if test="hnweId != null">hnwe_id,</if>
            <if test="hid1 != null">hid1,</if>
            <if test="hid2 != null">hid2,</if>
            <if test="hid3 != null">hid3,</if>
            <if test="hid4 != null">hid4,</if>
            <if test="hid5 != null">hid5,</if>
            <if test="hid6 != null">hid6,</if>
            <if test="hid7 != null">hid7,</if>
            <if test="hid8 != null">hid8,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="doorName != null">#{doorName},</if>
            <if test="areaId != null">#{areaId},</if>
            <if test="areaName != null">#{areaName},</if>
            <if test="organizationName != null">#{organizationName},</if>
            <if test="organizationId != null">#{organizationId},</if>
            <if test="brand != null">#{brand},</if>
            <if test="model != null">#{model},</if>
            <if test="doorDescription != null">#{doorDescription},</if>
            <if test="doorBeforeId != null">#{doorBeforeId},</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>
            <if test="expandStatus != null">#{expandStatus},</if>
            <if test="expandStatus1 != null">#{expandStatus1},</if>
            <if test="hnweIp != null">#{hnweIp},</if>
            <if test="hnweId != null">#{hnweId},</if>
            <if test="hid1 != null">#{hid1},</if>
            <if test="hid2 != null">#{hid2},</if>
            <if test="hid3 != null">#{hid3},</if>
            <if test="hid4 != null">#{hid4},</if>
            <if test="hid5 != null">#{hid5},</if>
            <if test="hid6 != null">#{hid6},</if>
            <if test="hid7 != null">#{hid7},</if>
            <if test="hid8 != null">#{hid8},</if>
         </trim>
    </insert>
 
    <update id="updateMjDoor" parameterType="MjDoor">
        update mj_door
        <trim prefix="SET" suffixOverrides=",">
            <if test="doorName != null">door_name = #{doorName},</if>
            <if test="areaId != null">area__id = #{areaId},</if>
            <if test="areaName != null">area_name = #{areaName},</if>
            <if test="organizationName != null">organization_name = #{organizationName},</if>
            <if test="organizationId != null">organization_id = #{organizationId},</if>
            <if test="brand != null">brand = #{brand},</if>
            <if test="model != null">model = #{model},</if>
            <if test="doorDescription != null">door_description = #{doorDescription},</if>
            <if test="doorBeforeId != null">door_before_id = #{doorBeforeId},</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>
            <if test="expandStatus != null">expand_status = #{expandStatus},</if>
            <if test="expandStatus1 != null">expand_status1 = #{expandStatus1},</if>
            <if test="hnweIp != null">hnwe_ip = #{hnweIp},</if>
            <if test="hnweId != null">hnwe_id = #{hnweId},</if>
            <if test="hid1 != null">hid1 = #{hid1},</if>
            <if test="hid2 != null">hid2 = #{hid2},</if>
            <if test="hid3 != null">hid3 = #{hid3},</if>
            <if test="hid4 != null">hid4 = #{hid4},</if>
            <if test="hid5 != null">hid5 = #{hid5},</if>
            <if test="hid6 != null">hid6 = #{hid6},</if>
            <if test="hid7 != null">hid7 = #{hid7},</if>
            <if test="hid8 != null">hid8 = #{hid8},</if>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteMjDoorById" parameterType="String">
        delete from mj_door where id = #{id}
    </delete>
 
    <delete id="deleteMjDoorByIds" parameterType="String">
        delete from mj_door where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
 
    <select id="selectDoorListByAreaId" parameterType="String" resultType="com.ruoyi.station.model.AreaDoorModel">
        select id id, door_name title from mj_door
        <where>
            <if test="areaId != null  and areaId != ''"> and area__id = #{areaId}</if>
        </where>
    </select>
 
    <select id="countSum"  resultType="java.lang.Integer" parameterType="int">
        SELECT COUNT(*) FROM mj_door
        where del_flag=0
    </select>
 
    <select id="selectMjDoorByHid" parameterType="String" resultMap="MjDoorResult">
        <include refid="selectMjDoorVo"/>
        where hnwe_id = #{hid} or hid1 = #{hid} or hid2 = #{hid} or hid3 = #{hid} or hid4 = #{hid} or hid5 = #{hid} or hid6 = #{hid} or hid7 = #{hid} or hid8 = #{hid}
    </select>
</mapper>