团单统计

This commit is contained in:
2025-12-18 10:36:56 +08:00
parent 28e889692e
commit d8dc924ad6
8 changed files with 105 additions and 10 deletions

View File

@@ -4,6 +4,42 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.czg.service.order.mapper.GbOrderMapper">
<select id="countOrder" resultType="com.czg.order.vo.GbOrderCountVO">
SELECT
sum(CASE WHEN status !='已退款' THEN detail.pay_amount ELSE 0 END) AS paidAmountTotal,
sum(CASE WHEN status ='已退款' THEN detail.pay_amount ELSE 0 END) AS refundAmount,
count(detail.id) as countNum
FROM
`gb_order_detail` detail
WHERE
detail.shop_id = #{shopId}
and detail.is_del = 0
<if test="param.orderNo != null">
and detail.order_no = #{param.orderNo}
</if>
<if test="param.groupOrderNo != null">
AND detail.group_order_no = #{param.groupOrderNo}
</if>
<if test="param.status != null">
<if test="param.status == '退款'">
AND (detail.STATUS = '退款中' or detail.STATUS = '已退款')
</if>
<if test="param.status != '退款'">
AND detail.STATUS = #{param.status}
</if>
</if>
<if test="param.userId != null">
AND detail.user_id = #{param.userId}
</if>
<if test="param.orderStartTime != null and param.orderEndTime != null ">
and detail.pay_time BETWEEN #{param.orderStartTime} and #{param.orderEndTime}
</if>
<if test="param.verifyStartTime != null and param.verifyEndTime != null ">
and detail.verify_time BETWEEN #{param.verifyStartTime} and #{param.verifyEndTime}
</if>
order by detail.create_time desc
</select>
<select id="getGbOrderPage" resultType="com.czg.order.vo.GbOrderDetailVO">
SELECT
detail.* ,`order`.ware_json as wareJson,`order`.group_end_time as groupEndTime,`order`.group_people_num as groupPeopleNum,`order`.ware_group_price as wareGroupPrice,