TVipCardParkCustRelSmapper.xml 5.11 KB
<?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>