wujianwei
4 天以前 b23d80cdbc375643e6a94122c6507fca79e18103
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
203
204
205
206
207
<?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.cwgl.mapper.SmartLockerApplicationMapper">
 
    <resultMap type="com.ruoyi.cwgl.domain.SmartLockerApplication" id="SmartLockerApplicationResult">
        <result property="id"    column="id"    />
        <result property="commandType"    column="command_type"    />
        <result property="applicantCode"    column="applicant_code"    />
        <result property="applicantName"    column="applicant_name"    />
        <result property="itemType"    column="item_type"    />
        <result property="itemName"    column="item_name"    />
        <result property="lockerNo"    column="locker_no"    />
        <result property="lockerPort"    column="locker_port"    />
        <result property="status"    column="status"    />
        <result property="cancelTime"    column="cancel_time"    />
        <result property="receiveTime"    column="receive_time"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateTime"    column="update_time"    />
        <result property="remark"    column="remark"    />
        <result property="createBy"    column="create_by"    />
        <result property="updateBy"    column="update_by"    />
        <result property="deleted"    column="deleted"    />
        <result property="deadlineTime"    column="deadline_time"    />
    </resultMap>
 
    <sql id="selectSmartLockerApplicationVo">
        select thisTab.id, thisTab.command_type, thisTab.applicant_code, thisTab.applicant_name, thisTab.item_type, thisTab.item_name, thisTab.locker_no, thisTab.locker_port, thisTab.status, thisTab.cancel_time, thisTab.receive_time, thisTab.create_time, thisTab.update_time, thisTab.remark, thisTab.create_by, thisTab.update_by, thisTab.deleted, thisTab.deadline_time from smart_locker_application AS thisTab
    </sql>
    <sql id="selectSmartLockerApplicationVoCount">
        select count(0) from smart_locker_application as thisTab
    </sql>
 
    <sql id="whereCondition">
        <if test="commandType != null "> and thisTab.command_type = #{commandType}</if>
        <if test="applicantCode != null  and applicantCode != ''"> and thisTab.applicant_code = #{applicantCode}</if>
        <if test="applicantName != null  and applicantName != ''"> and  thisTab.applicant_name like concat('%', #{applicantName}, '%')</if>
        <if test="itemType != null "> and thisTab.item_type = #{itemType}</if>
        <if test="itemName != null  and itemName != ''"> and  thisTab.item_name like concat('%', #{itemName}, '%')</if>
        <if test="lockerNo != null  and lockerNo != ''"> and thisTab.locker_no = #{lockerNo}</if>
        <if test="lockerPort != null "> and thisTab.locker_port = #{lockerPort}</if>
        <if test="status != null "> and thisTab.status = #{status}</if>
        <if test="cancelTime != null "> and thisTab.cancel_time = #{cancelTime}</if>
        <if test="receiveTime != null "> and thisTab.receive_time = #{receiveTime}</if>
        <if test="deleted != null "> and thisTab.deleted = #{deleted}</if>
    </sql>
 
    <!--查询-->
    <select id="selectSmartLockerApplicationById" parameterType="Integer" resultMap="SmartLockerApplicationResult">
        <include refid="selectSmartLockerApplicationVo"/>
        where id = #{id}
    </select>
 
    <select id="selectSmartLockerApplicationCount" parameterType="com.ruoyi.cwgl.domain.SmartLockerApplication" resultType="int">
        <include refid="selectSmartLockerApplicationVoCount"/>
        <where>
            <include refid="whereCondition"/>
        </where>
    </select>
 
    <select id="selectSmartLockerApplicationList" parameterType="com.ruoyi.cwgl.domain.SmartLockerApplication" resultMap="SmartLockerApplicationResult">
        <include refid="selectSmartLockerApplicationVo"/>
        <where>
            <include refid="whereCondition"/>
        </where>
        order by thisTab.id desc
    </select>
    <select id="selectSmartLockerApplication" resultMap="SmartLockerApplicationResult">
        <include refid="selectSmartLockerApplicationVo"/>
 
        where applicant_name = #{driverName}
        and applicant_code = #{driverCode}
        and status = 0
        limit 1
    </select>
    <select id="selectCwByLicensePlateNumber" resultType="java.lang.Integer">
 
        SELECT `NAME` from tms_vehicle WHERE LICENSE_PLATE_NUMBER = #{licensePlateNumber} and BE_DELETE =0 order by id asc LIMIT 1
    </select>
 
    <!-- 新增 -->
    <insert id="insertSmartLockerApplication" parameterType="com.ruoyi.cwgl.domain.SmartLockerApplication"  useGeneratedKeys="true" keyProperty="id">
        insert into smart_locker_application
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="commandType != null">command_type,</if>
            <if test="applicantCode != null and applicantCode != ''">applicant_code,</if>
            <if test="applicantName != null and applicantName != ''">applicant_name,</if>
            <if test="itemType != null">item_type,</if>
            <if test="itemName != null and itemName != ''">item_name,</if>
            <if test="lockerNo != null">locker_no,</if>
            <if test="lockerPort != null">locker_port,</if>
            <if test="status != null">status,</if>
            <if test="cancelTime != null">cancel_time,</if>
            <if test="receiveTime != null">receive_time,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="remark != null">remark,</if>
            <if test="createBy != null">create_by,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="deleted != null">deleted,</if>
            <if test="deadlineTime != null">deadline_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="commandType != null">#{commandType},</if>
            <if test="applicantCode != null and applicantCode != ''">#{applicantCode},</if>
            <if test="applicantName != null and applicantName != ''">#{applicantName},</if>
            <if test="itemType != null">#{itemType},</if>
            <if test="itemName != null and itemName != ''">#{itemName},</if>
            <if test="lockerNo != null">#{lockerNo},</if>
            <if test="lockerPort != null">#{lockerPort},</if>
            <if test="status != null">#{status},</if>
            <if test="cancelTime != null">#{cancelTime},</if>
            <if test="receiveTime != null">#{receiveTime},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="remark != null">#{remark},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="deleted != null">#{deleted},</if>
            <if test="deadlineTime != null">#{deadlineTime},</if>
         </trim>
    </insert>
 
    <insert id="insertSmartLockerApplicationBatch" parameterType="java.util.List"  useGeneratedKeys="true" keyProperty="id">
        insert into smart_locker_application
        <trim prefix="(" suffix=") values" suffixOverrides=",">
            id,command_type,applicant_code,applicant_name,item_type,item_name,locker_no,locker_port,status,cancel_time,receive_time,create_time,update_time,remark,create_by,update_by,deleted,deadline_time,
        </trim>
        <foreach item="item" index="index" collection="list" separator=",">
            <trim prefix="(" suffix=") " suffixOverrides=",">
                #{item.id},#{item.commandType},#{item.applicantCode},#{item.applicantName},#{item.itemType},#{item.itemName},#{item.lockerNo},#{item.lockerPort},#{item.status},#{item.cancelTime},#{item.receiveTime},#{item.createTime},#{item.updateTime},#{item.remark},#{item.createBy},#{item.updateBy},#{item.deleted},#{item.deadlineTime},
            </trim>
        </foreach>
    </insert>
 
    <!-- 修改 -->
    <update id="updateSmartLockerApplication" parameterType="com.ruoyi.cwgl.domain.SmartLockerApplication">
        update smart_locker_application
        <trim prefix="SET" suffixOverrides=",">
            <if test="commandType != null">command_type = #{commandType},</if>
            <if test="applicantCode != null and applicantCode != ''">applicant_code = #{applicantCode},</if>
            <if test="applicantName != null and applicantName != ''">applicant_name = #{applicantName},</if>
            <if test="itemType != null">item_type = #{itemType},</if>
            <if test="itemName != null and itemName != ''">item_name = #{itemName},</if>
            <if test="lockerNo != null">locker_no = #{lockerNo},</if>
            <if test="lockerPort != null">locker_port = #{lockerPort},</if>
            <if test="status != null">status = #{status},</if>
            <if test="cancelTime != null">cancel_time = #{cancelTime},</if>
            <if test="receiveTime != null">receive_time = #{receiveTime},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="remark != null">remark = #{remark},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="deleted != null">deleted = #{deleted},</if>
            <if test="deadlineTime != null">deadline_time = #{deadlineTime},</if>
        </trim>
        where id = #{id}
    </update>
    <!-- 修改 -->
    <update id="updateSmartLockerApplicationBatch" parameterType="java.util.List">
        <foreach collection="list" item="item" index="index" separator=";">
            update smart_locker_application
            <trim prefix="SET" suffixOverrides=",">
                <if test="item.commandType != null">command_type = #{item.commandType},</if>
                <if test="item.applicantCode != null and item.applicantCode != ''">applicant_code = #{item.applicantCode},</if>
                <if test="item.applicantName != null and item.applicantName != ''">applicant_name = #{item.applicantName},</if>
                <if test="item.itemType != null">item_type = #{item.itemType},</if>
                <if test="item.itemName != null and item.itemName != ''">item_name = #{item.itemName},</if>
                <if test="item.lockerNo != null">locker_no = #{item.lockerNo},</if>
                <if test="item.lockerPort != null">locker_port = #{item.lockerPort},</if>
                <if test="item.status != null">status = #{item.status},</if>
                <if test="item.cancelTime != null">cancel_time = #{item.cancelTime},</if>
                <if test="item.receiveTime != null">receive_time = #{item.receiveTime},</if>
                <if test="item.createTime != null">create_time = #{item.createTime},</if>
                <if test="item.updateTime != null">update_time = #{item.updateTime},</if>
                <if test="item.remark != null">remark = #{item.remark},</if>
                <if test="item.createBy != null">create_by = #{item.createBy},</if>
                <if test="item.updateBy != null">update_by = #{item.updateBy},</if>
                <if test="item.deleted != null">deleted = #{item.deleted},</if>
                <if test="item.deadlineTime != null">deadline_time = #{item.deadlineTime},</if>
            </trim>
        where id = #{item.id}
        </foreach>
    </update>
    <update id="updateExpiredStatus">
 
        UPDATE smart_locker_application
        SET status = 3, update_time = NOW()
        WHERE status = 0
        AND deadline_time &lt;  NOW()
 
    </update>
 
    <!--删除-->
    <delete id="deleteSmartLockerApplicationById" parameterType="Integer">
        delete from smart_locker_application where id = #{id}
    </delete>
    <delete id="deleteSmartLockerApplicationByIds" parameterType="Integer">
        delete from smart_locker_application where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
 
</mapper>