TdCBatteryRechargeCardSMapper.xml 5.06 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.pay.mapper.smapper.TdCBatteryRechargeCardSMapper">
  <resultMap id="BaseResultMap" type="com.zteits.pay.domain.TdCBatteryRechargeCard">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="card_no" jdbcType="VARCHAR" property="cardNo" />
    <result column="cust_id" jdbcType="VARCHAR" property="custId" />
    <result column="user_phone" jdbcType="VARCHAR" property="userPhone" />
    <result column="card_charge_type" jdbcType="INTEGER" property="cardChargeType" />
    <result column="card_state" jdbcType="INTEGER" property="cardState" />
    <result column="org_id" jdbcType="BIGINT" property="orgId" />
    <result column="remark" jdbcType="VARCHAR" property="remark" />
    <result column="data_state" jdbcType="INTEGER" property="dataState" />
    <result column="create_empid" jdbcType="VARCHAR" property="createEmpid" />
    <result column="create_emp_name" jdbcType="VARCHAR" property="createEmpName" />
    <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
    <result column="modfiy_empid" jdbcType="VARCHAR" property="modfiyEmpid" />
    <result column="modfiy_emp_name" jdbcType="VARCHAR" property="modfiyEmpName" />
    <result column="modfiy_date" jdbcType="TIMESTAMP" property="modfiyDate" />
  </resultMap>
  <sql id="Base_Column_List">
    id, card_no, cust_id, user_phone, card_charge_type, card_state, org_id, remark, data_state, 
    create_empid, create_emp_name, create_date, modfiy_empid, modfiy_emp_name, modfiy_date
  </sql>

  <resultMap id="BaseResultMapDto" type="com.zteits.clouds.api.dto.pay.dto.battery.TdCBatteryRechargeCardDTO">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="card_no" jdbcType="VARCHAR" property="cardNo" />
    <result column="cust_id" jdbcType="VARCHAR" property="custId" />
    <result column="user_phone" jdbcType="VARCHAR" property="userPhone" />
    <result column="card_charge_type" jdbcType="INTEGER" property="cardChargeType" />
    <result column="card_state" jdbcType="INTEGER" property="cardState" />
    <result column="org_id" jdbcType="BIGINT" property="orgId" />
    <result column="remark" jdbcType="VARCHAR" property="remark" />
    <result column="data_state" jdbcType="INTEGER" property="dataState" />
    <result column="create_empid" jdbcType="VARCHAR" property="createEmpid" />
    <result column="create_emp_name" jdbcType="VARCHAR" property="createEmpName" />
    <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
    <result column="modfiy_empid" jdbcType="VARCHAR" property="modfiyEmpid" />
    <result column="modfiy_emp_name" jdbcType="VARCHAR" property="modfiyEmpName" />
    <result column="modfiy_date" jdbcType="TIMESTAMP" property="modfiyDate" />
    <result column="acct_id" jdbcType="DECIMAL" property="acctId" />
    <result column="acct_balance" jdbcType="DECIMAL" property="acctBalance" />
  </resultMap>


  <select id="queryTdCBatteryRechargeCard" resultMap="BaseResultMapDto" parameterType="com.zteits.clouds.api.dto.pay.param.battery.TdCBatteryRechargeCardRequest">
    select
    br.id, br.card_no, br.cust_id, br.user_phone, br.card_charge_type, br.card_state, br.org_id, br.remark, br.data_state,
    br.create_empid, br.create_emp_name, br.create_date, br.modfiy_empid, br.modfiy_emp_name, br.modfiy_date,
    ap.acct_id, ifnull(ap.acct_balance,0) acct_balance
    from td_c_battery_recharge_card br left join td_c_acct_person ap on br.card_no = ap.cust_id and ap.acct_type = 12 and ap.data_state = 1
    where br.data_state = 1
    <if test="cardNo != null and cardNo != ''">
      and br.card_no = #{cardNo,jdbcType=VARCHAR}
    </if>
    <if test="custId != null and custId != ''">
      and br.cust_id = #{custId,jdbcType=VARCHAR}
    </if>
    <if test="userPhone != null and userPhone != ''">
      and br.user_phone = #{userPhone,jdbcType=VARCHAR}
    </if>
    <if test="cardChargeType != null">
      and br.card_charge_type = #{cardChargeType,jdbcType=INTEGER}
    </if>
    <if test="cardState != null">
      and br.card_state = #{cardState,jdbcType=INTEGER}
    </if>
    <if test="orgId != null">
      and br.org_id = #{orgId,jdbcType=BIGINT}
    </if>

  </select>

  <select id="queryBatteryRechargeCardByCardNo" resultMap="BaseResultMapDto"
          parameterType="com.zteits.clouds.api.dto.pay.param.battery.BatteryRechargeCardByCardNoRequest">
    select
    br.id, br.card_no, br.cust_id, br.user_phone, br.card_charge_type, br.card_state, br.org_id, br.remark, br.data_state,
    br.create_empid, br.create_emp_name, br.create_date, br.modfiy_empid, br.modfiy_emp_name, br.modfiy_date,
    ap.acct_id, ifnull(ap.acct_balance,0) acct_balance
    from td_c_battery_recharge_card br left join td_c_acct_person ap on br.card_no = ap.cust_id and ap.acct_type = 12 and ap.data_state = 1
    where br.data_state = 1
      and br.card_no = #{cardNo,jdbcType=VARCHAR}
    <if test="orgId != null">
      and br.org_id = #{orgId,jdbcType=BIGINT}
    </if>
    limit 0,1
  </select>



</mapper>