mitao
2025-02-21 31573d6180d15ef65ed0df9c2732495f40b12663
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
73
74
75
76
77
78
79
80
<?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.panzhihua.service_community.dao.ComShopFlowerRefundOrderDAO">
  <resultMap id="BaseResultMap" type="com.panzhihua.service_community.model.dos.ComShopFlowerRefundOrderDO">
    <!--@mbg.generated-->
    <!--@Table com_shop_flower_refund_order-->
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="store_id" jdbcType="BIGINT" property="storeId" />
    <result column="user_id" jdbcType="BIGINT" property="userId" />
    <result column="order_no" jdbcType="VARCHAR" property="orderNo" />
    <result column="order_id" jdbcType="VARCHAR" property="orderId" />
    <result column="refund_order_no" jdbcType="VARCHAR" property="refundOrderNo" />
    <result column="status" jdbcType="TINYINT" property="status" />
    <result column="delete_status" jdbcType="TINYINT" property="deleteStatus" />
    <result column="pay_amount" jdbcType="DECIMAL" property="payAmount" />
    <result column="refund_amount" jdbcType="DECIMAL" property="refundAmount" />
    <result column="refund_reason" jdbcType="VARCHAR" property="refundReason" />
    <result column="refund_pic" jdbcType="VARCHAR" property="refundPic" />
    <result column="create_at" jdbcType="TIMESTAMP" property="createAt" />
    <result column="update_at" jdbcType="TIMESTAMP" property="updateAt" />
    <result column="handle_time" jdbcType="TIMESTAMP" property="handleTime" />
    <result column="refund_time" jdbcType="TIMESTAMP" property="refundTime" />
    <result column="cancel_time" jdbcType="TIMESTAMP" property="cancelTime" />
    <result column="handle_result" jdbcType="VARCHAR" property="handleResult" />
    <result column="remark" jdbcType="VARCHAR" property="remark" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    id, store_id, user_id, order_no, order_id, refund_order_no, `status`, delete_status, 
    pay_amount, refund_amount, refund_reason, refund_pic, create_at, update_at, handle_time, 
    refund_time, handle_result, remark,cancel_time
  </sql>
    <select id="pageRefundOrder" resultType="com.panzhihua.common.model.vos.shop.ComShopFlowerRefundOrderVO">
      select ro.*,cm.name as store_name from com_shop_flower_refund_order ro
      left join com_convenient_merchants cm on ro.store_id = cm.id
      left join com_shop_flower_order_goods g on g.order_id = ro.order_id
      where  1=1
      <if test="pageComOrderRefundDTO.status != null">
        and ro.status = #{pageComOrderRefundDTO.status}
      </if>
      <if test="pageComOrderRefundDTO.storeId != null">
        and ro.store_id = #{pageComOrderRefundDTO.storeId}
      </if>
      <if test="pageComOrderRefundDTO.userId != null">
        and ro.user_id = #{pageComOrderRefundDTO.userId}
      </if>
      <if test="pageComOrderRefundDTO.backstageUserId != null">
        and cm.user_id = #{pageComOrderRefundDTO.backstageUserId}
      </if>
      <if test="pageComOrderRefundDTO.keyWord != null">
        and (
        cm.`name` like concat(#{pageComOrderRefundDTO.keyWord}, '%' ) or
        ro.order_no like concat(#{pageComOrderRefundDTO.keyWord}, '%' ) or
        g.goods_name like concat(#{pageComOrderRefundDTO.keyWord}, '%' )
        )
      </if>
      order by ro.create_at desc
    </select>
  <select id="selectCountByStoreId" resultType="java.lang.Integer">
    select count(1) from com_shop_flower_refund_order where 1=1
    <if test="storeId != null">
      and store_id = #{storeId}
    </if>
  </select>
 
  <select id="selectCountGroupStatus"
          resultType="com.panzhihua.common.model.vos.shop.ComShopOrderCountVO">
    SELECT count(1) amount , `status` FROM `com_shop_flower_refund_order` WHERE 1=1
    <if test="storeId != null">
      and store_id = #{storeId}
    </if>
    GROUP BY `status`
  </select>
    <update id="updateCancel">
      update com_shop_flower_refund_order set  `status`  = #{status},cancel_time = NOW()  where id = #{id}
    </update>
  <select id="selectCountRefundNowByOrderId" resultType="int">
    SELECT count(1) FROM com_shop_flower_refund_order WHERE order_id = #{orderId} and `status` in (9,10,13) and delete_status = 1
  </select>
</mapper>