TActivityDiscountRuleSmapper.xml
9.79 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
<?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.TActivityDiscountRuleSmapper">
<resultMap id="BaseResultMap" type="com.zteits.bill.domain.TActivityDiscountRule">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="disc_no" jdbcType="VARCHAR" property="discNo" />
<result column="disc_rule_no" jdbcType="VARCHAR" property="discRuleNo" />
<result column="disc_rule_name" jdbcType="VARCHAR" property="discRuleName" />
<result column="disc_terminal_res" jdbcType="INTEGER" property="discTerminalRes" />
<result column="disc_pay_type" jdbcType="INTEGER" property="discPayType" />
<result column="dis_car_type" jdbcType="INTEGER" property="disCarType" />
<result column="disc_value" jdbcType="VARCHAR" property="discValue" />
<result column="is_t_limit" jdbcType="INTEGER" property="isTLimit" />
<result column="eff_date" jdbcType="TIME" property="effDate" />
<result column="exp_date" jdbcType="TIME" property="expDate" />
<result column="special_day_type" jdbcType="INTEGER" property="specialDayType" />
<result column="remarks" jdbcType="VARCHAR" property="remarks" />
<result column="data_state" jdbcType="INTEGER" property="dataState" />
<result column="create_empid" jdbcType="VARCHAR" property="createEmpid" />
<result column="create_name" jdbcType="VARCHAR" property="createName" />
<result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
<result column="modify_empid" jdbcType="VARCHAR" property="modifyEmpid" />
<result column="modify_name" jdbcType="VARCHAR" property="modifyName" />
<result column="modify_date" jdbcType="TIMESTAMP" property="modifyDate" />
</resultMap>
<sql id="Base_Column_List">
id, disc_no, disc_rule_no, disc_rule_name, disc_terminal_res, disc_pay_type, dis_car_type,
disc_value, is_t_limit, eff_date, exp_date, special_day_type, remarks, data_state,
create_empid, create_name, create_date, modify_empid, modify_name, modify_date
</sql>
<!-- 根据折扣规则编码查询折扣价格 -->
<select id="queryDiscountRuleByDiscNo" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"></include>
from t_activity_discount_rule
where data_state=1
and disc_rule_no =#{discRuleNo}
</select>
<!-- 通过停车场编码,折扣类型,终端来源,车辆类型,出场时间查询停车场所有折扣规则 -->
<select id="queryDiscontRuleForList" parameterType="com.zteits.clouds.api.dto.bill.discount.param.QueryDiscountRuleRequest"
resultType="com.zteits.bill.domain.DiscontRuleForParkDO">
select a.pl_no as plNo,
a.disc_no as discNo,
b.disc_rule_no as discRuleNo,
b.disc_rule_name as discRuleName,
a.disc_res as discRes,
a.disc_type as discType,
b.disc_terminal_res as discTerminalRes,
b.disc_pay_type as discPayType,
b.dis_car_type as disCarType,
b.disc_value as discValue,
b.is_t_limit as isTLimit,
b.eff_date as effDate,
b.exp_date as expDate,
b.special_day_type as specialDayType
from t_activity_discount a ,t_activity_discount_rule b
where a.disc_no=b.disc_no
and a.data_state=b.data_state
and a.disc_state =1 /**折扣状态:1、上架;2、下架.*/
<if test="plNo != null and plNo !=''">
and a.pl_no=#{plNo}
</if>
<if test="discType != null">
and a.disc_type=#{discType} /**折扣类型:1.停车支付折扣 2:购买会员卡活动.*/
</if>
<if test="discTerminalRes != null">
and b.disc_terminal_res =#{discTerminalRes} /**终端来源:1:PDA 2:APP 3:公众号.*/
</if>
<if test="disCarTpye != null">
and b.dis_car_type =#{disCarTpye} /**车辆类型:1-大型车;2-小型车 3:不限制.*/
</if>
<if test="payType != null and payType == 36">
and (b.disc_pay_type = #{payType}) /**支付方式-- 1:支付宝 2:微信 3:银联 4:微信公众号 5 个人账户*/
</if>
<if test="payType != null and payType != 36">
and (b.disc_pay_type = #{payType} or b.disc_pay_type = -1) /**支付方式-- 1:支付宝 2:微信 3:银联 4:微信公众号 5 个人账户*/
</if>
<if test="parkOutTime != null">
<![CDATA[and a.begin_time <= #{parkOutTime}]]>
<![CDATA[and a.end_time >=#{parkOutTime}]]>
</if>
</select>
<!-- 根据折扣规则编码查询折扣价格 -->
<select id="queryDiscountRuleById" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"></include>
from t_activity_discount_rule
where data_state=1
and disc_no =#{discNo}
</select>
<!-- 查询自助折扣 -->
<select id="queryDiscountRuleInfo" resultType="com.zteits.bill.domain.TActivityDiscountRule">
select
a.disc_no as discNo,
a.disc_rule_no as discRuleNo,
a.disc_rule_name as discRuleNo,
a.disc_value as discValue,
a.disc_pay_type as discPayType
from t_activity_discount_rule a
where a.data_state=1
and a.disc_no = #{discNo}
</select>
<!-- 查询普通折扣 -->
<select id="queryDiscountRuleInfos" resultType="com.zteits.bill.domain.TActivityDiscountRule">
select
<include refid="Base_Column_List"></include>
from t_activity_discount_rule
where data_state=1
and disc_rule_no = #{discRuleNo}
and disc_pay_type != #{discPayType}
</select>
<!-- 查询自主折扣 -->
<select id="queryDiscountRuleInfoSelf" resultType="com.zteits.bill.domain.TActivityDiscountRule">
select
<include refid="Base_Column_List"></include>
from t_activity_discount_rule
where data_state=1
and disc_rule_no = #{discRuleNo}
and disc_pay_type = #{discPayType}
</select>
<!-- 删除折扣规则-根据折扣编码 -->
<update id="updateDiscountRule" parameterType="com.zteits.bill.domain.TActivityDiscountRule">
update t_activity_discount_rule
<set>
<if test="discRuleNo != null">
disc_rule_no = #{discRuleNo,jdbcType=VARCHAR},
</if>
<if test="discRuleName != null">
disc_rule_name = #{discRuleName,jdbcType=VARCHAR},
</if>
<if test="discTerminalRes != null">
disc_terminal_res = #{discTerminalRes,jdbcType=INTEGER},
</if>
<if test="discPayType != null">
disc_pay_type = #{discPayType,jdbcType=INTEGER},
</if>
<if test="disCarType != null">
dis_car_type = #{disCarType,jdbcType=INTEGER},
</if>
<if test="discValue != null">
disc_value = #{discValue,jdbcType=VARCHAR},
</if>
<if test="isTLimit != null">
is_t_limit = #{isTLimit,jdbcType=INTEGER},
</if>
<if test="effDate != null">
eff_date = #{effDate,jdbcType=TIME},
</if>
<if test="expDate != null">
exp_date = #{expDate,jdbcType=TIME},
</if>
<if test="specialDayType != null">
special_day_type = #{specialDayType,jdbcType=INTEGER},
</if>
<if test="remarks != null">
remarks = #{remarks,jdbcType=VARCHAR},
</if>
<if test="dataState != null">
data_state = #{dataState,jdbcType=INTEGER},
</if>
<if test="createEmpid != null">
create_empid = #{createEmpid,jdbcType=VARCHAR},
</if>
<if test="createName != null">
create_name = #{createName,jdbcType=VARCHAR},
</if>
<if test="createDate != null">
create_date = #{createDate,jdbcType=TIMESTAMP},
</if>
<if test="modifyEmpid != null">
modify_empid = #{modifyEmpid,jdbcType=VARCHAR},
</if>
<if test="modifyName != null">
modify_name = #{modifyName,jdbcType=VARCHAR},
</if>
<if test="modifyDate != null">
modify_date = #{modifyDate,jdbcType=TIMESTAMP},
</if>
</set>
where disc_no = #{discNo,jdbcType=VARCHAR}
</update>
<!-- 添加规则详情 -->
<insert id="addDiscountRule">
insert into t_activity_discount_rule (disc_no, disc_rule_no, disc_rule_name,
disc_terminal_res,
disc_pay_type, dis_car_type, disc_value,
is_t_limit, eff_date, exp_date,
special_day_type, remarks, data_state,
create_empid, create_name, create_date,
modify_empid, modify_name, modify_date
)
values
<foreach collection="discountRuleList" index="index" item="discountRule" separator="," open="" close="">
(#{discountRule.discNo,jdbcType=VARCHAR}, #{discountRule.discRuleNo,jdbcType=VARCHAR}, #{discountRule.discRuleName,jdbcType=VARCHAR},
#{discountRule.discTerminalRes,jdbcType=INTEGER},
#{discountRule.discPayType,jdbcType=INTEGER}, #{discountRule.disCarType,jdbcType=INTEGER}, #{discountRule.discValue,jdbcType=VARCHAR},
#{discountRule.isTLimit,jdbcType=INTEGER}, #{discountRule.effDate,jdbcType=TIME}, #{discountRule.expDate,jdbcType=TIME},
#{discountRule.specialDayType,jdbcType=INTEGER}, #{discountRule.remarks,jdbcType=VARCHAR}, #{discountRule.dataState,jdbcType=INTEGER},
#{discountRule.createEmpid,jdbcType=VARCHAR}, #{discountRule.createName,jdbcType=VARCHAR}, #{discountRule.createDate,jdbcType=TIMESTAMP},
#{discountRule.modifyEmpid,jdbcType=VARCHAR}, #{discountRule.modifyName,jdbcType=VARCHAR}, #{discountRule.modifyDate,jdbcType=TIMESTAMP}
)
</foreach>
</insert>
<!-- 删除折扣规则 -->
<delete id="deleteDiscountRuleByDiscNo" parameterType="java.lang.String">
delete from t_activity_discount_rule
where disc_no = #{discNo,jdbcType=VARCHAR}
</delete>
</mapper>