MQpxxMapper.xml
9.28 KB
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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
<?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.hotent.lpg.manage.dao.MQpxxDao">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.hotent.lpg.common.model.WQpxx">
<id column="ID_" property="id" />
<result column="REF_ID_" property="refId" />
<result column="F_qpbh" property="fQpbh" />
<result column="F_ftbm" property="fFtbm" />
<result column="F_qpgg" property="fQpgg" />
<result column="F_czgg" property="fCzgg" />
<result column="F_czjz" property="fCzjz" />
<result column="F_zt" property="fZt" />
<result column="F_zzdw" property="fZzdw" />
<result column="F_xcjysj" property="fXcjysj" />
<result column="F_bfrq" property="fBfrq" />
<result column="F_cjr" property="fCjr" />
<result column="F_cjsj" property="fCjsj" />
<result column="F_gxr" property="fGxr" />
<result column="F_gxsj" property="fGxsj" />
<result column="F_ssqyID" property="fSsqyid" />
<result column="F_ssqymc" property="fSsqymc" />
<result column="F_ssczID" property="fSsczid" />
<result column="F_ssczmc" property="fSsczmc" />
<result column="F_hyyhID" property="fHyyhid" />
<result column="F_hyxm" property="fHyxm" />
<result column="F_qpgslx" property="fQpgslx" />
<result column="F_form_data_rev_" property="fFormDataRev" />
<result column="F_qptm" property="fQptm" />
<result column="F_zzrq" property="fZzrq" />
<result column="zhlzsj" property="zhlzsj" />
<result column="F_jd" property="fJd" />
<result column="F_wd" property="fWd" />
</resultMap>
<resultMap id="qpxxVoMap" type="com.hotent.lpg.manage.vo.QpxxVo">
<id column="ID_" property="id" />
<result column="REF_ID_" property="refId" />
<result column="F_qpbh" property="fQpbh" />
<result column="F_ftbm" property="fFtbm" />
<result column="F_qpgg" property="fQpgg" />
<result column="F_czgg" property="fCzgg" />
<result column="F_czjz" property="fCzjz" />
<result column="F_zt" property="fZt" />
<result column="F_zzdw" property="fZzdw" />
<result column="F_xcjysj" property="fXcjysj" />
<result column="F_bfrq" property="fBfrq" />
<result column="F_cjr" property="fCjr" />
<result column="F_cjsj" property="fCjsj" />
<result column="F_gxr" property="fGxr" />
<result column="F_gxsj" property="fGxsj" />
<result column="F_ssqyID" property="fSsqyid" />
<result column="F_ssqymc" property="fSsqymc" />
<result column="F_ssczID" property="fSsczid" />
<result column="F_ssczmc" property="fSsczmc" />
<result column="F_hyyhID" property="fHyyhid" />
<result column="F_hyxm" property="fHyxm" />
<result column="F_qpgslx" property="fQpgslx" />
<result column="F_form_data_rev_" property="fFormDataRev" />
<result column="F_qptm" property="fQptm" />
<result column="F_zzrq" property="fZzrq" />
<result column="F_qpzl" property="fZzrq" />
<result column="F_qpjz" property="fZzrq" />
<result column="F_qprj" property="fZzrq" />
<result column="F_ssyyl" property="fZzrq" />
<result column="F_gcgzyl" property="fZzrq" />
<result column="F_sjbh" property="fZzrq" />
<result column="F_ccbh" property="fZzrq" />
<result column="F_zybh" property="fZzrq" />
<result column="F_jchbh" property="fZzrq" />
<result column="F_sjrq" property="fZzrq" />
<result column="F_bcjyrq" property="fZzrq" />
<result column="F_sjsynx" property="fZzrq" />
<result column="F_jzrq" property="fZzrq" />
<result column="F_bz" property="fZzrq" />
<result column="F_qptp" property="fZzrq" />
<result column="fDsfurl" property="fDsfurl" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
ID_,
REF_ID_,
F_qpbh,
F_ftbm,
F_qpgg,
F_czgg,
F_czjz,
F_zt,
F_zzdw,
F_xcjysj,
F_bfrq,
F_cjr,
F_cjsj,
F_gxr,
F_gxsj,
F_ssqyID,
F_ssqymc,
F_ssczID,
F_ssczmc,
F_hyyhID,
F_hyxm,
F_qpgslx,
F_form_data_rev_,
F_qptm,
F_zzrq,
F_qpzl,
F_qpjz,
F_qprj,
F_ssyyl,
F_gcgzyl,
F_sjbh,
F_ccbh,
F_zybh,
F_jchbh,
F_sjrq,
F_bcjyrq,
F_sjsynx,
F_jzrq,
F_bz,
F_qptp,
F_dsfurl
</sql>
<select id="selectPage" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from
w_qpxx
${ew.customSqlSegment}
</select>
<select id="selectList" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from
w_qpxx
${ew.customSqlSegment}
</select>
<select id="selectById" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from
w_qpxx
where
ID_ = #{id}
</select>
<select id="qpMap" resultType="com.hotent.lpg.manage.vo.QpdtVo">
select
wq.id_ AS id,
wq.f_qptm AS fQptm,
wq.F_qpgslx AS fQpgslx,
wq.F_ssqyID AS fSsqyID,
wq.f_ssczid AS fSsczid,
wq.F_ssqymc AS fSsqymc,
wq.F_ssczmc AS fSsczmc,
wq2.F_cyzlx AS fCyzlx,
wq2.F_cyyhID AS fCyyhID,
wq2.F_cyczID AS fCyczID,
wq2.F_jd AS fJd,
wq2.F_wd AS fWd,
concat (F_dqsf,F_dqs,F_dqq,F_dqjd,F_dqxxdz) as fDz,
wc.F_czmc as fXzczmc,
wq2.F_qplzID as fQplzId
from w_qpxx wq
inner join w_qpssxx wq2 on wq.ID_ = wq2.F_qpID
left join w_czxx wc on wc.ID_ = wq2.F_cyczID and wq2.F_cyzlx = '厂站'
<where>
<if test="qyId != null and qyId != ''">
and wq.F_ssqyID = #{qyId}
</if>
<if test="qzId != null and qzId != ''">
and wq.F_ssczID = #{qzId}
</if>
</where>
</select>
<select id="qzqpxxPage" resultMap='BaseResultMap'>
select
w_qpxx.*,
w_qpssxx.F_gxsj as zhlzsj
from w_qpxx w_qpxx
left join w_qpssxx w_qpssxx on w_qpxx.id_ = w_qpssxx.F_qpID
<where>
w_qpxx.F_ssczID = #{qzId}
<if test="lx == 'wrk'.toString()">
and (w_qpssxx.F_cyzlx != '厂站' or (w_qpssxx.F_cyzlx = '厂站' and w_qpssxx.F_cyczID != #{qzId}))
</if>
<if test="lx == 'mp'.toString()">
and w_qpssxx.F_ctzt = '满瓶'
</if>
<if test="lx == 'kp'.toString()">
and w_qpssxx.F_ctzt = '空瓶'
</if>
<if test="lx == 'gqp'.toString()">
and w_qpxx.F_zt = '已报废'
</if>
</where>
order by w_qpssxx.F_gxsj desc
</select>
<select id="listScrapQp" resultMap="BaseResultMap">
SELECT
*
FROM
w_qpxx w_qpxx
WHERE
DATE_FORMAT( w_qpxx.F_bfrq, '%Y-%m-%d' ) <= DATE_SUB( CURDATE(), INTERVAL 1 DAY )
AND w_qpxx.F_zt != '报废'
</select>
<update id="overdueInspection">
UPDATE w_qpxx
SET f_zt = '超期未检'
WHERE
f_zt = '正常'
AND DATE_FORMAT( w_qpxx.F_xcjysj, '%Y-%m-%d' ) <= DATE_SUB( CURDATE(), INTERVAL 1 DAY )
</update>
<select id="bottleNumber" resultType="java.lang.Integer">
select count(*) from w_qpxx where F_ssczID = #{czId}
<if test="type != null and type != ''">
<if test="type == '1'.toString()">
and year(F_sjrq) = year(SYSDATE())
</if>
</if>
</select>
<select id="bottleTrackByCzId" resultType="java.util.HashMap">
SELECT
CONCAT( '【气瓶#', w_qpxx.F_qptm, '】' ) AS field1,
CASE
WHEN w_qpssxx.F_cyzlx = '厂站' THEN
CONCAT( '当前位于', w_czxx.f_czmc, '扫码' )
WHEN w_qpssxx.F_cyzlx = '员工' THEN
CONCAT( '当前位于', w_czxx.f_czmc, '扫码' )
WHEN w_qpssxx.F_cyzlx = '会员' THEN
CONCAT( '当前位于用户', w_hyxx.F_xm, '扫码' )
END AS field2,
DATE_FORMAT(w_qpssxx.F_gxsj,'%Y年%m月%d日%H:%m:%s') AS field3
FROM
w_qpxx
INNER JOIN w_qpssxx ON w_qpxx.id_ = w_qpssxx.F_qpID
LEFT JOIN w_czxx ON w_qpssxx.F_cyczID = w_czxx.ID_
LEFT JOIN w_hyxx ON w_hyxx.F_userID = w_qpssxx.F_cyyhID
where w_qpxx.F_ssczID = #{czId}
</select>
<select id="listByCzId" resultMap="BaseResultMap">
select
w_qpxx.*,
w_qpssxx.F_jd,
w_qpssxx.F_wd
from w_qpxx
inner join w_qpssxx ON w_qpxx.id_ = w_qpssxx.F_qpID
where w_qpxx.F_ssczID = #{czId}
</select>
</mapper>