| <?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.AccountMapper"> | 
|   | 
|     <resultMap id="AccountMap" type="com.xzx.gc.model.user.AccountVo"> | 
|         <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="lock_time" jdbcType="VARCHAR" property="lockTime"/> | 
|         <result column="fixed_limit"  property="fixedLimit"/> | 
|         <result column="adjust_flag"  property="adjustFlag"/> | 
|     </resultMap> | 
|   | 
|     <!-- 回收员支付环保金  订单创建人入账 --> | 
|     <update id="updateMyMoneyByOrder" parameterType="map"> | 
|         update xzx_account_info | 
|         set money = cast((cast(money 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="updateMyScoreByOrder" parameterType="map"> | 
|         update xzx_account_info | 
|         set collect_score = cast((cast(collect_score 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="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> | 
|   | 
|   | 
|     <!-- 我的环保金 --> | 
|     <select id="queryMyMoney" parameterType="map" resultMap="AccountMap"> | 
|         SELECT a.account_id,a.account_name,a.freeze_money,a.money,a.pay_password, | 
|         a.withdraw_money,a.overdraft_limit,a.lock_time,a.fixed_limit,a.adjust_flag,a.user_id | 
|         FROM xzx_account_info a | 
|         where del_flag=0 and is_prohibit='0' | 
|         <if test="userId!=null and userId!=''"> | 
|             and a.user_id=#{userId} | 
|         </if> | 
|     </select> | 
|   | 
|   | 
|     <update id="updateAccountMoneyDouble"> | 
|         update `xzx_account_info` set money=#{money} | 
|         where account_id=#{accountId} | 
|     </update> | 
|   | 
|   | 
|   | 
|   | 
|   | 
|     <insert id="addCuserAccountRole"> | 
|         INSERT INTO xzx_account_info(`account_id`,`account_name`, `user_id`, `pay_password`, `money`, `freeze_money`, | 
|                                      `withdraw_money`, `overdraft_limit`, `lock_time`,`fixed_limit`) | 
|         VALUES (#{id}, #{phone}, #{userId}, NULL, '0', '0', '0', #{money}, NULL,#{money}) | 
|     </insert> | 
|   | 
|     <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} | 
|   | 
|         <if test="overdraftLimit != null and overdraftLimit != ''"> | 
|             ,  overdraft_limit=#{overdraftLimit} | 
|         </if> | 
|   | 
|         where account_id=#{accountId} | 
|     </update> | 
|   | 
|   | 
|     <select id="selectAccountInfoByUserId" resultType="com.xzx.gc.entity.AccountInfo"> | 
|         select * from xzx_account_info where user_id=#{userId} | 
|     </select> | 
| </mapper> |