IncomeFinanceAppointmentBillSmapper.xml
7.97 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
<?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.order.mapper.smapper.IncomeFinanceAppointmentBillSmapper">
<resultMap id="BaseResultMap" type="com.zteits.order.domain.IncomeFinanceAppointmentBill">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="check_date" jdbcType="DATE" property="checkDate" />
<result column="area_id" jdbcType="VARCHAR" property="areaId" />
<result column="area_name" jdbcType="VARCHAR" property="areaName" />
<result column="pl_no" jdbcType="VARCHAR" property="plNo" />
<result column="pl_name" jdbcType="VARCHAR" property="plName" />
<result column="area_type" jdbcType="INTEGER" property="areaType" />
<result column="park_position" jdbcType="INTEGER" property="parkPosition" />
<result column="total_fee" jdbcType="BIGINT" property="totalFee" />
<result column="act_fee_total" jdbcType="BIGINT" property="actFeeTotal" />
<result column="dicount_fee_total" jdbcType="BIGINT" property="dicountFeeTotal" />
<result column="refund_fee_totall" jdbcType="BIGINT" property="refundFeeTotall" />
<result column="park_ali_fee" jdbcType="BIGINT" property="parkAliFee" />
<result column="park_wx_fee" jdbcType="BIGINT" property="parkWxFee" />
<result column="park_cash_fee" jdbcType="BIGINT" property="parkCashFee" />
<result column="park_balance_fee" jdbcType="BIGINT" property="parkBalanceFee" />
<result column="park_ali_charge_num" jdbcType="INTEGER" property="parkAliChargeNum" />
<result column="park_wx_charge_num" jdbcType="INTEGER" property="parkWxChargeNum" />
<result column="park_cash_charge_num" jdbcType="INTEGER" property="parkCashChargeNum" />
<result column="park_balance_charge_num" jdbcType="INTEGER" property="parkBalanceChargeNum" />
<result column="data_state" jdbcType="INTEGER" property="dataState" />
<result column="create_emp_id" jdbcType="VARCHAR" property="createEmpId" />
<result column="create_emp_name" jdbcType="VARCHAR" property="createEmpName" />
<result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
<result column="modfiy_emp_id" jdbcType="VARCHAR" property="modfiyEmpId" />
<result column="modfiy_emp_name" jdbcType="VARCHAR" property="modfiyEmpName" />
<result column="modfiy_date" jdbcType="TIMESTAMP" property="modfiyDate" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
</resultMap>
<sql id="Base_Column_List">
id, check_date, area_id, area_name, pl_no, pl_name, area_type, park_position, total_fee,
act_fee_total, dicount_fee_total, refund_fee_totall, park_ali_fee, park_wx_fee, park_cash_fee,
park_balance_fee, park_ali_charge_num, park_wx_charge_num, park_cash_charge_num,
park_balance_charge_num, data_state, create_emp_id, create_emp_name, create_date,
modfiy_emp_id, modfiy_emp_name, modfiy_date, remark
</sql>
<!--车位预约-账单管理(对账助手) 收费-->
<select id="queryIncomeFinanceBillByTime" resultType="com.zteits.order.domain.IncomeFinanceAppointmentBill">
SELECT
a.pl_no AS plNo,
DATE_FORMAT(a.pay_finish_time, '%Y-%m-%d') AS checkDate,
/**临时停车应收*/
sum(IFNULL(a.order_total_fee, 0)) as totalFee,
/**临时停车实收*/
sum(IFNULL(a.order_act_fee, 0)) as actFeeTotal,
/**临时停车优惠*/
sum(IFNULL(a.order_dicount_fee, 0)) as dicountFeeTotal,
/**临时停车阿里实收*/
IFNULL(sum(CASE WHEN a.pay_type = 1 THEN IFNULL(a.order_act_fee, 0) ELSE 0 END),0) parkAliFee,
/**临时停车支付宝次数*/
sum(CASE WHEN a.pay_type = 1 THEN 1 ELSE 0 END) parkAliChargeNum,
/**临时停车微信收入*/
IFNULL(sum(CASE WHEN a.pay_type IN (2, 4) THEN IFNULL(a.order_act_fee, 0) ELSE 0 END),0) parkWxFee,
/**临时停车微信次数*/
sum(CASE WHEN a.pay_type IN (2, 4) THEN 1 ELSE 0 END) parkWxChargeNum,
/**临时停车余额收入*/
IFNULL(sum(CASE WHEN a.pay_type = 5 THEN IFNULL(a.order_act_fee, 0) ELSE 0 END) ,0) AS parkBalanceFee,
/**临时停车余额次数*/
sum(CASE WHEN a.pay_type=5 THEN 1 ELSE 0 END) parkBalanceChargeNum,
/**临时停车现金收入*/
IFNULL(sum(CASE WHEN a.pay_type = 6 THEN IFNULL(a.order_act_fee, 0) ELSE 0 END),0) parkCashFee,
/**临时停车现金次数*/
sum(CASE WHEN a.pay_type=6 THEN 1 ELSE 0 END) parkCashChargeNum
FROM
pay_order_success a
WHERE
1=1
AND a.data_state = 1
AND a.order_big_type=400
AND a.pay_order_state = 40
and a.pl_no not in('001','002')
and a.pay_type in(1,2,4,5)
<![CDATA[and a.pay_finish_time >= #{startTime}
and a.pay_finish_time <= #{endTime}]]>
and a.pl_no=#{plNo}
GROUP BY a.pl_no,
DATE_FORMAT(a.pay_finish_time, '%Y-%m-%d')
</select>
<!--车位预约分页查询-->
<select id="queryAppointmentBillForList"
resultType="com.zteits.clouds.api.dto.appointment.IncomeFinanceAppointmentBillDTO"
parameterType="com.zteits.clouds.api.dto.appointment.params.IncomeFinanceAppointmentBillReq">
SELECT
check_date as checkDate,
area_id as areaId,
area_name as areaName,
pl_no as plNo,
pl_name as plName,
area_type as areaType,
IFNULL(total_fee,0) as totalFee,
IFNULL(act_fee_total,0) as actFeeTotal,
IFNULL(dicount_fee_total,0) as dicountFeeTotal,
IFNULL(refund_fee_totall,0) as refundFeeTotall,
IFNULL(park_ali_fee,0) as parkAliFee,
IFNULL(park_wx_fee,0) as parkWxFee,
IFNULL(park_cash_fee,0) as parkCashFee,
IFNULL(park_balance_fee,0) as parkBalanceFee
FROM
income_finance_appointment_bill
where 1=1
and data_state =1
<if test="plNos != null and plNos.size >0">
and pl_no in
<foreach collection="plNos" open="(" close=")" item="plNo" separator=",">
#{plNo}
</foreach>
</if>
<if test="beginTime != null">
<![CDATA[ and check_date >= #{beginTime} ]]>
</if>
<if test="endTime != null">
<![CDATA[ and check_date <= #{endTime} ]]>
</if>
<if test="parkPosition != null">
and park_position = #{parkPosition}
</if>
</select>
<!--车位预约汇总查询-->
<select id="queryAppointmentBillForSum"
resultType="com.zteits.clouds.api.dto.appointment.IncomeFinanceAppointmentBillDTO"
parameterType="com.zteits.clouds.api.dto.appointment.params.IncomeFinanceAppointmentBillReq">
SELECT
IFNULL(sum(total_fee),0) as totalFee,
IFNULL(sum(act_fee_total),0) as actFeeTotal,
IFNULL(sum(dicount_fee_total),0) as dicountFeeTotal,
IFNULL(sum(refund_fee_totall),0) as refundFeeTotall,
IFNULL(sum(park_ali_fee),0) as parkAliFee,
IFNULL(sum(park_wx_fee),0) as parkWxFee,
IFNULL(sum(park_cash_fee),0) as parkCashFee,
IFNULL(sum(park_balance_fee),0) as parkBalanceFee
FROM
income_finance_appointment_bill
where 1=1
and data_state =1
<if test="plNos != null and plNos.size >0">
and pl_no in
<foreach collection="plNos" open="(" close=")" item="plNo" separator=",">
#{plNo}
</foreach>
</if>
<if test="beginTime != null">
<![CDATA[ and check_date >= #{beginTime} ]]>
</if>
<if test="endTime != null">
<![CDATA[ and check_date <= #{endTime} ]]>
</if>
<if test="parkPosition != null">
and park_position = #{parkPosition}
</if>
</select>
</mapper>