TdCAcctNoSecretSMapper.xml 3.72 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.TdCAcctNoSecretSMapper">
  <resultMap id="BaseResultMap" type="com.zteits.pay.domain.TdCAcctNoSecret">
      <id column="id" jdbcType="BIGINT" property="id" />
      <result column="cust_id" jdbcType="VARCHAR" property="custId" />
      <result column="acct_type" jdbcType="INTEGER" property="acctType" />
      <result column="acct_order" jdbcType="INTEGER" property="acctOrder" />
      <result column="data_state" jdbcType="INTEGER" property="dataState" />
      <result column="create_empid" jdbcType="VARCHAR" property="createEmpid" />
      <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
      <result column="modfiy_empid" jdbcType="VARCHAR" property="modfiyEmpid" />
      <result column="modfiy_date" jdbcType="TIMESTAMP" property="modfiyDate" />
      <result column="is_open" jdbcType="INTEGER" property="isOpen" />
  </resultMap>
   <sql id="Base_Column_List">
    id, cust_id, acct_type, acct_order, data_state, create_empid, create_date, modfiy_empid, modfiy_date, is_open
  </sql>
  
  <!-- 查询客户对应的免密支付 -->
  <select id="getAllAcctNoSecret" parameterType="com.zteits.clouds.api.dto.pay.param.TdCAcctNoSecretRequest" 
  	resultType="com.zteits.clouds.api.dto.pay.TdCAcctNoSecretDTO">
   SELECT
	a.acct_type as acctType,
	a.acct_name as acctName,
	CASE WHEN B.acct_order IS not NULL THEN B.acct_order ELSE -1 END AS acctOrder ,
	CASE WHEN B.acct_order IS not NULL THEN 1 ELSE -1 END AS  isSign,
	CASE WHEN B.is_open IS not NULL THEN B.is_open ELSE -1 END AS isOpen
	FROM
		td_c_acct_no_secret_type a LEFT JOIN 
		(SELECT *
			FROM td_c_acct_no_secret  
			where  cust_id = #{custId,jdbcType=VARCHAR}
			and data_state = 1
		)B ON a.acct_type = B.acct_type
		where a.data_state = 1
	ORDER BY B.acct_order desc 
  </select>
  
  
  <!-- 查询客户对应的免密支付 -->
  <select id="getAcctNoSecret" parameterType="com.zteits.clouds.api.dto.pay.param.TdCAcctNoSecretRequest" 
  	resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from td_c_acct_no_secret
    where cust_id = #{custId,jdbcType=VARCHAR}
    and data_state = 1
    order by acct_order
  </select>
  
  
  <!-- 关闭免密支付 -->
  <delete id="deleteAcctNoSecretBindAcctType" parameterType="com.zteits.pay.domain.TdCAcctNoSecret">
    UPDATE td_c_acct_no_secret
    set  data_state = 0
    where cust_id = #{custId,jdbcType=VARCHAR}
    and  acct_type = #{acctType,jdbcType=INTEGER}
  </delete>
  
  <update id="updateAcctNoSecretBindAcctType"  parameterType="java.util.List">  
    update td_c_acct_no_secret
    set  acct_order = 
    <foreach collection="list" item="item" index="index"  open=" case acct_type"  close=" end " separator=" ">
         when #{item.acctType}
         then #{item.acctOrder}
    </foreach>
    , modfiy_empid = 
    <foreach collection="list" item="item" index="index"  open=" case acct_type"  close=" end " separator=" ">
         when #{item.acctType}
         then #{item.modfiyEmpid}
    </foreach>  
    , modfiy_date = 
    <foreach collection="list" item="item" index="index"  open=" case acct_type"  close=" end " separator=" ">
         when #{item.acctType}
         then #{item.modfiyDate}
    </foreach> 
    where  cust_id = 
    <foreach collection="list" item="item" index="index"  open=""  close="" separator=" ">
    	<if test="index == 0">
         #{item.custId}
         </if>
    </foreach>
    and  acct_type in 
    <foreach collection="list" item="item" index="index"  open="("  close=")" separator=",">
         #{item.acctType}
    </foreach>
    and data_state = 1
  </update>
</mapper>