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.
143 lines
5.0 KiB
143 lines
5.0 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.RefundMapper">
|
|
<select id="getRefundA" resultType="com.example.demo.domain.vo.RefundA">
|
|
SELECT
|
|
CASE
|
|
WHEN au.status = 0 THEN '待审核'
|
|
WHEN au.status = 1 THEN '已通过'
|
|
WHEN au.status = 2 THEN '已驳回'
|
|
ELSE '其他状态'
|
|
END AS status,
|
|
COUNT(*) AS Raudit,
|
|
SUM(d.recharge_coin) AS SumRaudit1,
|
|
SUM(d.free_coin) AS SumRaudit2,
|
|
SUM(d.task_coin) AS SumRaudit3,
|
|
(SUM(d.recharge_coin) + SUM(d.free_coin) + SUM(d.task_coin)) AS SumRaudit
|
|
FROM
|
|
detail d
|
|
LEFT JOIN audit au ON d.detail_id = au.refund_id
|
|
LEFT JOIN `user` ON d.jwcode = `user`.jwcode
|
|
<where>
|
|
d.detail_flag = 1
|
|
AND d.update_type = 2
|
|
|
|
<if test="flags != null and flags.size > 0">
|
|
and au.status IN
|
|
<foreach collection="flags" item="au.status" open="(" separator="," close=")">
|
|
#{au.status}
|
|
</foreach>
|
|
</if>
|
|
<if test='jwcode!=null and jwcode.length>0'>and d.jwcode=#{jwcode}</if>
|
|
<if test='startDate != null and endDate != null'>AND d.create_time BETWEEN #{startDate} AND #{endDate}</if>
|
|
<if test='area!=null and area.length>0'>and user.area=#{area}</if>
|
|
<if test='refundType != null and refundType.length>0'>AND d.refund_type LIKE CONCAT('%', #{refundType}, '%')</if>
|
|
<if test='refundGoods != null and refundGoods.length>0'>AND d.refund_goods LIKE CONCAT('%', #{refundGoods}, '%')</if>
|
|
<if test="areas != null">
|
|
AND area IN
|
|
<foreach collection="areas" item="areas" open="(" separator="," close=")">
|
|
#{areas}
|
|
</foreach>
|
|
</if>
|
|
</where>
|
|
GROUP BY
|
|
au.status
|
|
</select>
|
|
|
|
<select id="select" resultType="com.example.demo.domain.entity.Detail">
|
|
SELECT
|
|
d.jwcode,
|
|
d.refund_type,
|
|
d.refund_goods,
|
|
d.recharge_coin,
|
|
d.free_coin,
|
|
d.task_coin,
|
|
d.remark,
|
|
d.create_time,
|
|
d.detail_id,
|
|
u.area,
|
|
a.name AS adminName,
|
|
u.name AS userName,
|
|
au.status,
|
|
au.reson AS auditReson,
|
|
au.refund_id,
|
|
au.audit_id
|
|
FROM detail d
|
|
LEFT JOIN `admin` a ON d.admin_id = a.admin_id
|
|
LEFT JOIN `user` u ON d.jwcode = u.jwcode
|
|
LEFT JOIN audit au ON d.detail_id = au.refund_id
|
|
<where>
|
|
d.detail_flag = 1
|
|
AND update_type = 2
|
|
<if test='status != null'>
|
|
AND au.status = #{status}
|
|
</if>
|
|
<if test='area != null and area.length > 0'>
|
|
AND u.area = #{area}
|
|
</if>
|
|
<if test='jwcode != null and jwcode.length > 0'>
|
|
AND d.jwcode = #{jwcode}
|
|
</if>
|
|
<if test='refundType != null and refundType.length > 0'>
|
|
AND d.refund_type LIKE CONCAT('%', #{refundType}, '%')
|
|
</if>
|
|
<if test='refundGoods != null and refundGoods.length > 0'>
|
|
AND d.refund_goods LIKE CONCAT('%', #{refundGoods}, '%')
|
|
</if>
|
|
<if test='startDate != null and endDate != null'>
|
|
AND d.create_time BETWEEN #{startDate} AND #{endDate}
|
|
</if>
|
|
<if test="areas != null">
|
|
AND u.area IN
|
|
<foreach collection="areas" item="areas" open="(" separator="," close=")">
|
|
#{areas}
|
|
</foreach>
|
|
</if>
|
|
</where>
|
|
<choose>
|
|
<when test="sortField != null and sortField.length >0 or sortOrder != null and sortOrder.length >0">
|
|
ORDER BY ${sortField} ${sortOrder}
|
|
</when>
|
|
<otherwise>
|
|
ORDER BY d.create_time DESC
|
|
</otherwise>
|
|
</choose>
|
|
</select>
|
|
|
|
<select id="queryDetailYWithUser" resultType="map">
|
|
SELECT
|
|
d.detaily_id,
|
|
u.name,
|
|
d.jwcode,
|
|
u.area,
|
|
d.consume_platform,
|
|
d.update_type,
|
|
d.recharge_coin,
|
|
d.task_coin,
|
|
d.free_coin,
|
|
d.create_admin,
|
|
d.create_time
|
|
FROM
|
|
detail_y d
|
|
LEFT JOIN
|
|
user u ON d.jwcode = u.jwcode
|
|
<where>
|
|
<if test='updateType != null'>
|
|
AND d.update_type = #{updateType}
|
|
</if>
|
|
<if test='jwcode != null'>
|
|
AND d.jwcode = #{jwcode}
|
|
</if>
|
|
<if test='area != null'>
|
|
AND u.area = #{area}
|
|
</if>
|
|
<if test='startDate != null and endDate != null'>
|
|
AND create_time BETWEEN #{startDate} AND #{endDate}
|
|
</if>
|
|
</where>
|
|
ORDER BY
|
|
detaily_id DESC
|
|
</select>
|
|
</mapper>
|