| <?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.order.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>  | 
|   | 
|   | 
|   | 
|   <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="updateAddMoneyByPartnerId">  | 
|         update xzx_partner_account set hbb=cast(hbb as decimal(9,2))+#{money}  | 
|         where  partner_id=#{partnerId} and del_flag=0  | 
|     </update>  | 
|   | 
|     <select id="queryAccountIdByUserId" resultType="com.xzx.gc.model.admin.PartnerAccountModel">  | 
|         select *  | 
|         from xzx_partner_account  | 
|         where user_id = #{userId} and del_flag = 0  | 
|         limit 1  | 
|     </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>  | 
|   | 
|     <insert id="addPartnerAccountLog">  | 
|         INSERT INTO `xzx_partner_account_log` (`account_id`, `flow_no`, `type`, `create_time`,  | 
|                                                `money`, `account_money`, `hbb`, `user_name`, `user_phone`, `role_name`, `approver_status`, `del_flag`, `old_limit`, `manage_limit`, `new_limit`, `old_limit_fix`, `manage_limit_fix`, `new_limit_fix`)  | 
|         VALUES (#{accountId}, #{flowNo}, #{type}, #{createTime}, #{money},  | 
|                               #{accountMoney}, #{hbb}, #{userName}, #{userPhone}, #{roleName}, #{approverStatus},  | 
|                 #{delFlag}, #{oldLimit}, #{manageLimit}, #{newLimit}, #{oldLimitFix}, #{manageLimitFix}, #{newLimitFix})  | 
|     </insert>  | 
|   | 
|     <insert id="addPartnerAccount">  | 
|         INSERT INTO xzx_partner_account (`user_id`, `account`, `hbb`, `del_flag`, `update_time`, `partner_id`, `overdraft_limit`, `fixed_limit`, `type`)  | 
|         VALUES (#{userId}, #{account}, '0', '0', #{updateTime}, #{partnerId}, '0', '0', #{type})  | 
|     </insert>  | 
|   | 
|     <update id="updateParterAccount">  | 
|         UPDATE xzx_partner_account  | 
|         SET  | 
|             hbb = #{money}  | 
|         WHERE account = #{accountId}  | 
|     </update>  | 
|   | 
|     <select id="getPartnerAccountByUserId" resultType="com.xzx.gc.model.admin.PartnerAccountModel">  | 
|         select *  | 
|         from xzx_partner_account  | 
|         where user_id = #{userId} and del_flag = 0  | 
|     </select>  | 
|   | 
| </mapper> |