TdClRuleCollectSMapper.xml
7.42 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
<?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.TdClRuleCollectSMapper">
<resultMap id="BaseResultMap" type="com.zteits.clouds.api.dto.bill.closecarpark.dto.ViewSegmentChargingDTO">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="rule_collect_id" jdbcType="VARCHAR" property="ruleCollectId" />
<result column="rule_collect_name" jdbcType="VARCHAR" property="ruleCollectName" />
<result column="car_type_strategy" jdbcType="INTEGER" property="carTypeStrategy" />
<result column="rule_desc" jdbcType="VARCHAR" property="ruleDesc" />
<result column="data_flg" jdbcType="CHAR" property="dataFlg" />
<collection property="detailList" ofType="com.zteits.clouds.api.dto.bill.closecarpark.dto.CarSegmentRulesDTO"
select="viewCarSegmentRules"
column="rule_collect_id">
</collection>
</resultMap>
<resultMap id="BaseResultRuleDetailMap" type="com.zteits.clouds.api.dto.bill.closecarpark.dto.SegmentDetailRulesDTO">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="start_time" jdbcType="TIMESTAMP" property="startTime" />
<result column="rule_id" jdbcType="VARCHAR" property="ruleId" />
<result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
<result column="rule_type" jdbcType="INTEGER" property="ruleType" />
<result column="section_fee_limit" jdbcType="BIGINT" property="sectionFeeLimit" />
<result column="free_time" jdbcType="BIGINT" property="freeTime" />
<result column="first_time" jdbcType="BIGINT" property="firstTime" />
<result column="first_fee" jdbcType="BIGINT" property="firstFee" />
<result column="loop1_per_time" jdbcType="BIGINT" property="loop1PerTime" />
<result column="loop1_per_fee" jdbcType="BIGINT" property="loop1PerFee" />
<result column="loop2_start" jdbcType="BIGINT" property="loop2Start" />
<result column="loop2_per_time" jdbcType="BIGINT" property="loop2PerTime" />
<result column="loop2_per_fee" jdbcType="BIGINT" property="loop2PerFee" />
<result column="dn_flag" jdbcType="INTEGER" property="dnFlag" />
<result column="retention_time" jdbcType="INTEGER" property="retentionTime" />
</resultMap>
<resultMap id="BaseResultRuleMap" type="com.zteits.clouds.api.dto.bill.closecarpark.dto.CarSegmentRulesDTO">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="rule_collect_id" jdbcType="VARCHAR" property="ruleCollectId" />
<result column="rule_id" jdbcType="VARCHAR" property="ruleId" />
<result column="fee_type" jdbcType="INTEGER" property="feeType" />
<result column="car_type" jdbcType="INTEGER" property="carType" />
<result column="loop_type" jdbcType="INTEGER" property="loopType" />
<result column="rule_fee_limit" jdbcType="INTEGER" property="ruleFeeLimit" />
<result column="cross_period_strategy" jdbcType="INTEGER" property="crossPeriodStrategy" />
<collection property="segmentDetailList" ofType="com.zteits.clouds.api.dto.bill.closecarpark.dto.SegmentDetailRulesDTO"
select="viewSegmentDetailRules"
column="rule_id">
</collection>
</resultMap>
<!-- 根据停车场编号以及区域ID获取计费规则合计 -->
<select id="queryRuleCollectByPlnoAndAreaId"
resultType="com.zteits.clouds.api.dto.bill.cloudbilling.dto.CloudRuleCollectDTO">
SELECT
c.id,
r.pl_no as plNo,
c.rule_collect_id as ruleCollectId,
c.rule_collect_name as ruleCollectName,
r.eff_date as effDate,
c.car_type_strategy as carTypeStrategy
FROM td_cl_park_rule_collect_rel r
LEFT JOIN td_cl_rule_collect c on r.rule_collect_id = c.rule_collect_id
WHERE r.pl_no = #{plNo}
LIMIT 1
</select>
<select id="viewParkingChargingRules" parameterType="java.lang.String"
resultType="com.zteits.clouds.api.dto.bill.closecarpark.dto.DetailRulesDTO">
select
r.id id,
r.rule_collect_id ruleCollectId,
r.rule_id ruleId,
r.fee_type feeType,
r.car_type carType,
r.loop_type loopType,
r.rule_fee_limit ruleFeeLimit,
r.cross_period_strategy crossPeriodStrategy,
d.id detailId,
d.start_time startTime,
d.end_time endTime,
d.rule_type ruleType,
d.section_fee_limit sectionFeeLimit,
d.free_time freeTime,
d.first_time firstTime,
d.first_fee firstFee,
d.loop1_per_time loop1PerTime,
d.loop1_per_fee loop1PerFee,
d.retention_time retentionTime,
c.rule_collect_name ruleCollectName,
c.car_type_strategy carTypeStrategy,
c.rule_desc ruleDesc,
d.loop2_per_fee loop2PerFee
FROM
td_cl_rule r
LEFT JOIN td_cl_rule_detail d ON r.rule_id = d.rule_id
LEFT JOIN td_cl_rule_collect c ON r.rule_collect_id = c.rule_collect_id
where r.rule_collect_id = #{ruleCollectId,jdbcType=VARCHAR}
</select>
<!-- 根据计费规则id获取计费集合 -->
<select id="viewParkingSegmentCharging" resultMap="BaseResultMap">
SELECT
c.id,
c.rule_collect_id,
c.rule_collect_name,
c.car_type_strategy,
c.rule_desc
FROM td_cl_rule_collect c
WHERE c.id = #{id}
LIMIT 1
</select>
<!-- 根据计费规则id获取计费规则 -->
<select id="viewCarSegmentRules" resultMap="BaseResultRuleMap">
SELECT
r.id,
r.rule_collect_id,
r.rule_id,
r.fee_type,
r.car_type,
r.loop_type,
r.rule_fee_limit,
r.cross_period_strategy
FROM td_cl_rule r
WHERE r.rule_collect_id = #{ruleCollectId}
group by r.id
</select>
<!-- 根据计费规则id获取计费规则详情 -->
<select id="viewSegmentDetailRules" resultMap="BaseResultRuleDetailMap">
SELECT
d.id,
d.rule_id,
d.end_time,
d.start_time,
d.rule_type,
d.section_fee_limit,
d.free_time,
d.first_time,
d.first_fee,
d.loop1_per_time,
d.loop1_per_fee,
d.loop2_start,
d.loop2_per_time,
d.loop2_per_fee,
d.dn_flag,
d.retention_time
FROM td_cl_rule_detail d
WHERE d.rule_id = #{ruleId}
group by d.id
</select>
<!-- 根据计费规则id获取计费规则详情 -->
<select id="queryParkingSegmentCharging" parameterType="com.zteits.clouds.api.dto.bill.closecarpark.param.QuerySegmentChargingRequest"
resultType="com.zteits.clouds.api.dto.bill.closecarpark.dto.SegmentChargingDTO">
SELECT
c.id,
c.rule_collect_id ruleCollectId,
c.rule_collect_name ruleCollectName,
c.car_type_strategy carTypeStrategy,
c.rule_desc ruleDesc,
c.data_flg dataFlg,
c.fee_type feeType,
c.org_id
FROM td_cl_rule_collect c
WHERE c.fee_type = 2
and c.data_flg = 1
<if test="ruleCollectName != null and ruleCollectName != ''">
AND c.rule_collect_name like concat('%',#{ruleCollectName,jdbcType=VARCHAR},'%')
</if>
<if test="orgId != null and orgId != ''">
AND c.org_id = #{orgId}
</if>
</select>
</mapper>