TVipCardParkSaleRelSmapper.xml
6.06 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
<?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.TVipCardParkSaleRelSmapper">
<resultMap id="BaseResultMap" type="com.zteits.bill.domain.TVipCardParkSaleRel">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="pl_no" jdbcType="VARCHAR" property="plNo" />
<result column="card_no" jdbcType="VARCHAR" property="cardNo" />
<result column="total_num" jdbcType="INTEGER" property="totalNum" />
<result column="sell_num" jdbcType="INTEGER" property="sellNum" />
<result column="price" jdbcType="BIGINT" property="price" />
<result column="disc_no" jdbcType="VARCHAR" property="discNo" />
<result column="disc_rule_no" jdbcType="VARCHAR" property="discRuleNo" />
<result column="disc_value" jdbcType="VARCHAR" property="discValue" />
<result column="data_state" jdbcType="INTEGER" property="dataState" />
<result column="create_empid" jdbcType="BIGINT" property="createEmpid" />
<result column="create_name" jdbcType="VARCHAR" property="createName" />
<result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
<result column="modify_empid" jdbcType="BIGINT" 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, pl_no, card_no, total_num, sell_num, price, disc_no, disc_rule_no, disc_value,
data_state, create_empid, create_name, create_date, modify_empid, modify_name, modify_date
</sql>
<!-- 通过卡编码查询停车场与会员卡售卖关联关系 2017年10月31日 langlw -->
<select id="queryVipCardParkSaleRelForListByCardNo" parameterType="com.zteits.bill.domain.TVipCardParkSaleRel"
resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from t_vip_card_park_sale_rel
where data_state=1
<if test="cardNo !=null ">
and card_no =#{cardNo}
</if>
</select>
<select id="queryVipCardParkSaleRelForListByCardNos" parameterType="java.util.List"
resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from t_vip_card_park_sale_rel
where data_state=1
<if test="cardNos !=null and cardNos.size>0 ">
and card_no in
<foreach collection="cardNos" item="item" index="index" separator="," open="(" close=")">
#{item,jdbcType=VARCHAR}
</foreach>
</if>
</select>
<select id="querySaleVIPCardRuleForPage" parameterType="java.util.List" resultMap="BaseResultMap">
SELECT
b.pl_no,
b.card_no,
b.total_num,
b.sell_num,
b.price,
b.disc_no,
b.disc_rule_no,
b.disc_value,
b.data_state
FROM
t_vip_card a,
t_vip_card_park_sale_rel b
where a.data_state =1
and a.card_no=b.card_no
<if test="cardType != null ">
and a.card_type = #{cardType} /**卡类型 1-年卡;2-半年卡;3-季卡;4-月卡;5-日卡;*/
</if>
<if test="carType != null">
and a.car_type =#{carType} /**1-大型车;2-小型车*/
</if>
<if test="cardStatus != null ">
and a.card_status=#{cardStatus} /**商品状态:1、上架;2、下架*/
</if>
<if test="cardNo != null and cardNo !=''">
and a.card_no=#{cardNo}
</if>
<if test="saleChannel != null and saleChannel !=''">
and a.sale_channel=#{saleChannel}
</if>
<if test="plNos != null and plNos.size >0">
and b.pl_no in
<foreach collection="plNos" open="(" close=")" item="parkId" separator=",">
#{parkId}
</foreach>
</if>
GROUP BY b.pl_no
</select>
<!-- 批量插入会员卡停车场售卖关系 -->
<insert id="batchInsertCardParkSale">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into t_vip_card_park_sale_rel (pl_no, card_no, total_num,
sell_num, price, disc_no,
disc_rule_no, disc_value, data_state,
create_empid, create_name, create_date,
modify_empid, modify_name, modify_date
)
values
<foreach collection="cardParkSaleRelList" item="item" index="index" separator=",">
(#{item.plNo,jdbcType=VARCHAR}, #{item.cardNo,jdbcType=VARCHAR}, #{item.totalNum,jdbcType=INTEGER},
#{item.sellNum,jdbcType=INTEGER}, #{item.price,jdbcType=BIGINT}, #{item.discNo,jdbcType=VARCHAR},
#{item.discRuleNo,jdbcType=VARCHAR}, #{item.discValue,jdbcType=VARCHAR}, #{item.dataState,jdbcType=INTEGER},
#{item.createEmpid,jdbcType=BIGINT}, #{item.createName,jdbcType=VARCHAR}, #{item.createDate,jdbcType=TIMESTAMP},
#{item.modifyEmpid,jdbcType=BIGINT}, #{item.modifyName,jdbcType=VARCHAR}, #{item.modifyDate,jdbcType=TIMESTAMP}
)
</foreach>
</insert>
<!--通过会员卡编码删除售卖关系-->
<delete id="deleteCardParkSaleByCardNo" parameterType="java.lang.String">
delete from t_vip_card_park_sale_rel
where card_no = #{cardNo}
</delete>
<select id="queryPlNoList" resultType="java.lang.String" parameterType="com.zteits.clouds.api.dto.bill.vipcard.param.QueryVipCardByPlNoRequest">
select DISTINCT
c.pl_no
from t_vip_card a,
(select c.pl_no,c.card_no
from t_vip_card_park_sale_rel c
where c.data_state= 1
group by c.pl_no,c.card_no
)c
where a.card_no=c.card_no
and a.data_state=1
and a.sale_channel = 1
<if test="orgId != null">
and a.org_id = #{orgId,jdbcType=BIGINT}
</if>
</select>
<!--通过停车场编码及卡编码查询会员卡规则售卖关系-->
<select id="queryCardParkSaleByPlNoAndCardNo" resultMap="BaseResultMap" parameterType="com.zteits.clouds.api.dto.bill.vipcard.param.QueryCardParkSaleByPlNoAndCardNoReq">
select
<include refid="Base_Column_List" />
from t_vip_card_park_sale_rel
where data_state=1
<if test="cardNo !=null ">
and card_no =#{cardNo}
</if>
<if test="plNo !=null ">
and pl_no =#{plNo}
</if>
</select>
</mapper>