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
<?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.MjHnweEventMapper">
    
    <resultMap type="MjHnweEvent" id="MjHnweEventResult">
        <result property="id"    column="id"    />
        <result property="hid"    column="hid"    />
        <result property="cardHolderName"    column="card_holder_name"    />
        <result property="cardNo"    column="card_no"    />
        <result property="cnt"    column="cnt"    />
        <result property="commserverId"    column="commserver_id"    />
        <result property="deviceId"    column="device_id"    />
        <result property="eventId"    column="event_id"    />
        <result property="note"    column="note"    />
        <result property="prio"    column="prio"    />
        <result property="readerPoint"    column="reader_point"    />
        <result property="site"    column="site"    />
        <result property="status"    column="status"    />
        <result property="idx"    column="idx"    />
        <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="selectMjHnweEventVo">
        select id, hid, card_holder_name, card_no, cnt, commserver_id, device_id, event_id, note, prio, reader_point, site, status, idx, create_time, update_time, create_by, update_by, del_flag from mj_hnwe_event
    </sql>
 
    <select id="selectMjHnweEventList" parameterType="MjHnweEvent" resultMap="MjHnweEventResult">
        <include refid="selectMjHnweEventVo"/>
        <where>  
            <if test="hid != null  and hid != ''"> and hid = #{hid}</if>
            <if test="cardHolderName != null  and cardHolderName != ''"> and card_holder_name like concat('%', #{cardHolderName}, '%')</if>
            <if test="cardNo != null  and cardNo != ''"> and card_no = #{cardNo}</if>
            <if test="cnt != null  and cnt != ''"> and cnt = #{cnt}</if>
            <if test="commserverId != null  and commserverId != ''"> and commserver_id = #{commserverId}</if>
            <if test="deviceId != null  and deviceId != ''"> and device_id = #{deviceId}</if>
            <if test="eventId != null  and eventId != ''"> and event_id = #{eventId}</if>
            <if test="note != null  and note != ''"> and note = #{note}</if>
            <if test="prio != null  and prio != ''"> and prio = #{prio}</if>
            <if test="readerPoint != null  and readerPoint != ''"> and reader_point = #{readerPoint}</if>
            <if test="site != null  and site != ''"> and site like concat('%', #{site}, '%')</if>
            <if test="status != null  and status != ''"> and status = #{status}</if>
            <if test="idx != null  and idx != ''"> and idx = #{idx}</if>
        </where>
        order by create_time desc
    </select>
 
    <delete id="delete7days" parameterType="String">
        delete from mj_hnwe_event where create_time &lt; NOW() - INTERVAL 7 DAY
    </delete>
    
    <select id="selectMjHnweEventById" parameterType="String" resultMap="MjHnweEventResult">
        <include refid="selectMjHnweEventVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertMjHnweEvent" parameterType="MjHnweEvent">
        insert into mj_hnwe_event
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="hid != null">hid,</if>
            <if test="cardHolderName != null">card_holder_name,</if>
            <if test="cardNo != null">card_no,</if>
            <if test="cnt != null">cnt,</if>
            <if test="commserverId != null">commserver_id,</if>
            <if test="deviceId != null">device_id,</if>
            <if test="eventId != null">event_id,</if>
            <if test="note != null">note,</if>
            <if test="prio != null">prio,</if>
            <if test="readerPoint != null">reader_point,</if>
            <if test="site != null">site,</if>
            <if test="status != null">status,</if>
            <if test="idx != null">idx,</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="hid != null">#{hid},</if>
            <if test="cardHolderName != null">#{cardHolderName},</if>
            <if test="cardNo != null">#{cardNo},</if>
            <if test="cnt != null">#{cnt},</if>
            <if test="commserverId != null">#{commserverId},</if>
            <if test="deviceId != null">#{deviceId},</if>
            <if test="eventId != null">#{eventId},</if>
            <if test="note != null">#{note},</if>
            <if test="prio != null">#{prio},</if>
            <if test="readerPoint != null">#{readerPoint},</if>
            <if test="site != null">#{site},</if>
            <if test="status != null">#{status},</if>
            <if test="idx != null">#{idx},</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="updateMjHnweEvent" parameterType="MjHnweEvent">
        update mj_hnwe_event
        <trim prefix="SET" suffixOverrides=",">
            <if test="hid != null">hid = #{hid},</if>
            <if test="cardHolderName != null">card_holder_name = #{cardHolderName},</if>
            <if test="cardNo != null">card_no = #{cardNo},</if>
            <if test="cnt != null">cnt = #{cnt},</if>
            <if test="commserverId != null">commserver_id = #{commserverId},</if>
            <if test="deviceId != null">device_id = #{deviceId},</if>
            <if test="eventId != null">event_id = #{eventId},</if>
            <if test="note != null">note = #{note},</if>
            <if test="prio != null">prio = #{prio},</if>
            <if test="readerPoint != null">reader_point = #{readerPoint},</if>
            <if test="site != null">site = #{site},</if>
            <if test="status != null">status = #{status},</if>
            <if test="idx != null">idx = #{idx},</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="deleteMjHnweEventById" parameterType="String">
        delete from mj_hnwe_event where id = #{id}
    </delete>
 
    <delete id="deleteMjHnweEventByIds" parameterType="String">
        delete from mj_hnwe_event where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
 
</mapper>