| <?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.PartnerAccountLogMapper">  | 
|   <resultMap id="BaseResultMap" type="com.xzx.gc.entity.PartnerAccountLog">  | 
|     <!--  | 
|       WARNING - @mbg.generated  | 
|     -->  | 
|     <id column="id" jdbcType="INTEGER" property="id" />  | 
|     <result column="account_id" jdbcType="VARCHAR" property="accountId" />  | 
|     <result column="flow_no" jdbcType="VARCHAR" property="flowNo" />  | 
|     <result column="type" jdbcType="VARCHAR" property="type" />  | 
|     <result column="create_time" jdbcType="VARCHAR" property="createTime" />  | 
|     <result column="money" jdbcType="VARCHAR" property="money" />  | 
|     <result column="account_money" jdbcType="VARCHAR" property="accountMoney" />  | 
|     <result column="hbb" jdbcType="VARCHAR" property="hbb" />  | 
|     <result column="user_name" jdbcType="VARCHAR" property="userName" />  | 
|     <result column="user_phone" jdbcType="VARCHAR" property="userPhone" />  | 
|     <result column="role_name" jdbcType="VARCHAR" property="roleName" />  | 
|     <result column="approver" jdbcType="VARCHAR" property="approver" />  | 
|     <result column="approver_time" jdbcType="VARCHAR" property="approverTime" />  | 
|     <result column="approver_status" jdbcType="VARCHAR" property="approverStatus" />  | 
|     <result column="del_flag"  property="delFlag" />  | 
|     <result column="update_time" jdbcType="VARCHAR" property="updateTime" />  | 
|   </resultMap>  | 
|   | 
|   <update id="updateParterAccountLog" parameterType="com.xzx.gc.model.admin.PartnerAccountLogModel">  | 
|     update xzx_partner_account_log set approver=#{approver} ,approver_time=#{approverTime},  | 
|     approver_status=#{approverStatus}, update_time=#{updateTime}  | 
|     <if test="hbb!= null and hbb!=''">  | 
|       , hbb = #{hbb}  | 
|     </if>  | 
|     <if test="accountMoney!= null and accountMoney!=''">  | 
|       , account_money=#{accountMoney}  | 
|     </if>  | 
|     where flow_no=#{flowNo}  | 
|   </update>  | 
|   | 
|     <select id="queryAllPartnerType" resultType="java.util.Map">  | 
|         select a.type from xzx_partner_account_log a where 1=1 and a.type is not null group by a.type  | 
|     </select>  | 
|   | 
|     <select id="queryAllAccountType" resultType="java.util.Map">  | 
|         select channel_type as type from xzx_account_log where 1=1 and channel_type is not null group by channel_type  | 
|     </select>  | 
|   | 
|     <select id="queryPartnerAccountLog" resultType="com.xzx.gc.model.admin.PartnerAccountLogModel">  | 
|         select flow_no as flowNo,IFNULL(account_money,0) as account,  | 
|         hbb as money,IFNULL(money,0) as hbb,  | 
|         user_name as userName,user_phone as userPhone,  | 
|         type,role_name as roleName ,approver,approver_time,create_time  | 
|         from xzx_partner_account_log where account_id=#{accountId}  | 
|   | 
|         <if test="startTime != null and startTime != ''">  | 
|             and create_time >= #{startTime}  | 
|         </if>  | 
|         <if test="endTime != null and endTime != ''">  | 
|             and create_time <= #{endTime}  | 
|         </if>  | 
|   | 
|         <if test="type != null and type != ''">  | 
|             and type=#{type}  | 
|         </if>  | 
|   | 
|         <if test="userName != null and userName != ''">  | 
|             and (user_name like concat("%",#{userName} ,"%") or user_phone like concat("%",#{userName} ,"%"))  | 
|         </if>  | 
|   | 
|     </select>  | 
|     <select id="queryAdminAccountLog" resultType="com.xzx.gc.model.admin.PartnerAccountLogModel">  | 
|         SELECT  | 
|         a.create_time,  | 
|         a.flow_no AS flowNo,  | 
|         IFNULL( a.new_money, 0 ) AS newMoney,  | 
|         IFNULL( a.money, 0 ) AS money,  | 
|         IFNULL( a.new_hbb, 0 ) AS newHbb,  | 
|         IFNULL( a.hbb, 0 ) AS hbb,  | 
|         IFNULL( a.old_money, 0 ) AS oldMoney,  | 
|         IFNULL( a.old_money, 0 ) AS accountMoney,  | 
|         ifnull(ifnull(IFNULL(c.`name`,from_base64(b.nick_name)),d.partner_name),'平台管理员') AS userName,  | 
|         ifnull(ifnull(IFNULL( c.mobile_phone, b.mobile_phone ),d.mobile_phone),'--') AS userPhone,  | 
|         a.type,  | 
|         a.create_user_type AS roleName,  | 
|         a.create_user_id  | 
|         FROM  | 
|         xzx_platform_account_log a  | 
|         LEFT JOIN xzx_user_info b on a.create_user_id=b.user_id  | 
|         LEFT JOIN xzx_user_other_info c on a.create_user_id=c.user_id  | 
|         LEFT JOIN xzx_city_partner d on a.create_user_id=d.id  | 
|   | 
|         where 1=1  | 
|         <if test="startTime != null and startTime != ''">  | 
|             and a.create_time >= #{startTime}  | 
|         </if>  | 
|         <if test="endTime != null and endTime != ''">  | 
|             and a.create_time <= #{endTime}  | 
|         </if>  | 
|   | 
|         <if test="type != null and type != ''">  | 
|             and a.type=#{type}  | 
|         </if>  | 
|         <if test="userName != null and userName != ''">  | 
|             and  ifnull(ifnull(IFNULL(c.`name`,from_base64(b.nick_name)),d.partner_name),'平台管理员') like concat("%",#{userName} ,"%")  | 
|         </if>  | 
|     </select>  | 
|   | 
|     <select id="queryPartnerLog" resultType="com.xzx.gc.model.admin.AccountLogModel">  | 
|         select x.userName,x.mobilePhone,x.userType,x.oldMoney,x.newMoney,x.createTime,x.channelType,  | 
|         x.oldLimit,x.newLimit,x.roleType from  | 
|   | 
|         (SELECT  | 
|         '' as userName,  | 
|         '' as mobilePhone,  | 
|         '' as userType,  | 
|         '1' as roleType,  | 
|         ifnull( a.account_money, 0 ) AS oldMoney,  | 
|         a.hbb AS newMoney,  | 
|         a.create_time AS createTime,  | 
|         a.type AS channelType,  | 
|         a.old_limit as oldLimit,  | 
|         a.new_limit as newLimit  | 
|         FROM  | 
|         xzx_partner_account_log a  | 
|         LEFT JOIN xzx_partner_account d ON a.account_id = d.account  | 
|         WHERE  | 
|         1 =1  | 
|         <if test="startTime != null and startTime != ''">  | 
|             and a.create_time<![CDATA[>= ]]>#{startTime}  | 
|         </if>  | 
|         <if test="endTime != null and endTime != ''">  | 
|             and a.create_time<![CDATA[<= ]]>#{endTime}  | 
|         </if>  | 
|         <if test="typeList != null and typeList.size() != 0">  | 
|             and a.type in  | 
|             <foreach collection="typeList" index="index" item="type" separator="," open="(" close=")">  | 
|                 #{type}  | 
|             </foreach>  | 
|         </if>  | 
|         <if test="channelType != null and channelType != ''">  | 
|             and a.type=#{channelType}  | 
|         </if>  | 
|         <if test="accountId != null and accountId != ''">  | 
|             and a.account_id=#{accountId}  | 
|         </if>  | 
|         <if test=" partnerIds != null and partnerIds.size() != 0">  | 
|             and d.partner_id in  | 
|             <foreach collection="partnerIds" index="index" item="id" separator="," open="(" close=")">  | 
|                 #{id}  | 
|             </foreach>  | 
|         </if>  | 
|   | 
|         UNION ALL  | 
|   | 
|         select  | 
|         IFNULL(c.name, n.nick_name) as userName,  | 
|         IFNULL(c.mobile_phone, n.mobile_phone) as mobilePhone,  | 
|         IFNULL(c.user_type, '1') as userType,  | 
|         '0' as roleType,  | 
|         ifnull( a.old_money, 0 ) AS oldMoney,  | 
|         a.new_money AS newMoney,  | 
|         a.create_time AS createTime,  | 
|         a.channel_type AS channelType,  | 
|         a.old_limit as oldLimit,  | 
|         a.new_limit as newLimit  | 
|         from xzx_account_log a  | 
|         left join xzx_account_info d on a.account_id = d.account_id  | 
|         left join (select  | 
|         k.name,  | 
|         k.mobile_phone,  | 
|         k.user_type,  | 
|         k.user_id,  | 
|         k.partner_id  | 
|         from xzx_user_other_info k  | 
|         where k.del_flag = 0) c on a.create_user_id = c.user_id  | 
|         left join (select  | 
|         m.mobile_phone,  | 
|         m.nick_name,  | 
|         m.user_id  | 
|         from xzx_user_info m  | 
|         where m.del_flag = 0) n on a.create_user_id = n.user_id  | 
|         where d.del_flag = 0  | 
|   | 
|         <if test="startTime != null and startTime != ''">  | 
|             and a.create_time >= #{startTime}  | 
|         </if>  | 
|         <if test="endTime != null and endTime != ''">  | 
|             and a.create_time <= #{endTime}  | 
|         </if>  | 
|   | 
|         <if test="type != null and type != ''">  | 
|             and a.type=#{type}  | 
|         </if>  | 
|   | 
|         <if test="userName != null and userName != ''">  | 
|             and (c.name like concat("%",#{userName} ,"%") or c.mobile_phone like concat("%",#{userName},"%") or  | 
|             n.mobile_phone like concat("%",#{userName},"%"))  | 
|         </if>  | 
|   | 
|   | 
|         <if test="typeList != null and typeList.size() != 0">  | 
|             and a.channel_type in  | 
|             <foreach collection="typeList" index="index" item="id" separator="," open="(" close=")">  | 
|                 #{id}  | 
|             </foreach>  | 
|         </if>  | 
|   | 
|         <if test="channelType != null and channelType != ''">  | 
|             and a.channel_type=#{channelType}  | 
|         </if>  | 
|   | 
|         <if test="accountId != null and accountId != ''">  | 
|             and a.account_id=#{accountId}  | 
|         </if>  | 
|   | 
|         <if test=" partnerIds != null and partnerIds.size() != 0">  | 
|             and c.partner_id in  | 
|             <foreach collection="partnerIds" index="index" item="id" separator="," open="(" close=")">  | 
|                 #{id}  | 
|             </foreach>  | 
|         </if>  | 
|         ) x  | 
|         order by x.createTime desc  | 
|   | 
|     </select>  | 
|   | 
|   | 
| </mapper> |