You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
167 lines
7.4 KiB
167 lines
7.4 KiB
<?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.example.demo.mapper.coin.AuditMapper">
|
|
<!-- 修改订单审核人与审核状态-->
|
|
<update id="updateOrder">
|
|
update user_gold_record
|
|
set audit_id = #{auditId},
|
|
audit_status = #{auditStatus},
|
|
reject_reason = #{rejectReason},
|
|
audit_time = #{auditTime}
|
|
where order_code = #{orderCode} and audit_status = 0
|
|
order by create_time DESC
|
|
limit 1
|
|
</update>
|
|
<!--更新用户余额-->
|
|
<update id="updateUserGold">
|
|
update user
|
|
set sum_permanent_gold = sum_permanent_gold + COALESCE(#{sumPermanentGold},0),
|
|
sum_free_june = sum_free_june + COALESCE(#{sumFreeJune},0),
|
|
sum_free_december = sum_free_december + COALESCE(#{sumFreeDecember},0),
|
|
sum_task_gold = sum_task_gold + COALESCE(#{sumTaskGold},0),
|
|
current_permanent_gold = current_permanent_gold + COALESCE(#{currentPermanentGold},0),
|
|
current_free_june = current_free_june + COALESCE(#{currentFreeJune},0),
|
|
current_free_december = current_free_december + COALESCE(#{currentFreeDecember},0),
|
|
current_task_gold = current_task_gold + COALESCE(#{currentTaskGold},0),
|
|
recharge_num = recharge_num+COALESCE(#{rechargeNum},0)
|
|
|
|
where jwcode = #{jwcode}
|
|
</update>
|
|
<!--修改消费订单为已退款-->
|
|
<update id="updateOrderRefund">
|
|
update user_gold_record
|
|
set is_refund = #{isRefund}
|
|
where order_code = #{orderCode}
|
|
</update>
|
|
<!--根据订单号查未审核订单-->
|
|
|
|
<select id="selectOrderByOrderCode" resultType="com.example.demo.domain.entity.UserGoldRecord">
|
|
select * from user_gold_record
|
|
where order_code = #{orderCode} and audit_status = 0
|
|
and flag=1
|
|
ORDER BY create_time DESC
|
|
limit 1
|
|
</select>
|
|
<!--多条件查询充值审核订单-->
|
|
<select id="selectRechargeBy" resultType="com.example.demo.domain.vo.coin.RechargeAudit">
|
|
SELECT ugr.*,
|
|
(COALESCE(ugr.free_june, 0) + COALESCE(ugr.free_december, 0)) AS freeGold,
|
|
u.name as name,
|
|
m.name as market,
|
|
a1.admin_name as adminName,
|
|
a2.admin_name as auditName
|
|
FROM user_gold_record as ugr
|
|
LEFT JOIN user u ON ugr.jwcode = u.jwcode
|
|
LEFT JOIN admin a1 ON ugr.admin_id = a1.id
|
|
LEFT JOIN admin a2 ON ugr.audit_id = a2.id
|
|
left join market m ON u.market = m.id
|
|
<where>
|
|
<if test="rechargeAudit.jwcode != null and rechargeAudit.jwcode != ''">
|
|
AND ugr.jwcode = #{rechargeAudit.jwcode}
|
|
</if>
|
|
<if test="rechargeAudit.activity != null and rechargeAudit.activity != ''">
|
|
AND ugr.activity = #{rechargeAudit.activity}
|
|
</if>
|
|
<!-- 判断 market 是否不为总部且 markets 不为空 -->
|
|
<if test="rechargeAudit.markets != null and rechargeAudit.markets.size() > 0">
|
|
AND (
|
|
<foreach collection="rechargeAudit.markets" item="market" open="" close="" separator=" OR ">
|
|
u.market = #{market}
|
|
</foreach>
|
|
)
|
|
</if>
|
|
<if test="rechargeAudit.payModel != null and rechargeAudit.payModel != ''">
|
|
AND ugr.pay_model = #{rechargeAudit.payModel}
|
|
</if>
|
|
<!-- <if test="rechargeAudit.rateId != null and rechargeAudit.rateId != ''">
|
|
AND ugr.rate_id = #{rechargeAudit.rateId}
|
|
</if>-->
|
|
<if test="rechargeAudit.market != null and rechargeAudit.market != ''">
|
|
AND m.name = #{rechargeAudit.market}
|
|
</if>
|
|
<if test="rechargeAudit.startTime != null and rechargeAudit.endTime != null ">
|
|
AND ugr.pay_time between #{rechargeAudit.startTime} and #{rechargeAudit.endTime}
|
|
</if>
|
|
|
|
<if test="rechargeAudit.auditStatus != null and rechargeAudit.auditStatus != ''">
|
|
AND ugr.audit_status = #{rechargeAudit.auditStatus}
|
|
</if>
|
|
AND ugr.type = 0
|
|
and ugr.flag=1
|
|
</where>
|
|
<choose>
|
|
<when test="rechargeAudit.sortField != null and rechargeAudit.sortField.length > 0 or rechargeAudit.sortOrder != null and rechargeAudit.sortOrder.length > 0">
|
|
ORDER BY ${rechargeAudit.sortField} ${rechargeAudit.sortOrder}
|
|
</when>
|
|
<otherwise>
|
|
ORDER BY create_time DESC
|
|
</otherwise>
|
|
</choose>
|
|
</select>
|
|
<!--多条件查询退款审核订单-->
|
|
<select id="selectRefundBy" resultType="com.example.demo.domain.vo.coin.RefundAudit">
|
|
SELECT ugr.*,
|
|
(COALESCE(ugr.free_june, 0) + COALESCE(ugr.free_december, 0)) AS freeGold,
|
|
u.name as name,
|
|
m.name as market,
|
|
a1.admin_name as adminName,
|
|
a2.admin_name as auditName
|
|
FROM user_gold_record as ugr
|
|
LEFT JOIN user u ON ugr.jwcode = u.jwcode
|
|
LEFT JOIN admin a1 ON ugr.admin_id = a1.id
|
|
LEFT JOIN admin a2 ON ugr.audit_id = a2.id
|
|
left join market m ON u.market = m.id
|
|
|
|
<where>
|
|
<if test="refundAudit.jwcode != null">
|
|
AND ugr.jwcode = #{refundAudit.jwcode}
|
|
</if>
|
|
<if test="refundAudit.refundModel != null ">
|
|
AND ugr.refund_model = #{refundAudit.refundModel}
|
|
</if>
|
|
<if test="refundAudit.goodsName != null and refundAudit.goodsName != ''">
|
|
AND ugr.goods_name = #{refundAudit.goodsName}
|
|
</if>
|
|
|
|
<!-- 判断 market 是否不为总部且 markets 不为空 -->
|
|
<if test="refundAudit.markets != null and refundAudit.markets.size() > 0">
|
|
AND (
|
|
<foreach collection="refundAudit.markets" item="market" open="" close="" separator=" OR ">
|
|
u.market = #{market}
|
|
</foreach>
|
|
)
|
|
</if>
|
|
<if test="refundAudit.startTime != null and refundAudit.endTime != null ">
|
|
AND ugr.create_time between #{refundAudit.startTime} and #{refundAudit.endTime}
|
|
</if>
|
|
<if test="refundAudit.market != null and refundAudit.market != ''">
|
|
AND m.name = #{refundAudit.market}
|
|
</if>
|
|
|
|
<if test="refundAudit.auditStatus != null and refundAudit.auditStatus != ''">
|
|
AND ugr.audit_status = #{refundAudit.auditStatus}
|
|
</if>
|
|
AND ugr.type = 2
|
|
and ugr.flag=1
|
|
|
|
</where>
|
|
<choose>
|
|
<when test="refundAudit.sortField != null and refundAudit.sortField.length > 0 or refundAudit.sortOrder != null and refundAudit.sortOrder.length > 0">
|
|
ORDER BY ${refundAudit.sortField} ${refundAudit.sortOrder}
|
|
</when>
|
|
<otherwise>
|
|
ORDER BY create_time DESC
|
|
</otherwise>
|
|
</choose>
|
|
</select>
|
|
<!--根据订单号查订单-->
|
|
|
|
<select id="selectAllOrderByOrderCode" resultType="com.example.demo.domain.entity.UserGoldRecord">
|
|
select * from user_gold_record where order_code = #{orderCode} and flag=1
|
|
ORDER BY create_time DESC
|
|
limit 1
|
|
</select>
|
|
<select id="getAdminMarket" resultType="java.lang.String">
|
|
|
|
</select>
|
|
</mapper>
|