Blame view

parking-module-pay/src/main/resources/mybatis/smapper/TdCBatteryRechargeCardSMapper.xml 5.06 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
  <?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>