TdBParkCardSMapper.xml
4.86 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
<?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.pay.mapper.smapper.TdBParkCardSMapper" >
<resultMap id="BaseResultMap" type="com.zteits.pay.domain.TdBParkCard" >
<id column="id" property="id" jdbcType="BIGINT" />
<result column="card_no" property="cardNo" jdbcType="VARCHAR" />
<result column="pl_no" property="plNo" jdbcType="VARCHAR" />
<result column="card_name" property="cardName" jdbcType="VARCHAR" />
<result column="car_type" property="carType" jdbcType="INTEGER" />
<result column="card_type" property="cardType" jdbcType="INTEGER" />
<result column="valid_unit" property="validUnit" jdbcType="INTEGER" />
<result column="valid_num" property="validNum" jdbcType="INTEGER" />
<result column="price" property="price" jdbcType="BIGINT" />
<result column="eff_date" property="effDate" jdbcType="TIMESTAMP" />
<result column="exp_date" property="expDate" jdbcType="TIMESTAMP" />
<result column="card_status" property="cardStatus" jdbcType="INTEGER" />
<result column="data_state" property="dataState" jdbcType="INTEGER" />
<result column="create_empid" property="createEmpid" jdbcType="BIGINT" />
<result column="create_date" property="createDate" jdbcType="TIMESTAMP" />
<result column="modify_empid" property="modifyEmpid" jdbcType="BIGINT" />
<result column="modify_date" property="modifyDate" jdbcType="TIMESTAMP" />
</resultMap>
<resultMap id="ResultMapWithBLOBs" type="com.zteits.pay.domain.TdBParkCard" extends="BaseResultMap" >
<result column="remark" property="remark" jdbcType="LONGVARCHAR" />
</resultMap>
<sql id="Base_Column_List" >
id, card_no, card_name, car_type, card_type, valid_unit, valid_num, price, eff_date,
exp_date, card_status, data_state, create_empid, create_date, modify_empid, modify_date
</sql>
<sql id="Blob_Column_List" >
remark
</sql>
<!-- 根据停车场中的会员卡编码查询会员卡类型 -->
<select id="queryParkVipCard" resultType="java.util.HashMap" >
SELECT
max(
CASE
WHEN card_type IN ('1') THEN
'year'
ELSE
''
END
) 'year',
max(
CASE
WHEN card_type IN ('2') THEN
'halfYear'
ELSE
''
END
) 'halfYear',
max(
CASE
WHEN card_type IN ('3') THEN
'season'
ELSE
''
END
) 'season',
max(
CASE
WHEN card_type IN ('4') THEN
'month'
ELSE
''
END
) 'month',
max(
CASE
WHEN card_type IN ('5') THEN
'day'
ELSE
''
END
) 'day'
FROM
`td_b_park_card`
WHERE 1=1
and data_state = 1
and card_status = 1
and card_no IN
<foreach collection="cardNos" open="(" close=")" item="cardNo"
separator=",">
#{cardNo}
</foreach>
</select>
<!-- 根据停车场中的会员卡编码查询会员卡类型 -->
<select id="queryParkVipCardByPlNo" resultMap="ResultMapWithBLOBs" >
SELECT
a.card_no,
a.card_name,
a.car_type,
a.card_type,
a.price,
a.eff_date,
a.exp_date,
b.pl_no
FROM
td_b_park_card a,
td_b_park_card_rel b
WHERE
a.card_no = b.card_no
AND b.data_state = 1
AND (b.total_num -b.sell_num) > 0 <!-- (当前停车场该卡发售总量 - 当前停车场该卡已售数量) > 0 -->
and a.card_status =1
<if test="plNo != null">
AND b.pl_no = #{plNo}
</if>
order by card_type
</select>
<!-- 根据会员卡编号查询会员卡详情 -->
<select id="queryParkCardDetail" resultMap="ResultMapWithBLOBs" >
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from td_b_park_card
WHERE 1=1
and data_state = 1
and card_status = 1
and card_no IN
<foreach collection="cardNos" open="(" close=")" item="cardNo"
separator=",">
#{cardNo}
</foreach>
</select>
<!-- 根据会员卡编号查询会员卡详情 -->
<select id="queryCardDetailByCardNo" resultMap="ResultMapWithBLOBs" >
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from td_b_park_card
WHERE 1=1
and data_state = 1
and card_status = 1
and card_no = #{cardNo}
</select>
<!-- 查询所有会员卡-供前台下拉框使用 -->
<select id="queryParkVipCardByPlNos" resultMap="BaseResultMap">
select a.card_no,
a.card_name
from td_b_park_card a ,td_b_park_card_rel b
where a.data_state=1
and a.card_no = b.card_no
<if test="plNos != null and plNos.size > 0 ">
and b.pl_no in
<foreach collection="plNos" item="plNo" open="(" close=")" separator=",">
#{plNo}
</foreach>
</if>
group by a.card_no,a.card_name
</select>
<select id="queryParkNo" resultMap="ResultMapWithBLOBs" >
SELECT DISTINCT
pl_no
FROM
td_b_park_card_rel
</select>
</mapper>