<?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.xzx.gc.pay.mapper.PartnerAccountMapper">  
 | 
  <resultMap id="BaseResultMap" type="com.xzx.gc.entity.PartnerAccount">  
 | 
    <!--  
 | 
      WARNING - @mbg.generated  
 | 
    -->  
 | 
    <id column="id" jdbcType="INTEGER" property="id" />  
 | 
    <result column="user_id" jdbcType="VARCHAR" property="userId" />  
 | 
    <result column="account" jdbcType="VARCHAR" property="account" />  
 | 
    <result column="hbb" jdbcType="VARCHAR" property="hbb" />  
 | 
    <result column="del_flag"  property="delFlag" />  
 | 
    <result column="update_time" jdbcType="VARCHAR" property="updateTime" />  
 | 
    <result column="partner_id" jdbcType="VARCHAR" property="partnerId" />  
 | 
  </resultMap>  
 | 
  
 | 
    <select id="getPartnerAccountByUserId"   resultType="com.xzx.gc.model.admin.PartnerAccountModel">  
 | 
        select * from xzx_partner_account where user_id=#{userId} and del_flag=0  
 | 
    </select>  
 | 
  
 | 
  <update id="updatePartnerAccount">  
 | 
    update xzx_partner_account set  
 | 
    hbb=#{hbb}  
 | 
    <if test="overdraftLimit != null and overdraftLimit != ''">  
 | 
      , overdraft_limit=#{overdraftLimit}  
 | 
    </if>  
 | 
    where user_id=#{userId}  
 | 
  </update>  
 | 
  
 | 
  <update id="updateParterAccountMoney">  
 | 
    UPDATE xzx_partner_account  
 | 
    SET  
 | 
      hbb = #{money}  
 | 
    WHERE account = #{accountId}  
 | 
  </update>  
 | 
  
 | 
    <select id="queryPartnerByAccountId" resultType="com.xzx.gc.model.admin.AccountMoneyModel">  
 | 
        select * from  xzx_partner_account where account=#{accountId}  
 | 
    </select>  
 | 
  
 | 
  <update id="updateReduceMoneyLimitByAccountId">  
 | 
    update xzx_partner_account  
 | 
    <trim prefix="set" suffixOverrides=",">  
 | 
      <if test="money != null">  
 | 
        hbb=cast(hbb as decimal(9,2))-#{money},  
 | 
      </if>  
 | 
      <if test="overdraftLimit != null">  
 | 
        overdraft_limit=cast(overdraft_limit as decimal(9,2))-#{overdraftLimit} ,  
 | 
      </if>  
 | 
    </trim>  
 | 
    where  account=#{accountId} and del_flag=0  
 | 
  </update>  
 | 
  
 | 
  <update id="updateReduceMoneyResetLimitByAccountId">  
 | 
    update xzx_partner_account set overdraft_limit='0.00'  
 | 
    <if test="money != null">  
 | 
      ,hbb=cast(hbb as decimal(9,2))-#{money}  
 | 
    </if>  
 | 
    where  account=#{accountId} and del_flag=0  
 | 
  </update>  
 | 
  
 | 
  
 | 
  <update id="updateReduceMoneyByAccountId">  
 | 
    update xzx_partner_account set hbb=cast(hbb as decimal(9,2))-#{money}  
 | 
    where  account=#{accountId} and del_flag=0  
 | 
  </update>  
 | 
  
 | 
  <update id="updateReduceMoneyByPartnerId">  
 | 
    update xzx_partner_account set hbb=cast(hbb as decimal(9,2))-#{money}  
 | 
    where  partner_id=#{partnerId}  and del_flag=0  
 | 
  </update>  
 | 
  
 | 
    <update id="updateAddMoneyLimitByAccountId">  
 | 
        update xzx_partner_account  
 | 
        <trim prefix="set" suffixOverrides=",">  
 | 
            <if test="money != null">  
 | 
                hbb=cast(hbb as decimal(9,2))+#{money},  
 | 
            </if>  
 | 
            <if test="overdraftLimit != null">  
 | 
                overdraft_limit=cast(overdraft_limit as decimal(9,2))+#{overdraftLimit},  
 | 
            </if>  
 | 
        </trim>  
 | 
        where  account=#{accountId} and del_flag=0  
 | 
    </update>  
 | 
  
 | 
    <update id="updateAddMoneyResetFixLimitByAccountId">  
 | 
        update xzx_partner_account set overdraft_limit=#{overdraftLimit}  
 | 
        <if test="money != null">  
 | 
            ,hbb=cast(hbb as decimal(9,2))+#{money}  
 | 
        </if>  
 | 
        where  account=#{accountId} and del_flag=0  
 | 
    </update>  
 | 
  
 | 
    <update id="updateAddMoneyByPartnerId">  
 | 
        update xzx_partner_account set hbb=cast(hbb as decimal(9,2))+#{money}  
 | 
        where  partner_id=#{partnerId} and del_flag=0  
 | 
    </update>  
 | 
  
 | 
  
 | 
</mapper> 
 |