TdBParkCardCouponsSMapper.xml
3.04 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
<?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.TdBParkCardCouponsSMapper" >
<resultMap id="BaseResultMap" type="com.zteits.pay.domain.TdBParkCardCoupons" >
<id column="id" property="id" jdbcType="BIGINT" />
<result column="park_id" property="parkId" jdbcType="VARCHAR" />
<result column="goods_big_type" property="goodsBigType" jdbcType="INTEGER" />
<result column="goods_type" property="goodsType" jdbcType="INTEGER" />
<result column="goods_type_remark" property="goodsTypeRemark" jdbcType="VARCHAR" />
<result column="goods_amount" property="goodsAmount" jdbcType="DECIMAL" />
<result column="eff_date" property="effDate" jdbcType="TIMESTAMP" />
<result column="exp_date" property="expDate" jdbcType="TIMESTAMP" />
<result column="goods_state" property="goodsState" jdbcType="BIGINT" />
<result column="data_state" property="dataState" jdbcType="INTEGER" />
<result column="create_empid" property="createEmpid" jdbcType="VARCHAR" />
<result column="create_date" property="createDate" jdbcType="TIMESTAMP" />
<result column="modfiy_empid" property="modfiyEmpid" jdbcType="VARCHAR" />
<result column="modfiy_date" property="modfiyDate" jdbcType="TIMESTAMP" />
</resultMap>
<sql id="Base_Column_List" >
id, park_id, goods_big_type, goods_type, goods_type_remark, goods_amount, eff_date,
exp_date, goods_state, data_state, create_empid, create_date, modfiy_empid, modfiy_date
</sql>
<select id="selectByParkIds" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from td_b_park_card_coupons
<where>
park_id IN
<foreach collection="parkIds" open="(" close=")"
item="parkId" separator=",">
#{parkId}
</foreach>
</where>
</select>
<select id="selectByParkId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from td_b_park_card_coupons
<where>
park_id = #{parkId,jdbcType=VARCHAR}
</where>
</select>
<select id="selectGoodTypesByParkId" resultType="java.util.HashMap">
SELECT
t.id as parkCardId,
t.goods_amount goodsAmount,
t.park_id AS parkId,
t.goods_type goodstype,
t.goods_type_remark goodsTypeRemark,
CASE
WHEN t.goods_type IN ('20', '21') THEN
'year'
ELSE
'month'
END AS 'goodsTypes'
FROM
td_b_park_card_coupons t
WHERE
data_state = 1
AND goods_state = 1
AND goods_big_type = 2
AND t.park_id = #{parkId,jdbcType=VARCHAR}
</select>
<select id="queryParkVipCard" resultType="java.util.HashMap">
SELECT
t.park_id as parkId,
max(
CASE
WHEN t.goods_type IN ('20', '21') THEN
'year' else '' end
) 'year',
max(
CASE
WHEN t.goods_type IN ('22', '23') THEN
'month' else '' end
) 'month'
FROM
td_b_park_card_coupons t
WHERE
data_state = 1
AND goods_state = 1
and goods_big_type = 2
<!-- //and t.park_id = #{parkId,jdbcType=VARCHAR}
--> GROUP BY t.park_id
</select>
</mapper>