| <?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.user.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"/> | 
|     </resultMap> | 
|   | 
|     <resultMap id="UserInfoMap" type="com.xzx.gc.model.user.UserInfoVo"> | 
|         <result column="nick_name" jdbcType="VARCHAR" property="nickName"/> | 
|         <result column="user_type" jdbcType="VARCHAR" property="userType"/> | 
|         <result column="user_id" jdbcType="VARCHAR" property="userId"/> | 
|         <result column="mobile_phone" jdbcType="VARCHAR" property="mobilePhone"/> | 
|     </resultMap> | 
|   | 
|   | 
|     <update id="updateAccountWarehousingPrice"> | 
|         update xzx_account_info set | 
|         <if test="oldOverdrawPrice != null and oldOverdrawPrice != ''"> | 
|             overdraft_limit=#{oldOverdrawPrice}, | 
|         </if> | 
|         fixed_limit=#{newOverdrawPrice} | 
|         where del_flag=0 | 
|         and user_id in | 
|         <foreach collection="orderIds" index="index" item="id" separator="," open="(" close=")"> | 
|             #{id} | 
|         </foreach> | 
|     </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> | 
|   | 
|     <update id="updateCuserAccount"> | 
|         update xzx_account_info set del_flag=0 where del_flag=1 | 
|         <if test="userId != null and userId != ''"> | 
|             and user_id=#{userId} | 
|         </if> | 
|         <if test="phone != null and phone != ''"> | 
|             and account_name=#{phone} | 
|         </if> | 
|         order by account_id desc limit 1 | 
|     </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> | 
|   | 
|     <update id="updateAccountLimit"> | 
|         update  xzx_account_info set fixed_limit=#{fixedLimit},overdraft_limit=#{overdraftLimit} where account_id=#{accountId} | 
|     </update> | 
|   | 
|     <select id="queryAccountByUserIds" resultType="com.xzx.gc.model.admin.AccountMoneyModel"> | 
|         select * from xzx_account_info | 
|         <if test="userFlag==1"> | 
|             inner join xzx_user_info  on xzx_account_info.user_id=xzx_user_info.user_id | 
|         </if> | 
|   | 
|         where xzx_account_info.del_flag=0 | 
|         <if test=" userIds != null and userIds.size() != 0 and userFlag!=1"> | 
|             AND user_id in | 
|             <foreach collection="userIds" index="index" item="id" separator="," open="(" close=")"> | 
|                 #{id} | 
|             </foreach> | 
|         </if> | 
|   | 
|   | 
|         <if test="isProhibit != null and isProhibit != ''"> | 
|             AND is_prohibit = #{isProhibit} | 
|         </if> | 
|         order by CAST(money AS DECIMAL) desc | 
|     </select> | 
|   | 
|     <update id="updateAccountType"> | 
|         update xzx_account_info | 
|         set is_prohibit = #{isProhibit} | 
|         where account_id = #{accountId} | 
|     </update> | 
|   | 
|     <update id="updateAccountPartner"> | 
|         update xzx_account_info | 
|         set money = #{money} | 
|         where user_id = #{userId} | 
|     </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> | 
|   | 
|     <delete id="deleteAccount"> | 
|         update xzx_account_info | 
|         set del_flag = 1 | 
|         where account_id = #{accountId} | 
|     </delete> | 
|   | 
|     <select id="queryAccountByAccountId" resultType="com.xzx.gc.model.admin.AccountMoneyModel"> | 
|         select * from  xzx_account_info where account_id=#{accountId} | 
|     </select> | 
|   | 
|     <select id="findArea" resultType="com.xzx.gc.entity.OrderInfo"> | 
|         SELECT a.user_id "userId",a.money,c.township_id  "townId",d.level_3_name "townShipName" | 
|             ,c.longitude,c.latitude | 
|         from xzx_account_info a | 
|             inner JOIN xzx_user_info b | 
|                 on a.user_id=b.user_id | 
|             left JOIN xzx_user_address_info c on b.user_id=c.user_id and c.del_flag=0   AND c.flag=1 | 
|             left join  xzx_sys_address_level_info d on c.township_id=d.level_3_id | 
|         where a.del_flag=0 and b.del_flag=0 | 
|               and cast(a.money as DECIMAL(9,2))>0 | 
|   | 
|     </select> | 
|   | 
| </mapper> |