<?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.AccountMapper"> 
 | 
  
 | 
    <resultMap id="AccountMap" type="com.xzx.gc.model.admin.UserAccountModel"> 
 | 
        <result column="account_id" jdbcType="VARCHAR" property="accountId"/> 
 | 
        <result column="account_name" jdbcType="VARCHAR" property="accountName"/> 
 | 
        <result column="user_id" jdbcType="VARCHAR" property="userId"/> 
 | 
        <result column="pay_password" jdbcType="VARCHAR" property="payPassword"/> 
 | 
        <result column="freeze_money" jdbcType="VARCHAR" property="freezeMoney"/> 
 | 
        <result column="withdraw_money" jdbcType="VARCHAR" property="withdrawMoney"/> 
 | 
        <result column="overdraft_limit" jdbcType="VARCHAR" property="overdraftLimit"/> 
 | 
        <result column="del_flag" jdbcType="INTEGER" property="delFlag"/> 
 | 
        <result column="error_times" jdbcType="INTEGER" property="errorTimes"/> 
 | 
        <result column="last_error_time" jdbcType="VARCHAR" property="lastErrorTime"/> 
 | 
        <result column="fixed_limit" jdbcType="VARCHAR" property="fixedLimit"/> 
 | 
    </resultMap> 
 | 
  
 | 
  
 | 
    <!-- 回收员的透支金额减少 --> 
 | 
    <update id="updateLimitByOrder" parameterType="map"> 
 | 
        update xzx_account_info 
 | 
        set overdraft_limit = cast((cast(overdraft_limit as DECIMAL(9,2))+#{money}) as CHAR),update_time=now() 
 | 
        where user_id=#{userId} and del_flag=0 and is_prohibit='0' 
 | 
    </update> 
 | 
  
 | 
    <!-- 回收员的透支金额减少 --> 
 | 
    <update id="updateMoneyAndLimit" parameterType="map"> 
 | 
        update xzx_account_info 
 | 
        set money = cast((cast(money as DECIMAL(9,2))+#{money}) as CHAR), 
 | 
        overdraft_limit = cast(#{limit} as CHAR),update_time=now() 
 | 
        where user_id=#{userId} and del_flag=0 and is_prohibit='0' 
 | 
    </update> 
 | 
  
 | 
  
 | 
    <update id="updateAccountOverdrawPrice"> 
 | 
        update xzx_account_info set 
 | 
        overdraft_limit=#{newOverdrawPrice}. 
 | 
        fixed_limit=#{newOverdrawPrice} 
 | 
        where del_flag=0 and overdraft_limit=#{oldOverdrawPrice} 
 | 
        and user_id in 
 | 
        <foreach collection="orderIds" index="index" item="id" separator="," open="(" close=")"> 
 | 
            #{id} 
 | 
        </foreach> 
 | 
    </update> 
 | 
  
 | 
  
 | 
    <select id="queryAccountInfo" resultMap="AccountMap"> 
 | 
        select account_id,account_name,user_id,pay_password,money,freeze_money,withdraw_money,overdraft_limit,del_flag,error_times,last_error_time,fixed_limit from xzx_account_info where del_flag=0 
 | 
        <if test="userId != null and userId != ''"> 
 | 
            AND user_id=#{userId} 
 | 
        </if> 
 | 
        <if test="phone != null and phone != ''"> 
 | 
            AND account_name=#{phone} 
 | 
        </if> 
 | 
    </select> 
 | 
  
 | 
    <update id="updateOverdrawPriceByUserId"> 
 | 
        update xzx_account_info 
 | 
        set fixed_limit = fixed_limit + #{money}, overdraft_limit = overdraft_limit + #{money} 
 | 
        where del_flag = 0 and account_id = #{accountId} 
 | 
    </update> 
 | 
  
 | 
    <update id="updateAccountMoneyDouble"> 
 | 
        update `xzx_account_info` set money=#{money} 
 | 
        where account_id=#{accountId} 
 | 
    </update> 
 | 
  
 | 
    <update id="updateLimitByUserId"> 
 | 
        update xzx_account_info 
 | 
        set overdraft_limit = fixed_limit 
 | 
        where del_flag = 0 and account_id = #{accountId} 
 | 
    </update> 
 | 
  
 | 
    <select id="getAccountByUserId" resultType="com.xzx.gc.model.admin.UserAccountModel"> 
 | 
        select * 
 | 
        from xzx_account_info 
 | 
        where user_id = #{userId} and del_flag = 0 
 | 
    </select> 
 | 
  
 | 
    <update id="updateUserAccount"> 
 | 
        update xzx_account_info 
 | 
        set money = #{money}, overdraft_limit = #{overdraftLimit} 
 | 
        where user_id = #{userId} and del_flag = 0 
 | 
    </update> 
 | 
  
 | 
</mapper> 
 |