TVipCardCustSubPlateInfoSMapper.xml 4.25 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.TVipCardCustSubPlateInfoSMapper">
    <resultMap id="BaseResultMap" type="com.zteits.bill.domain.TVipCardCustSubPlateInfo">
        <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="card_no" jdbcType="VARCHAR" property="cardNo" />
        <result column="car_number" jdbcType="VARCHAR" property="carNumber" />
        <result column="card_type" jdbcType="INTEGER" property="cardType" />
        <result column="order_state" jdbcType="INTEGER" property="orderState" />
        <result column="park_in_time" jdbcType="TIMESTAMP" property="parkInTime" />
        <result column="park_out_time" jdbcType="TIMESTAMP" property="parkOutTime" />
        <result column="data_state" jdbcType="INTEGER" property="dataState" />
        <result column="eff_date" jdbcType="TIMESTAMP" property="effDate" />
        <result column="exp_date" jdbcType="TIMESTAMP" property="expDate" />
        <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="org_id" jdbcType="BIGINT" property="orgId" />
    </resultMap>

    <!-- 更新入场状态以及时间 -->
    <update id="updateSubPlateParkInInfo">
        update t_vip_card_cust_sub_plate_info
        set order_state = 10,
            park_in_time = #{parkInTime}
        where pl_no = #{plNo}
          and car_number = #{carNumber}
    </update>
    <!-- 更新出场状态以及时间 -->
    <update id="updateSubPlateParkOutInfo">
        update t_vip_card_cust_sub_plate_info
        set order_state = 20,
            park_in_time = null
        where pl_no = #{plNo}
          and car_number = #{carNumber}
    </update>

    <!-- 获取有效期内的子母车列表信息 -->
    <select id="querySubPlateInfoList" resultMap="BaseResultMap">
        select t.pl_no,t.card_no,t.car_number,t.card_type,t.order_state,t.park_in_time from t_vip_card_cust_sub_plate_info t
        where t.card_no = #{cardNo}
    </select>

    <!-- 根据车牌获取对应固定车的信息 -->
    <select id="querySubPlateCardInfo" resultType="com.zteits.bill.domain.TVipCardCustSubPlateInfo">
        select
         a.card_no as cardNo,
         a.car_number as carNumber,
         a.card_type as cardType,
         a.order_state as orderState,
         a.park_in_time as parkInTime,
         a.park_out_time as parkOutTime,
         a.data_state as dataState,
         i.effect_time as effDate,
         i.expire_time as expDate

         from t_vip_card_cust_sub_plate_info a
        left join td_cl_sub_card_info i
        on a.card_no = i.card_no
        where a.card_no = (
            select t.card_no from t_vip_card_cust_sub_plate_info t
            where  t.pl_no = #{plNo}
              and  t.car_number = #{carNumber}
              and  t.data_state = 1
              limit 1
        )
          and i.id > 0
          and card_type = 0
          and data_state = 1
          and i.effect_time &lt;= now()
          and i.expire_time >= now()
          and i.card_status != 0
          limit 1

    </select>

    <!--  根据停车场编号,车牌号码获取某个车子母车中作为固定车的信息列表 -->
    <select id="queryVipCardCustInfoByCarNumber" resultType="com.zteits.bill.domain.TVipCardCustSubPlateInfo">
         select
         i.effect_time as effDate,
         i.expire_time as expDate
         from t_vip_card_cust_sub_plate_info a
        LEFT JOIN td_cl_sub_card_info i on a.card_no = i.card_no
        where a.card_type = 0
          and a.data_state = 1
          and a.car_number = #{carNumber}
          and a.pl_no = #{plNo}
    </select>

</mapper>