BlackListSMapper.xml
3.35 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
<?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.bill.mapper.smapper.BlackListSMapper">
<insert id="insertBatch">
insert into t_black_list (car_number, car_number_color, rule_no, rule_type, car_status, org_id,
remarks, create_empid, create_time)values
<foreach collection="records" index="index" item="entity" separator="," open="" close="">
( #{entity.carNumber}, #{entity.carNumberColor}, #{entity.ruleNo},
#{entity.ruleType}, #{entity.carStatus}, #{entity.orgId},
#{entity.remarks},#{entity.createEmpid}, #{entity.createTime})
</foreach>
</insert>
<!-- 查询获取某个停车场内,某车的黑名单限行配置记录 -->
<select id="queryBlackCarLimitDTO" resultType="com.zteits.clouds.api.dto.bill.dto.BlackCarLimitDTO">
select
c.id as cid,
c.car_number as carNumber,
c.car_number_color as carNumberColor,
c.rule_type as ruleType,
r.start_time as startTime,
r.end_time as endTime,
r.remarks as remarks,
p.pl_no as plNo
from t_black_list c
left join t_black_list_rule r on r.rule_no = c.rule_no
left join t_black_list_park_rel p on p.rule_no = c.rule_no
where
c.car_number = #{carNumber}
and c.car_status = 2
<if test="limitType != null">
and c.rule_type = #{limitType}
</if>
and
c.car_number_color = #{carNumberColor}
and
r.rule_state = 2
and
r.start_time < NOW()
and
r.end_time > NOW()
<if test="plNo != null and plNo !=''">
and
p.pl_no = #{plNo}
</if>
</select>
<!-- 获取黑名单车辆信息列表 -->
<select id="queryBlackListCarList" resultType="com.zteits.clouds.api.dto.bill.dto.BlackListCarDTO">
SELECT
c.id AS id,
c.car_number AS carNumber,
c.car_number_color AS carNumberColor,
c.rule_type AS ruleType,
r.rule_no as ruleNo,
c.car_status as carStatus,
r.rule_name as ruleName,
DATE_FORMAT(c.create_time, '%Y-%m-%d %H:%i:%S') as createTime,
DATE_FORMAT(r.start_time, '%Y-%m-%d %H:%i:%S') AS startTime,
DATE_FORMAT(r.end_time, '%Y-%m-%d %H:%i:%S') AS endTime,
c.remarks AS remarks
FROM
t_black_list c
LEFT JOIN t_black_list_rule r ON r.rule_no = c.rule_no
WHERE
c.org_id = #{orgId}
<if test="carNumber != null and carNumber !=''">
and c.car_number = #{carNumber}
</if>
<if test="carNumberColor != null and carNumberColor !=''">
and c.car_number_color = #{carNumberColor, jdbcType=INTEGER}
</if>
<if test="ruleType != null and ruleType !=''">
and c.rule_type = #{ruleType, jdbcType=INTEGER}
</if>
<if test="carStatus != null and carStatus !=''">
and c.car_status = #{carStatus, jdbcType=INTEGER}
</if>
<if test="ruleNo != null and ruleNo !=''">
and c.rule_no = #{ruleNo}
</if>
order by c.id desc
</select>
</mapper>