Blame view

parking-module-bill/src/main/resources/mybatis/smapper/TVipCardParkCustRelSmapper.xml 5.11 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
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
  <?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.TVipCardParkCustRelSmapper">
    <resultMap id="BaseResultMap" type="com.zteits.bill.domain.TVipCardParkCustRel">
      <id column="id" jdbcType="BIGINT" property="id" />
      <result column="cust_id" jdbcType="VARCHAR" property="custId" />
      <result column="cust_card_no" jdbcType="VARCHAR" property="custCardNo" />
      <result column="pl_no" jdbcType="VARCHAR" property="plNo" />
      <result column="car_number" jdbcType="VARCHAR" property="carNumber" />
      <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" />
      <result column="push_state" jdbcType="INTEGER" property="pushState" />
      <result column="card_buy_type" jdbcType="INTEGER" property="cardBuyType" />
  
    </resultMap>
    <sql id="Base_Column_List">
      id, cust_id, cust_card_no, pl_no, car_number, data_state, create_empid, create_name, 
      create_date, modify_empid, modify_name, modify_date, push_state, card_buy_type,record_no
    </sql>
    
    <select id="queryVipCardParkCustRelByCustId" parameterType="java.lang.String" 
    resultMap="BaseResultMap">
    	select 
    	<include refid="Base_Column_List"></include>
    	from t_vip_card_park_cust_rel
    	where data_state=1
    	and cust_id =#{custId}
    </select>
    
    <select id="queryVipCardParkCustRelByCustIds" parameterType="java.util.List" 
    resultMap="BaseResultMap">
    	select 
    	<include refid="Base_Column_List"></include>
    	from t_vip_card_park_cust_rel
    	where data_state=1 and cust_id in 
   	<foreach collection="custIds" index="index" item="custId" separator="," open="(" close=")">
           #{custId}
      </foreach>
    	
    </select>
    
    <!-- 批量保存人用户购买会员卡适用停车场记录 -->
    <insert id="batchSaveVipCardParkCustRel" >
      <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
        SELECT LAST_INSERT_ID()
      </selectKey>
       insert into t_vip_card_park_cust_rel (cust_id, cust_card_no, pl_no, 
        car_number, data_state, create_empid, 
        create_name, create_date, modify_empid, 
        modify_name, modify_date, push_state, 
        card_buy_type)
      values 
       <foreach collection="cardParkCustRelList" item="item" index="index" separator=",">
         (#{item.custId,jdbcType=VARCHAR}, #{item.custCardNo,jdbcType=VARCHAR}, #{item.plNo,jdbcType=VARCHAR},
        #{item.carNumber,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},#{item.pushState,jdbcType=INTEGER},#{item.cardBuyType,jdbcType=INTEGER})
       </foreach>
       
    </insert>
    <!-- 更新用户购买会员卡适用停车场记录 -->
    <update id="updateVipCardParkCustRelByCustCardId" parameterType="com.zteits.bill.domain.TVipCardParkCustRel">
      update t_vip_card_park_cust_rel
      <set>
        <if test="custId != null">
          cust_id = #{custId,jdbcType=VARCHAR},
        </if>
        <if test="custCardNo != null">
          cust_card_no = #{custCardNo,jdbcType=VARCHAR},
        </if>
        <if test="plNo != null">
          pl_no = #{plNo,jdbcType=VARCHAR},
        </if>
        <if test="carNumber != null">
          car_number = #{carNumber,jdbcType=VARCHAR},
        </if>
        <if test="dataState != null">
          data_state = #{dataState,jdbcType=INTEGER},
        </if>
        <if test="createEmpid != null">
          create_empid = #{createEmpid,jdbcType=BIGINT},
        </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=BIGINT},
        </if>
        <if test="modifyName != null">
          modify_name = #{modifyName,jdbcType=VARCHAR},
        </if>
        <if test="modifyDate != null">
          modify_date = #{modifyDate,jdbcType=TIMESTAMP},
        </if>
        <if test="pushState != null">
          push_state = #{pushState,jdbcType=INTEGER},
        </if>
        <if test="cardBuyType != null">
          card_buy_type = #{cardBuyType,jdbcType=INTEGER},
        </if>
      </set>
      where cust_card_no = #{custCardNo,jdbcType=VARCHAR}
    </update>
    
    <select id="queryByCustCardNo" parameterType="java.lang.String" 
      resultMap="BaseResultMap">
      select 
      <include refid="Base_Column_List"></include>
      from t_vip_card_park_cust_rel
      where data_state=1
      and cust_card_no = #{custCardNo}
    </select>
  </mapper>