TdPParkingShareSMapper.xml
14 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
<?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.TdPParkingShareSMapper">
<resultMap id="ParkingShareOrderTempResultMap" type="com.zteits.clouds.api.dto.pay.sharesettlement.dto.ParkingShareOrderTempDTO">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="order_id" property="orderId" jdbcType="VARCHAR"/>
<result column="ps_pre_in_time" property="psPreInTime" jdbcType="TIMESTAMP"/>
<result column="ps_pre_out_time" property="psPreOutTime" jdbcType="TIMESTAMP"/>
<result column="ps_in_time" property="psInTime" jdbcType="TIMESTAMP"/>
<result column="ps_out_time" property="psOutTime" jdbcType="TIMESTAMP"/>
<result column="ps_service_cust_id" property="psServiceCustId" jdbcType="VARCHAR"/>
<result column="ps_service_tel" property="psServiceTel" jdbcType="VARCHAR"/>
<result column="ps_service_name" property="psServiceName" jdbcType="VARCHAR"/>
<result column="pay_status" property="payStatus" jdbcType="CHAR"/>
<result column="account_type" property="accountType" jdbcType="INTEGER"/>
<result column="pl_name" property="plName" jdbcType="VARCHAR"/>
<result column="pl_no" property="plNo" jdbcType="VARCHAR"/>
<result column="ps_berth_no" property="psBerthNo" jdbcType="VARCHAR"/>
<result column="act_payed_fee" property="actPayedFee" jdbcType="DECIMAL"/>
<result column="payed_fee" property="payedFee" jdbcType="DECIMAL"/>
<result column="not_pay_fee" property="notPayFee" jdbcType="DECIMAL"/>
<result column="total_fee" property="totalFee" jdbcType="DECIMAL"/>
<result column="refunded_fee" property="refundedFee" jdbcType="DECIMAL"/>
<result column="create_emp_id" property="createEmpId" jdbcType="VARCHAR"/>
<result column="create_emp_name" property="createEmpName" jdbcType="VARCHAR"/>
<result column="create_date" property="createDate" jdbcType="TIMESTAMP"/>
<result column="modfiy_empid" property="modfiyEmpid" jdbcType="VARCHAR"/>
<result column="modfiy_empid_name" property="modfiyEmpidName" jdbcType="VARCHAR"/>
<result column="modfiy_date" property="modfiyDate" jdbcType="TIMESTAMP"/>
<result column="remark" property="remark" jdbcType="VARCHAR"/>
</resultMap>
<sql id="ParkingShareOrderTemp_Column_List">
id, order_id, ps_pre_in_time, ps_pre_out_time, ps_in_time, ps_out_time, ps_service_cust_id,
ps_service_tel, ps_service_name, pay_status, account_type, pl_name, pl_no, ps_berth_no,
act_payed_fee, payed_fee, not_pay_fee, total_fee, refunded_fee, create_emp_id, create_emp_name,
create_date, modfiy_empid, modfiy_empid_name, modfiy_date, remark
</sql>
<resultMap id="BaseResultMap" type="com.zteits.park.domain.TdPParkingShare">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="pl_name" jdbcType="VARCHAR" property="plName" />
<result column="pl_no" jdbcType="VARCHAR" property="plNo" />
<result column="pl_province_id" jdbcType="BIGINT" property="plProvinceId" />
<result column="pl_province_name" jdbcType="VARCHAR" property="plProvinceName" />
<result column="pl_city_id" jdbcType="BIGINT" property="plCityId" />
<result column="pl_city_name" jdbcType="VARCHAR" property="plCityName" />
<result column="pl_country_id" jdbcType="BIGINT" property="plCountryId" />
<result column="pl_country_name" jdbcType="VARCHAR" property="plCountryName" />
<result column="source_type" jdbcType="INTEGER" property="sourceType" />
<result column="ps_lock_bind_no" jdbcType="VARCHAR" property="psLockBindNo" />
<result column="ps_lock_state" jdbcType="CHAR" property="psLockState" />
<result column="ps_lock_no" jdbcType="VARCHAR" property="psLockNo" />
<result column="ps_rate" jdbcType="VARCHAR" property="psRate" />
<result column="ps_service_cust_id" jdbcType="VARCHAR" property="psServiceCustId" />
<result column="ps_service_tel" jdbcType="VARCHAR" property="psServiceTel" />
<result column="ps_service_name" jdbcType="VARCHAR" property="psServiceName" />
<result column="ps_picture_path" jdbcType="VARCHAR" property="psPicturePath" />
<result column="ps_address" jdbcType="VARCHAR" property="psAddress" />
<result column="ps_pay_type" jdbcType="INTEGER" property="psPayType" />
<result column="ps_busi_time_start" jdbcType="TIMESTAMP" property="psBusiTimeStart" />
<result column="ps_busi_time_end" jdbcType="TIMESTAMP" property="psBusiTimeEnd" />
<result column="frequency_type" jdbcType="INTEGER" property="frequencyType" />
<result column="valid_start_time" jdbcType="TIME" property="validStartTime" />
<result column="valid_end_time" jdbcType="TIME" property="validEndTime" />
<result column="custom_frequency" jdbcType="VARCHAR" property="customFrequency" />
<result column="ps_order_id" jdbcType="VARCHAR" property="psOrderId" />
<result column="ps_pre_create_time" jdbcType="TIMESTAMP" property="psPreCreateTime" />
<result column="ps_pre_in_time" jdbcType="TIMESTAMP" property="psPreInTime" />
<result column="ps_pre_out_time" jdbcType="TIMESTAMP" property="psPreOutTime" />
<result column="ps_in_time" jdbcType="TIMESTAMP" property="psInTime" />
<result column="ps_rent_car_number" jdbcType="VARCHAR" property="psRentCarNumber" />
<result column="ps_rent_cust_id" jdbcType="VARCHAR" property="psRentCustId" />
<result column="ps_pre_act_fee" jdbcType="BIGINT" property="psPreActFee" />
<result column="ps_rent_duration" jdbcType="BIGINT" property="psRentDuration" />
<result column="ps_is_occupy" jdbcType="CHAR" property="psIsOccupy" />
<result column="ps_is_rent" jdbcType="CHAR" property="psIsRent" />
<result column="ps_source_type" jdbcType="INTEGER" property="psSourceType" />
<result column="ps_berth_no" jdbcType="VARCHAR" property="psBerthNo" />
<result column="ps_road_position" jdbcType="CHAR" property="psRoadPosition" />
<result column="ps_direction" jdbcType="CHAR" property="psDirection" />
<result column="ps_park_type" jdbcType="CHAR" property="psParkType" />
<result column="ps_lon_id" jdbcType="DECIMAL" property="psLonId" />
<result column="ps_lat_id" jdbcType="DECIMAL" property="psLatId" />
<result column="ps_berth_address" jdbcType="VARCHAR" property="psBerthAddress" />
<result column="ps_examine_state" jdbcType="CHAR" property="psExamineState" />
<result column="ps_remark" jdbcType="VARCHAR" property="psRemark" />
<result column="data_status" jdbcType="INTEGER" property="dataStatus" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="create_op" jdbcType="VARCHAR" property="createOp" />
<result column="modify_time" jdbcType="TIMESTAMP" property="modifyTime" />
<result column="modify_op" jdbcType="VARCHAR" property="modifyOp" />
<result column="org_id" jdbcType="BIGINT" property="orgId" />
<result column="org_name" jdbcType="VARCHAR" property="orgName" />
</resultMap>
<sql id="Base_Column_List">
id, pl_name, pl_no, pl_province_id, pl_province_name, pl_city_id, pl_city_name, pl_country_id,
pl_country_name, source_type, ps_lock_bind_no, ps_lock_state, ps_lock_no, ps_rate,
ps_service_cust_id, ps_service_tel, ps_service_name, ps_picture_path, ps_address,
ps_pay_type, ps_busi_time_start, ps_busi_time_end, frequency_type, valid_start_time,
valid_end_time, custom_frequency, ps_order_id, ps_pre_create_time, ps_pre_in_time,
ps_pre_out_time, ps_in_time, ps_rent_car_number, ps_rent_cust_id, ps_pre_act_fee,
ps_rent_duration, ps_is_occupy, ps_is_rent, ps_source_type, ps_berth_no, ps_road_position,
ps_direction, ps_park_type, ps_lon_id, ps_lat_id, ps_berth_address, ps_examine_state,
ps_remark, data_status, create_time, create_op, modify_time, modify_op, org_id, org_name
</sql>
<select id="queryShareBerthUsedList" parameterType="com.zteits.clouds.api.dto.park.param.TdPParkingShareRequest"
resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from td_p_parking_share
where 1=1 and ps_examine_state = 2 and ps_is_rent = 1
and case when frequency_type = 5 and FIND_IN_SET(DAYOFWEEK(#{queryDate}),custom_frequency) > 0
then CONCAT(DATE_FORMAT(#{queryDate},'%Y-%m-%d'),' ',valid_start_time) < DATE_FORMAT(#{queryDate},'%Y-%m-%d %H:%i:%s')
and CONCAT(DATE_FORMAT(#{queryDate},'%Y-%m-%d'),' ',valid_end_time) > DATE_FORMAT(#{queryDate},'%Y-%m-%d %H:%i:%s')
when frequency_type = 4 then CONCAT(DATE_FORMAT(#{queryDate},'%Y-%m-%d'),' ',valid_start_time) < DATE_FORMAT(#{queryDate},'%Y-%m-%d %H:%i:%s')
and CONCAT(DATE_FORMAT(#{queryDate},'%Y-%m-%d'),' ',valid_end_time) > DATE_FORMAT(#{queryDate},'%Y-%m-%d %H:%i:%s')
when frequency_type = 3 and 1 = #{isHoliday}
then CONCAT(DATE_FORMAT(#{queryDate},'%Y-%m-%d'),' ',valid_start_time) < DATE_FORMAT(#{queryDate},'%Y-%m-%d %H:%i:%s')
and CONCAT(DATE_FORMAT(#{queryDate},'%Y-%m-%d'),' ',valid_end_time) > DATE_FORMAT(#{queryDate},'%Y-%m-%d %H:%i:%s')
when frequency_type = 2 and FIND_IN_SET(DAYOFWEEK(#{queryDate}),'2,3,4,5,6') > 0
then CONCAT(DATE_FORMAT(#{queryDate},'%Y-%m-%d'),' ',valid_start_time) < DATE_FORMAT(#{queryDate},'%Y-%m-%d %H:%i:%s')
and CONCAT(DATE_FORMAT(#{queryDate},'%Y-%m-%d'),' ',valid_end_time) > DATE_FORMAT(#{queryDate},'%Y-%m-%d %H:%i:%s')
when frequency_type = 1 then DATE_FORMAT(ps_busi_time_start,'%Y-%m-%d %H:%i:%s') < DATE_FORMAT(#{queryDate},'%Y-%m-%d %H:%i:%s')
and DATE_FORMAT(ps_busi_time_end,'%Y-%m-%d %H:%i:%s') > DATE_FORMAT(#{queryDate},'%Y-%m-%d %H:%i:%s') end
<if test="plNo != null">
and pl_no = #{plNo,jdbcType=VARCHAR}
</if>
<if test="psBerthNo != null">
and ps_berth_no = #{psBerthNo}
</if>
<if test="orgId != null">
and org_id = #{orgId}
</if>
<if test="psRentCarNumber != null">
and ps_rent_car_number = #{psRentCarNumber,jdbcType=VARCHAR}
</if>
<if test="nameOrAddress !=null and nameOrAddress !=''">
AND (pl_name like concat('%',#{nameOrAddress},'%') OR ps_address like concat('%',#{nameOrAddress},'%')
OR ps_berth_address like concat('%',#{nameOrAddress},'%'))
</if>
</select>
<!-- 查询共享车位list -->
<select id="queryShareBerthList" parameterType="com.zteits.clouds.api.dto.park.param.TdPParkingShareRequest"
resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from td_p_parking_share
where data_status = 1
<if test="plName != null">
and pl_name = #{plName,jdbcType=VARCHAR}
</if>
<if test="plNo != null">
and pl_no = #{plNo,jdbcType=VARCHAR}
</if>
<if test="plProvinceId != null">
and pl_province_id = #{plProvinceId,jdbcType=BIGINT}
</if>
<if test="plCityId != null">
and pl_city_id = #{plCityId,jdbcType=BIGINT}
</if>
<if test="plCountryId != null">
and pl_country_id = #{plCountryId,jdbcType=BIGINT}
</if>
<if test="sourceType != null">
and source_type = #{sourceType,jdbcType=INTEGER}
</if>
<if test="psServiceCustId != null">
and ps_service_cust_id = #{psServiceCustId,jdbcType=VARCHAR}
</if>
<if test="psServiceTel != null">
and ps_service_tel = #{psServiceTel,jdbcType=VARCHAR}
</if>
<if test="psOrderId != null">
and ps_order_id = #{psOrderId,jdbcType=VARCHAR}
</if>
<if test="psRentCarNumber != null">
and ps_rent_car_number = #{psRentCarNumber,jdbcType=VARCHAR}
</if>
<if test="psRentCustId != null">
and ps_rent_cust_id = #{psRentCustId,jdbcType=VARCHAR}
</if>
<if test="psIsOccupy != null">
and ps_is_occupy = #{psIsOccupy,jdbcType=CHAR}
</if>
<if test="psIsRent != null">
and ps_is_rent = #{psIsRent,jdbcType=CHAR}
</if>
<if test="psSourceType != null">
and ps_source_type = #{psSourceType,jdbcType=INTEGER}
</if>
<if test="psBerthNo != null">
and ps_berth_no = #{psBerthNo,jdbcType=VARCHAR}
</if>
<if test="psExamineState != null">
and ps_examine_state = #{psExamineState,jdbcType=CHAR}
</if>
<if test="orgId != null">
and org_id = #{orgId}
</if>
order by pl_no,ps_berth_no
</select>
<select id="queryParkShareOrderTempInfo" resultMap="ParkingShareOrderTempResultMap"
parameterType="com.zteits.clouds.api.dto.pay.sharesettlement.param.ParkShareOrderTempInfoQueryRequest">
SELECT
m.ps_order_id order_id,
m.ps_pre_in_time,
m.ps_pre_out_time,
m.ps_in_time,
m.ps_out_time,
n.ps_service_cust_id,
n.ps_service_tel,
n.ps_service_name,
m.pay_status,
1 account_type,
n.pl_name,
n.pl_no,
m.ps_berth_no,
ifnull(m.act_payed_fee, 0) act_payed_fee,
ifnull(m.payed_fee, 0) payed_fee,
ifnull(m.not_pay_fee, 0) not_pay_fee,
ifnull(m.total_fee, 0) total_fee,
ifnull(m.refunded_fee, 0) refunded_fee,
-1 create_emp_id,
'系统' create_emp_name,
now() create_date,
-1 modfiy_empid,
'系统' modfiy_empid_name,
now() modfiy_date,
NULL remark
FROM td_p_parking_share_log m LEFT JOIN td_p_parking_share n
ON m.ps_berth_no = n.ps_berth_no and m.pl_no = n.pl_no
WHERE m.data_status = 1
AND n.data_status = 1
AND m.ps_out_time >= #{startDate}
AND m.ps_out_time <= #{endDate}
</select>
</mapper>