Blame view

parking-module-pay/src/main/resources/mybatis/smapper/TdACardCouponsSMapper.xml 3.72 KB
55f68655   王彪总   新项目
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
  <?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.TdACardCouponsSMapper" >
    <resultMap id="BaseResultMap" type="com.zteits.pay.domain.TdACardCoupons" >
      <id column="id" property="id" jdbcType="INTEGER" />
      <result column="park_card_id" property="parkCardId" jdbcType="VARCHAR" />
      <result column="cust_id" property="custId" jdbcType="VARCHAR" />
      <result column="acct_id" property="acctId" jdbcType="VARCHAR" />
      <result column="card_big_type" property="cardBigType" jdbcType="INTEGER" />
      <result column="card_type" property="cardType" jdbcType="INTEGER" />
      <result column="card_balance" property="cardBalance" jdbcType="DECIMAL" />
      <result column="card_price" property="cardPrice" jdbcType="DECIMAL" />
      <result column="card_num" property="cardNum" jdbcType="INTEGER" />
      <result column="card_total_amount" property="cardTotalAmount" jdbcType="DECIMAL" />
      <result column="eff_date" property="effDate" jdbcType="TIMESTAMP" />
      <result column="exp_date" property="expDate" jdbcType="TIMESTAMP" />
      <result column="card_scope" property="cardScope" jdbcType="VARCHAR" />
      <result column="car_number" property="carNumber" jdbcType="VARCHAR" />
      <result column="remark" property="remark" jdbcType="VARCHAR" />
      <result column="push_state" property="pushState" jdbcType="INTEGER" />
      <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_card_id, cust_id, acct_id, card_big_type, card_type, card_balance, card_price, 
      card_num, card_total_amount, eff_date, exp_date, card_scope, car_number, remark, 
      push_state, data_state, create_empid, create_date, modfiy_empid, modfiy_date
    </sql>
    <select id="queryCardCouponsByCustId" resultMap="BaseResultMap" parameterType="java.lang.String" >
      select 
      <include refid="Base_Column_List" />
      from td_a_card_coupons
      where cust_id = #{custId,jdbcType=VARCHAR}
      and data_state  = 1
      and CURDATE() &gt;= eff_date
      and CURDATE() &lt;= exp_date
    </select>
    
    
      <select id="queryCardCouponsByparkCardId" resultMap="BaseResultMap" parameterType="java.lang.String" >
      select 
      <include refid="Base_Column_List" />
      from td_a_card_coupons
      where park_card_id = #{parkardId,jdbcType=VARCHAR}
      and data_state  = 1
    </select>
    
     <select id="queryCardCouponsByCarNumbers" resultMap="BaseResultMap" >
      select 
      <include refid="Base_Column_List" />
      from td_a_card_coupons
      where car_number = #{carNumber}
      and data_state  = 1
       <![CDATA[and eff_date >= #{cardTime}]]>
      <![CDATA[and exp_date <= #{cardTime}]]>
    </select>
    
    <select id="queryPersonCardCouponsByCustId" resultType="java.util.HashMap">
  	 SELECT
  		t.id,
  		t.park_card_id AS parkCardId,
  		t.car_number AS carNumber,
  		t.park_card_id AS parkCardId,
  		t.card_price cardPrice,
  		t.card_scope AS parkId,
  		t.exp_date AS expDate,
  		b.goods_type_remark cardTypeRemark,
  		t.card_type cardType,
  		CASE
  	WHEN t.card_type IN ('20', '21') THEN
  		'1'
  	ELSE
  		'0'
  	END AS 'vipType',
  	 CASE
  	WHEN CURDATE() > t.exp_date THEN
  		"0"
  	ELSE
  		"1"
  	END AS "state"
  	FROM
  		td_a_card_coupons t,
  		td_b_park_card_coupons b
  	WHERE
  		t.data_state = 1
  	AND t.park_card_id = b.id
  	AND t.cust_id = #{custId,jdbcType=VARCHAR}
  	ORDER BY
  		t.exp_date DESC
  	
    </select>
  </mapper>