<?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.pay.mapper.PayRequestMapper">
|
|
<select id="selectByPayType" resultType="com.xzx.gc.entity.PayRequestInfo">
|
SELECT
|
a.create_user_id "createUserId",
|
a.money,
|
a.pay_order_id "payOrderId",
|
a.create_time "createTime",
|
a.`status`,
|
a.update_time "examineTime",
|
a.pay_type "payType",
|
d.`name` "auditer",
|
a.unpass_reason "unpassReason",
|
b.NAME "userName",
|
b.mobile_phone "mobilePhone",
|
IFNULL(c.new_limit,0) "fixedLimit",
|
(cast(IFNULL(c.new_fixed_limit,0) as decimal(9,2))-cast(IFNULL(c.new_limit,0) as decimal(9,2))) as "overdraftLimit",
|
a.open_id "openId"
|
FROM
|
xzx_pay_request_info a
|
left join xzx_account_log c on a.pay_order_id=c.order_id
|
LEFT JOIN xzx_user_other_info b ON a.create_user_id = b.user_id
|
LEFT JOIN xzx_user_other_info d ON a.update_user_id = d.user_id
|
WHERE
|
a.pay_type = #{payType} and b.partner_id=#{partnerId}
|
<if test="keyword != null and keyword != ''">
|
and (b.name like concat('%',#{keyword} ,'%') or b.mobile_phone like concat('%',#{keyword},'%') )
|
</if>
|
<!--<if test="userIds != null and userIds.size()>0">-->
|
<!--and a.create_user_id in-->
|
<!--<foreach collection="userIds" item="id" index="index" open="(" close=")" separator=",">-->
|
<!--#{id}-->
|
<!--</foreach>-->
|
<!--</if>-->
|
ORDER BY
|
a.create_time DESC,
|
a.`status` ASC
|
</select>
|
|
<select id="selectByArea" resultType="com.xzx.gc.entity.UserInfo">
|
SELECT
|
a.create_user_id "userId",
|
b.nick_name "nickName",
|
b.mobile_phone "mobilePhone",
|
1 as "userType",
|
sum( cast( IFNULL(a.money,0) AS DECIMAL ( 9, 2 ) ) ) as withdrawalMoney
|
FROM
|
xzx_pay_request_info a
|
inner JOIN xzx_user_info b ON a.create_user_id = b.user_id AND b.del_flag = 0 and b.is_prohibit=0
|
LEFT JOIN xzx_user_address_info c on b.user_id=c.user_id
|
and c.del_flag=0 and c.flag='1'
|
WHERE
|
a.pay_type = '4'
|
AND a.`status` = '2' and a.money>0
|
<if test="cityId != null and cityId != ''">
|
and c.city_id=#{cityId}
|
</if>
|
|
<if test="mobile != null and mobile != ''">
|
and b.mobile_phone like concat('%',#{mobile} ,'%')
|
</if>
|
|
<if test="provinceId != null and provinceId != ''">
|
and c.province_id=#{provinceId}
|
</if>
|
|
<if test="townShipId != null and townShipId != ''">
|
and c.township_id=#{townShipId}
|
</if>
|
|
<if test="startDate != null and startDate != ''">
|
and a.update_time<![CDATA[>= ]]>#{startDate}
|
</if>
|
|
<if test="endDate != null and endDate != ''">
|
and a.update_time <=#{endDate}
|
</if>
|
|
GROUP BY
|
a.create_user_id
|
|
|
union ALL
|
|
SELECT
|
a.create_user_id "userId",
|
b.name "nickName",
|
b.mobile_phone "mobilePhone",
|
2 as "userType",
|
sum( cast( IFNULL(a.money,0) AS DECIMAL ( 9, 2 ) ) ) as withdrawalMoney
|
FROM
|
xzx_pay_request_info a
|
inner JOIN xzx_user_other_info b ON a.create_user_id = b.user_id AND b.del_flag = 0 and b.is_prohibit=0
|
LEFT JOIN xzx_user_address_info c on b.user_id=c.user_id
|
and c.del_flag=0 and c.flag='1'
|
WHERE
|
a.pay_type = '4'
|
AND a.`status` = '2' and a.money>0
|
<if test="cityId != null and cityId != ''">
|
and c.city_id=#{cityId}
|
</if>
|
|
<if test="mobile != null and mobile != ''">
|
and b.mobile_phone like concat('%',#{mobile} ,'%')
|
</if>
|
|
<if test="provinceId != null and provinceId != ''">
|
and c.province_id=#{provinceId}
|
</if>
|
|
<if test="townShipId != null and townShipId != ''">
|
and c.township_id=#{townShipId}
|
</if>
|
|
<if test="startDate != null and startDate != ''">
|
and a.update_time<![CDATA[>= ]]>#{startDate}
|
</if>
|
|
<if test="endDate != null and endDate != ''">
|
and a.update_time <=#{endDate}
|
</if>
|
|
GROUP BY
|
a.create_user_id
|
|
|
ORDER BY withdrawalMoney desc
|
</select>
|
|
|
<update id="updateMoney" parameterType="com.xzx.gc.model.admin.MoneyModel">
|
UPDATE `xzx_pay_request_info`
|
<set>
|
<if test="status!= null and status!=''">
|
status=#{status},
|
</if>
|
<if test="payFlag!= null and payFlag != ''">
|
pay_flag=#{payFlag},
|
</if>
|
<if test="unpassReason!= null and unpassReason != ''">
|
unpass_reason=#{unpassReason},
|
</if>
|
<if test="updateTime!= null">
|
update_time=#{updateTime},
|
</if>
|
<if test="updateUserId!= null">
|
update_user_id=#{updateUserId},
|
</if>
|
</set>
|
WHERE pay_order_id =#{payOrderId}
|
</update>
|
|
<select id="queryMoney" resultType="com.xzx.gc.model.admin.MoneyModel">
|
SELECT * FROM xzx_pay_request_info a where 1=1
|
<if test="payOrderId!= null and payOrderId != ''">
|
and a.pay_order_id=#{payOrderId}
|
</if>
|
</select>
|
|
<select id="queryMoneyList" resultType="com.xzx.gc.model.admin.MoneyModel">
|
SELECT a.pay_order_id,a.create_time,a.money,a.unpass_reason,a.pay_flag, a.wxpay_flag,a.examine_time,
|
b.mobile_phone,b.nick_name,b.user_type,c.order_status,a.examine_time,a.`status`,a.pay_type
|
FROM xzx_pay_request_info a
|
LEFT JOIN xzx_user_info b ON a.create_user_id = b.user_id
|
LEFT JOIN xzx_order_info c ON a.order_id = c.order_id
|
where 1=1
|
<if test="status!= null and status!=''">
|
and a.status=#{status}
|
</if>
|
<if test="nickName!= null and nickName!=''">
|
and b.nick_name=#{nickName}
|
</if>
|
<if test="mobilePhone!= null and mobilePhone!=''">
|
and b.mobile_phone=#{mobilePhone}
|
</if>
|
<if test="payType!= null and payType!=''">
|
and a.pay_type=#{payType}
|
</if>
|
group by a.create_time desc
|
</select>
|
|
<select id="queryOtherMoneyList" resultType="com.xzx.gc.model.admin.MoneyModel">
|
SELECT a.pay_order_id,a.create_time,a.money,a.unpass_reason,a.pay_flag, a.wxpay_flag,a.examine_time,
|
b.mobile_phone,b.nick_name,b.user_type,c.order_status,a.examine_time,a.`status`,a.pay_type,a.create_user_id
|
FROM xzx_pay_request_info a
|
LEFT JOIN xzx_user_other_info b ON a.create_user_id = b.user_id
|
LEFT JOIN xzx_order_info c ON a.order_id = c.order_id
|
where 1=1
|
<if test="status!= null and status!=''">
|
and a.status=#{status}
|
</if>
|
<if test="nickName!= null and nickName!=''">
|
and b.nick_name=#{nickName}
|
</if>
|
<if test="mobilePhone!= null and mobilePhone!=''">
|
and b.mobile_phone=#{mobilePhone}
|
</if>
|
<if test="payType!= null and payType!=''">
|
and a.pay_type=#{payType}
|
</if>
|
group by a.create_time desc
|
</select>
|
|
|
<insert id="addReason">
|
update `xzx_pay_request_info` set status=3,unpass_reason=#{reason} where pay_order_id=#{payOrderId}
|
</insert>
|
|
<select id="queryPayInfoDetail" resultType="java.util.Map">
|
select a.*,b.nick_name as nickName ,
|
b.user_type as userType,
|
b.avatar as avatar,
|
b.mobile_phone as mobilePhone
|
from xzx_pay_request_info a,xzx_user_info b where a.pay_order_id=#{payOrderId} and a.create_user_id = b.user_id
|
</select>
|
|
<update id="updateMoneyApi" parameterType="com.xzx.gc.model.admin.MoneyModel">
|
UPDATE xzx_pay_request_info SET pay_flag=#{payFlag},unpass_reason=#{unpassReason},update_time=SYSDATE()
|
WHERE pay_order_id = #{payOrderId}
|
</update>
|
|
<select id="queryMoneyList2" parameterType="com.xzx.gc.model.admin.MoneyModel"
|
resultType="com.xzx.gc.model.admin.MoneyModel">
|
SELECT a.pay_order_id,a.create_time,a.money,a.unpass_reason,a.pay_flag,
|
a.wxpay_flag,a.examine_time,a.update_time,
|
a.update_user_id,(select k.name from core_user k where k.id=a.update_user_id) as updateUserName,
|
b.mobile_phone,IFNULL(b.nick_name,f.name) as
|
nickName,b.user_type,c.order_status,c.order_id,a.`status`,a.pay_type,a.create_user_id ,
|
IFNULL((select d.role_name from xzx_user_role_info d where d.role_code= f.user_type and d.del_flag=0),'普通用户') as
|
roleName,
|
IFNULL(f.user_type,b.user_type) as userType,
|
f.del_flag as delFlag
|
FROM xzx_pay_request_info a
|
LEFT JOIN xzx_user_info b ON a.create_user_id = b.user_id
|
LEFT JOIN xzx_order_info c ON a.order_id = c.order_id
|
LEFT JOIN xzx_user_other_info f ON a.create_user_id = f.user_id
|
where 1=1
|
<if test="status!= null and status!=''">
|
and a.status=#{status}
|
</if>
|
<if test="nickName!= null and nickName!=''">
|
and (b.nick_name=#{nickName} or f.name=#{name})
|
</if>
|
<if test="mobilePhone!= null and mobilePhone!=''">
|
and b.mobile_phone=#{mobilePhone}
|
</if>
|
<if test="payType!= null and payType!=''">
|
and a.pay_type=#{payType}
|
</if>
|
<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="partnerIds!= null and partnerIds.size() != 0">
|
and f.partner_id in
|
<foreach collection="partnerIds" index="index" item="id" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
</if>
|
group by a.pay_order_id
|
order by a.create_time desc
|
|
</select>
|
|
<select id="queryPayOrderIds" resultType="java.lang.String">
|
SELECT a.pay_order_id
|
FROM xzx_pay_request_info a
|
LEFT JOIN xzx_user_info b ON a.create_user_id = b.user_id
|
LEFT JOIN xzx_user_other_info f ON a.create_user_id = f.user_id
|
where 1=1
|
<if test="status!= null and status!=''">
|
and a.status=#{status}
|
</if>
|
<if test="nickName!= null and nickName!=''">
|
and (b.nick_name=#{nickName} or f.name=#{name})
|
</if>
|
<if test="mobilePhone!= null and mobilePhone!=''">
|
and b.mobile_phone=#{mobilePhone}
|
</if>
|
<if test="payType!= null and payType!=''">
|
and a.pay_type=#{payType}
|
</if>
|
<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="partnerIds!= null and partnerIds.size() != 0">
|
and f.partner_id in
|
<foreach collection="partnerIds" index="index" item="id" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
</if>
|
group by a.pay_order_id
|
order by a.create_time desc
|
</select>
|
|
<select id="queryMoneyTodayList" parameterType="com.xzx.gc.model.admin.MoneyModel"
|
resultType="java.lang.String">
|
SELECT IFNULL(sum(c.money),0)
|
FROM xzx_pay_request_info c
|
LEFT JOIN xzx_pay_request_info a ON a.pay_order_id=c.pay_order_id
|
LEFT JOIN xzx_user_info b ON a.create_user_id = b.user_id
|
LEFT JOIN xzx_user_other_info f ON a.create_user_id = f.user_id
|
where 1=1 and c.pay_type=4
|
<if test="status!= null and status!=''">
|
and a.status=#{status}
|
</if>
|
<if test="nickName!= null and nickName!=''">
|
and (b.nick_name=#{nickName} or f.name=#{name})
|
</if>
|
<if test="mobilePhone!= null and mobilePhone!=''">
|
and b.mobile_phone=#{mobilePhone}
|
</if>
|
<if test="payType!= null and payType!=''">
|
and a.pay_type=#{payType}
|
</if>
|
<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="partnerIds!= null and partnerIds.size() != 0">
|
and f.partner_id in
|
<foreach collection="partnerIds" index="index" item="id" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
</if>
|
</select>
|
|
<select id="queryPayInfoDetailHS" resultType="java.util.HashMap">
|
select a.*,b.nick_name as nickName ,
|
b.user_type as userType,
|
b.avatar as avatar,
|
a.create_user_id as createUserId,
|
b.mobile_phone as mobilePhone
|
from xzx_pay_request_info a,xzx_user_other_info b
|
where a.pay_order_id=#{payOrderId} and a.create_user_id = b.user_id
|
</select>
|
|
<insert id="insertPayRequestInfo">
|
INSERT INTO `xzx_pay_request_info`
|
(`pay_order_id`, `order_id`, `create_user_id`, `money`, `account_id`, `pay_type`,
|
`open_id`, `status`, `create_time`,
|
`wxpay_flag`, `pay_flag`, `unpass_reason`, `examine_time`, `account_bind_id`,
|
`update_time`, `update_user_id`)
|
VALUES (#{payOrderId},#{orderId},#{createUserId},#{money},#{accountId},#{payType},
|
#{openId},#{status},#{createTime},#{wxpayFlag},#{payFlag},
|
#{unpassReason},#{examineTime},#{accountBindId},#{updateTime},#{updateUserId})
|
|
</insert>
|
|
<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="rkMessage" resultType="com.xzx.gc.model.pay.RkLimitDto">
|
select * from (SELECT
|
'额度恢复' AS "title",
|
create_time "createTime",
|
pay_type AS "msgType",
|
STATUS,
|
unpass_reason "reason",
|
money
|
FROM
|
xzx_pay_request_info
|
WHERE
|
pay_type = '9'
|
AND create_user_id = #{userId} UNION ALL
|
SELECT
|
'额度支出' AS "title",
|
create_time "createTime",
|
pay_type AS "msgType",
|
STATUS,
|
'' as reason,
|
money
|
FROM
|
xzx_pay_info
|
WHERE
|
(pay_type = '2' or pay_type='6')
|
AND create_user_id = #{userId}) a order by a.createTime desc
|
</select>
|
|
</mapper>
|