TdGGuideScreenSMapper.xml
13.2 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
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
<?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.zteits.park.mapper.smapper.TdGGuideScreenSMapper">
<resultMap id="BaseResultMap" type="com.zteits.park.domain.TdGGuideScreen">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="guide_no" jdbcType="VARCHAR" property="guideNo" />
<result column="guide_name" jdbcType="VARCHAR" property="guideName" />
<result column="guide_type" jdbcType="INTEGER" property="guideType" />
<result column="province_id" jdbcType="BIGINT" property="provinceId" />
<result column="province_name" jdbcType="VARCHAR" property="provinceName" />
<result column="city_id" jdbcType="BIGINT" property="cityId" />
<result column="city_name" jdbcType="VARCHAR" property="cityName" />
<result column="country_id" jdbcType="BIGINT" property="countryId" />
<result column="country_name" jdbcType="VARCHAR" property="countryName" />
<result column="pl_no" jdbcType="VARCHAR" property="plNo" />
<result column="pl_name" jdbcType="VARCHAR" property="plName" />
<result column="parking_num" jdbcType="INTEGER" property="parkingNum" />
<result column="address" jdbcType="VARCHAR" property="address" />
<result column="lon_id" jdbcType="DECIMAL" property="lonId" />
<result column="lat_id" jdbcType="DECIMAL" property="latId" />
<result column="level" jdbcType="INTEGER" property="level" />
<result column="eqp_code" jdbcType="VARCHAR" property="eqpCode" />
<result column="eqp_ip" jdbcType="VARCHAR" property="eqpIp" />
<result column="eqp_imei" jdbcType="VARCHAR" property="eqpImei" />
<result column="eqp_port" jdbcType="VARCHAR" property="eqpPort" />
<result column="echo_type" jdbcType="INTEGER" property="echoType" />
<result column="light_band_ip" jdbcType="VARCHAR" property="lightBandIp" />
<result column="picture_path" jdbcType="VARCHAR" property="picturePath" />
<result column="data_status" jdbcType="INTEGER" property="dataStatus" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="create_op" jdbcType="BIGINT" property="createOp" />
<result column="modify_time" jdbcType="TIMESTAMP" property="modifyTime" />
<result column="install_date" jdbcType="TIMESTAMP" property="installDate" />
<result column="modify_op" jdbcType="VARCHAR" property="modifyOp" />
<result column="last_update_date" jdbcType="TIMESTAMP" property="lastUpdateDate" />
<result column="org_id" jdbcType="BIGINT" property="orgId" />
<result column="led_device_status" jdbcType="INTEGER" property="ledDeviceStatus" />
<result column="led_screen_status" jdbcType="INTEGER" property="ledScreenStatus" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, guide_no, guide_name, guide_type, province_id, province_name, city_id, city_name,
country_id, country_name, pl_no, pl_name, parking_num, address, lon_id, lat_id, level,
eqp_code, eqp_ip, eqp_imei, eqp_port, echo_type, light_band_ip, picture_path, data_status,
create_time, create_op, modify_time, install_date, modify_op, last_update_date, org_id,
led_device_status, led_screen_status
</sql>
<select id="listGuideScreenByAreaCodes" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM td_g_guide_screen
<where>
1=1
<if test="queryStr !=null and queryStr !=''">
AND (address LIKE CONCAT('%',#{queryStr},'%') OR guide_name LIKE CONCAT('%',#{queryStr},'%'))
</if>
<if test="nameOrNo !=null and nameOrNo !=''">
AND (guide_no LIKE CONCAT('%',#{nameOrNo},'%') OR guide_name LIKE CONCAT('%',#{nameOrNo},'%'))
</if>
<if test="guideName !=null and guideName !=''">
AND guide_name LIKE CONCAT('%',#{guideName},'%')
</if>
<if test="guideNo !=null and guideNo !=''">
AND guide_no LIKE CONCAT('%',#{guideNo},'%')
</if>
<if test="dataState !=null">
AND data_status = #{dataState}
</if>
<if test="ledDeviceStatus !=null">
AND led_device_status = #{ledDeviceStatus}
</if>
<if test="ledScreenStatus !=null">
AND led_screen_status = #{ledScreenStatus}
</if>
<if test="orgId !=null">
AND org_id = #{orgId}
</if>
<if test="areaCodes !=null and areaCodes.size>0">
AND country_id IN
<foreach collection="areaCodes" item="code" separator="," open="(" close=")" index="index">
#{code}
</foreach>
</if>
<if test="levels !=null and levels.size>0">
AND level IN
<foreach collection="levels" item="level" separator="," open="(" close=")" index="index">
#{level}
</foreach>
</if>
<if test="modifyTimeBegin !=null and modifyTimeEnd != null ">
AND (last_update_date between #{modifyTimeBegin} and #{modifyTimeEnd})
AND (led_device_status = 2 OR led_screen_status = 2)
</if>
</where>
</select>
<select id="statisticsGuideScreenLevelByAreaCodes" resultType="com.zteits.park.domain.GuideScreenLevelStatistics">
SELECT level,count(level) as num FROM td_g_guide_screen
<where>
1=1
<if test="dataState !=null">
AND data_status = #{dataState}
</if>
<if test="cityId !=null">
AND city_id = #{cityId}
</if>
<if test="areaCodes !=null and areaCodes.size>0">
AND country_id IN
<foreach collection="areaCodes" item="code" separator="," open="(" close=")" index="index">
#{code}
</foreach>
</if>
<if test="orgId !=null">
AND org_id = #{orgId}
</if>
</where>
GROUP BY level ORDER BY level;
</select>
<select id="listGuideScreenGeo" resultType="com.zteits.park.domain.GuideScreenGeo"
parameterType="com.zteits.clouds.api.dto.park.param.GuideScreenListGeoRequest">
SELECT
id,
guide_name as guideName,
guide_no as guideNo,
guide_type as guideType,
level,
lon_id as lonId,
lat_id as latId,
eqp_ip as eqpIp,
eqp_imei as eqpImei,
eqp_port as eqpPort,
led_screen_status as ledScreenStatus,
led_device_status ledDeviceStatus
FROM td_g_guide_screen
<where>
1=1
<if test="dataState !=null">
AND data_status = #{dataState}
</if>
<if test="areaCodes !=null and areaCodes.size>0">
AND country_id IN
<foreach collection="areaCodes" item="code" separator="," open="(" close=")" index="index">
#{code}
</foreach>
</if>
<if test="levels !=null and levels.size>0">
AND level IN
<foreach collection="levels" item="level" separator="," open="(" close=")" index="index">
#{level}
</foreach>
</if>
AND pl_no IN
<foreach collection="plNos" item="parkNo" separator="," open="(" close=")" index="index">
#{parkNo}
</foreach>
<if test="orgId !=null">
AND org_id = #{orgId}
</if>
<if test="guideName !=null and guideName !=''">
AND guide_name LIKE CONCAT('%',#{guideName},'%')
</if>
<if test="ledDeviceStatus !=null">
AND led_device_status = #{ledDeviceStatus}
</if>
</where>
</select>
<select id="getBaseGuideScreenInfo" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM td_g_guide_screen
<where>
guide_no = #{guideNo}
<if test="dataState !=null">
AND data_status = #{dataState}
</if>
</where>
</select>
<insert id="bathInsertGuideScreens" parameterType="java.util.List">
insert into td_g_guide_screen (guide_no, guide_name, guide_type,
province_id, province_name, city_id,
city_name, country_id, country_name,
address, lon_id, lat_id,
level, eqp_code, eqp_ip,
eqp_imei, eqp_port, echo_type,
light_band_ip, parking_num, picture_path,
data_status, create_time, create_op,
modify_time, install_date,
modify_op, last_update_date, org_id, led_device_status, led_screen_status
)
values
<foreach collection="tdGGuideScreens" index="index" item="item" separator=",">
(#{item.guideNo,jdbcType=VARCHAR}, #{item.guideName,jdbcType=VARCHAR}, #{item.guideType,jdbcType=INTEGER},
#{item.provinceId,jdbcType=BIGINT}, #{item.provinceName,jdbcType=VARCHAR}, #{item.cityId,jdbcType=BIGINT},
#{item.cityName,jdbcType=VARCHAR}, #{item.countryId,jdbcType=BIGINT}, #{item.countryName,jdbcType=VARCHAR},
#{item.address,jdbcType=VARCHAR}, #{item.lonId,jdbcType=DECIMAL}, #{item.latId,jdbcType=DECIMAL},
#{item.level,jdbcType=INTEGER}, #{item.eqpCode,jdbcType=VARCHAR}, #{item.eqpIp,jdbcType=VARCHAR},
#{item.eqpImei,jdbcType=VARCHAR}, #{item.eqpPort,jdbcType=VARCHAR}, #{item.echoType,jdbcType=INTEGER},
#{item.lightBandIp,jdbcType=VARCHAR}, #{item.parkingNum,jdbcType=INTEGER}, #{item.picturePath,jdbcType=VARCHAR},
#{item.dataStatus,jdbcType=INTEGER}, #{item.createTime,jdbcType=TIMESTAMP}, #{item.createOp,jdbcType=BIGINT},
#{item.modifyTime,jdbcType=TIMESTAMP}, #{item.installDate,jdbcType=TIMESTAMP},
#{item.modifyOp,jdbcType=VARCHAR}, #{item.lastUpdateDate,jdbcType=TIMESTAMP}, #{item.orgId,jdbcType=BIGINT},
#{item.ledDeviceStatus,jdbcType=INTEGER}, #{item.ledScreenStatus,jdbcType=INTEGER}
)
</foreach>
</insert>
</mapper>