| <?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.PayInfoMapper">  | 
|   | 
|     <resultMap id="MoneyDetailMap" type="com.xzx.gc.model.user.MoneyDetailVo">  | 
|         <result column="sum_count" jdbcType="INTEGER" property="sumCount"/>  | 
|         <result column="sum_money" jdbcType="VARCHAR" property="sumMoney"/>  | 
|         <result column="create_user_id" jdbcType="VARCHAR" property="createUserId"/>  | 
|     </resultMap>  | 
|   | 
|     <resultMap id="UserShareInfoMap" type="com.xzx.gc.model.user.UserShareInfoVo">  | 
|         <result column="mobile_phone" jdbcType="VARCHAR" property="mobilePhone"/>  | 
|         <result column="invite_count" jdbcType="VARCHAR" property="inviteCount"/>  | 
|     </resultMap>  | 
|   | 
|     <resultMap id="UserPayInfoMap" type="com.xzx.gc.model.pay.PayInfoVo">  | 
|         <result column="pay_order_id" jdbcType="VARCHAR" property="payOrderId"/>  | 
|         <result column="order_id" jdbcType="VARCHAR" property="orderId"/>  | 
|         <result column="create_user_id" jdbcType="VARCHAR" property="createUserId"/>  | 
|         <result column="account_id" jdbcType="INTEGER" property="accountId"/>  | 
|         <result column="create_time" jdbcType="VARCHAR" property="createTime"/>  | 
|         <result column="pay_type" jdbcType="VARCHAR" property="payType"/>  | 
|         <result column="open_id" jdbcType="VARCHAR" property="openId"/>  | 
|         <result column="pay_type_name" jdbcType="VARCHAR" property="payTypeName"/>  | 
|         <result column="examine_time" jdbcType="VARCHAR" property="examineTime"/>  | 
|         <result column="unpass_reason" jdbcType="VARCHAR" property="unpassReason"/>  | 
|         <result column="wxpay_flag" jdbcType="INTEGER" property="wxpayFlag"/>  | 
|         <result column="pay_flag" jdbcType="INTEGER" property="payFlag"/>  | 
|   | 
|     </resultMap>  | 
|   | 
|     <!-- 支付信息录入 -->  | 
|     <insert id="payInfoAdd" parameterType="map">  | 
|         insert into xzx_pay_info(pay_order_id,order_id,create_user_id,money,  | 
|                                  account_id,pay_type,open_id,status,create_time)  | 
|         values (#{payOrderId},#{orderId},#{createUserId},#{money},  | 
|                 #{accountId},#{payType},#{openId},#{status},#{createTime})  | 
|     </insert>  | 
|   | 
|     <insert id="addPayInfo">  | 
|         INSERT INTO `xzx_pay_info` (`pay_order_id`, `order_id`, `create_user_id`, `money`,  | 
|                                     `account_id`, `pay_type`, `open_id`, `status`, `create_time`, `check_num`, `pay_img`, `pay_time`)  | 
|         VALUES (#{payOrderId}, NULL, #{createUserId}, #{money}, #{accountId},  | 
|                                '1', NULL, #{status}, SYSDATE(), NULL, #{payImg}, #{payTime})  | 
|     </insert>  | 
|   | 
|     <insert id="addPayInfo1">  | 
|         INSERT INTO `xzx_pay_info` (`pay_order_id`, `order_id`, `create_user_id`, `money`,  | 
|                                     `account_id`, `pay_type`, `open_id`, `status`, `create_time`, `check_num`, `pay_img`, `pay_time`)  | 
|         VALUES (#{payOrderId}, NULL, #{createUserId}, #{money}, #{accountId},  | 
|                                #{payType}, NULL, #{status}, SYSDATE(), NULL, #{payImg}, #{payTime})  | 
|     </insert>  | 
|   | 
|     <select id="queryCollectorWM"   resultType="java.lang.String">  | 
|         select IFNULL(sum(money),0) from xzx_pay_info  | 
|         where pay_type =13 and create_user_id=#{userId}  | 
|     </select>  | 
|   | 
|     <select id="queryUserMoneyStatInfo" parameterType="map" resultMap="MoneyDetailMap">  | 
|         select create_user_id,count(*) sum_count,sum(cast(money as DECIMAL(9,2))) sum_money from xzx_pay_info  | 
|         where pay_type=#{payType} and create_user_id=#{createUserId}  | 
|         <if test="txFlag!=null">  | 
|             and status=4  | 
|         </if>  | 
|         group by create_user_id  | 
|     </select>  | 
|   | 
|   | 
|   | 
|   | 
|   | 
|     <select id="queryUserPayAll" resultMap="UserPayInfoMap">  | 
|         SELECT  | 
|             *  | 
|         FROM  | 
|             (  | 
|                 SELECT  | 
|                     a.pay_order_id,  | 
|                     a.create_user_id,  | 
|                     a.create_time,  | 
|                     a.money,  | 
|                     a.pay_type,  | 
|                     a.STATUS,  | 
|                     a.fee,  | 
|                     b.config_value_name pay_type_name  | 
|                 FROM  | 
|                     xzx_pay_info a  | 
|                     LEFT JOIN xzx_sys_config_info b ON a.pay_type = b.config_value  | 
|                                                        AND b.config_type_code = 'PAY_TYPE'  | 
|                 WHERE  | 
|                     a.create_user_id = #{createUserId}  | 
|                 UNION ALL  | 
|                 SELECT  | 
|                     a.pay_order_id,  | 
|                     a.create_user_id,  | 
|                     a.create_time,  | 
|                     a.money,  | 
|                     a.pay_type,  | 
|                     a.STATUS,  | 
|                     "0" as fee,  | 
|                     b.config_value_name pay_type_name  | 
|                 FROM  | 
|                     xzx_pay_request_info a  | 
|                     LEFT JOIN xzx_sys_config_info b ON a.pay_type = b.config_value  | 
|                                                        AND b.config_type_code = 'PAY_TYPE'  | 
|                 WHERE  | 
|                     a.create_user_id = #{createUserId}  | 
|             ) a  | 
|         ORDER BY  | 
|             a.create_time DESC  | 
|     </select>  | 
|   | 
|   | 
|     <select id="queryDetailsPresentation" resultType="com.xzx.gc.model.admin.PartnerPayMsgModel">  | 
|         select x.flowNo,x.payName,x.payTime,x.money,x.partnerName,x.payStatus,x.mobilePhone,x.partnerType,x.delFlag from (  | 
|         select a.pay_order_id as flowNo,'充值' as payName,a.create_time as payTime,a.money as money,b.partner_name as  | 
|         partnerName,b.del_flag as delFlag,  | 
|         a.status as payStatus,b.mobile_phone as mobilePhone,b.partner_type as partnerType  | 
|         from xzx_pay_info a  | 
|         LEFT JOIN xzx_city_partner b ON a.create_user_id = b.user_id  | 
|         where 1=1 and a.pay_type=1 and b.user_id is not null  | 
|   | 
|         <if test="userId != null and userId != ''">  | 
|             and a.create_user_id =#{userId}  | 
|         </if>  | 
|   | 
|         <if test="payType != null and payType != ''">  | 
|             and a.pay_type = #{payType}  | 
|         </if>  | 
|   | 
|         <if test="payStatus != null and payStatus != ''">  | 
|             and a.status = #{payStatus}  | 
|         </if>  | 
|   | 
|         <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="name != null and name != ''">  | 
|             and (b.partner_name like concat("%",#{name} ,"%") or b.mobile_phone like concat("%",#{name} ,"%"))  | 
|         </if>  | 
|   | 
|         <if test=" partnerIds != null and partnerIds.size() != 0">  | 
|             and b.id in  | 
|             <foreach collection="partnerIds" index="index" item="id" separator="," open="(" close=")" >  | 
|                 #{id}  | 
|             </foreach>  | 
|         </if>  | 
|   | 
|         UNION ALL  | 
|         select c.pay_order_id as flowNo,'提现' as payName,c.create_time as payTime,c.money as money,d.partner_name as  | 
|         partnerName,d.del_flag as delFlag,  | 
|         c.status as payStatus,d.mobile_phone as mobilePhone,d.partner_type as partnerType  | 
|         from xzx_pay_request_info c  | 
|         LEFT JOIN xzx_city_partner d ON c.create_user_id=d.user_id  | 
|         where 1=1 and c.pay_type=4 and d.user_id is not null  | 
|   | 
|         <if test="userId != null and userId != ''">  | 
|             and c.create_user_id =#{userId}  | 
|         </if>  | 
|   | 
|         <if test="payType != null and payType != ''">  | 
|             and c.pay_type = #{payType}  | 
|         </if>  | 
|   | 
|         <if test="payStatus != null and payStatus != ''">  | 
|             and c.status = #{payStatus}  | 
|         </if>  | 
|   | 
|         <if test="startTime != null and startTime != ''">  | 
|             and c.create_time >= #{startTime}  | 
|         </if>  | 
|         <if test="endTime != null and endTime != ''">  | 
|             and c.create_time <= #{endTime}  | 
|         </if>  | 
|   | 
|         <if test="name != null and name != ''">  | 
|             and (d.partner_name like concat("%",#{name} ,"%") or d.mobile_phone like concat("%",#{name} ,"%"))  | 
|         </if>  | 
|   | 
|         <if test=" partnerIds != null and partnerIds.size() != 0">  | 
|             and d.id in  | 
|             <foreach collection="partnerIds" index="index" item="id" separator="," open="(" close=")">  | 
|                 #{id}  | 
|             </foreach>  | 
|         </if>  | 
|   | 
|         ) x order by x.payTime desc  | 
|   | 
|     </select>  | 
|   | 
|     <select id="queryPayInfoById" resultType="com.xzx.gc.model.admin.PayInfoModel">  | 
|         select *  | 
|         from xzx_pay_info  | 
|         where pay_order_id = #{payOrderId}  | 
|     </select>  | 
|   | 
|     <update id="updatePayInfoPass">  | 
|         update xzx_pay_info set  | 
|         status=#{status}  | 
|         <if test="unpassReason != null and unpassReason != ''">  | 
|             , unpass_reason=#{unpassReason}  | 
|         </if>  | 
|         where pay_order_id=#{payOrderId}  | 
|     </update>  | 
| </mapper> |