mitao
2025-03-14 392b42c4891cf2e6beda57ab32c51598f290f4b7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?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.ruoyi.order.mapper.OrderReturnRequestMapper">
 
  <select id="getOrderReturnRequestPage"
    resultType="com.ruoyi.order.controller.management.vo.MgtOrderReturnRequestVO">
    SELECT
    torr.*,
    o.order_no,
    o.member_id,
    CASE
    WHEN o.order_from = 4 THEN 2
    ELSE 1
    END AS orderType,
    o.order_from
    FROM
    t_order_return_request torr
    LEFT JOIN t_order o ON torr.order_id = o.id
    <where>
      <if test="query.orderNo != null and query.orderNo != ''">
        AND o.order_no LIKE concat('%', #{query.orderNo}, '%')
      </if>
      <if test="query.requestType != null">
        AND torr.request_type = #{query.requestType}
      </if>
      <if test="query.memberIdSet!=null">
        <foreach collection="query.memberIdSet" item="memberId" separator=","
          open="AND o.member_id in (" close=")">
          #{memberId}
        </foreach>
      </if>
      <if test="query.auditStatus != null">
        AND torr.audit_status = #{query.auditStatus}
      </if>
      <if test="query.status != null">
        AND torr.status = #{query.status}
      </if>
      <if
        test="query.orderType != null and @com.ruoyi.common.core.enums.OrderTypeEnum@isMallOrder(query.orderType)">
        AND o.order_from in (1,2,3)
      </if>
      <if
        test="query.orderType != null and @com.ruoyi.common.core.enums.OrderTypeEnum@isAuctionOrder(query.orderType)">
        AND o.order_from = 4
      </if>
    </where>
    ORDER BY torr.create_time DESC
  </select>
  <select id="getOrderReturnRequestDetail"
    resultType="com.ruoyi.order.controller.management.vo.MgtOrderReturnRequestVO"
    parameterType="java.lang.Long">
    SELECT torr.*,
           o.order_no,
           o.member_id,
           o.order_time,
           o.pay_time,
           o.payment_method,
           o.price,
           o.points,
           o.total_amount,
           o.discount_money,
           CASE
             WHEN o.order_from = 4 THEN 2
             ELSE 1
             END AS orderType,
           o.order_from
    FROM t_order_return_request torr
           LEFT JOIN t_order o
                     ON torr.order_id = o.id
    WHERE torr.id = #{id}
  </select>
</mapper>