团单统计

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

@@ -1,6 +1,7 @@
package com.czg.service.order.mapper;
import com.czg.order.dto.GbOrderQueryParam;
import com.czg.order.vo.GbOrderCountVO;
import com.czg.order.vo.GbOrderDetailVO;
import com.czg.order.vo.GbOrderUserVO;
import com.mybatisflex.core.BaseMapper;
@@ -16,6 +17,8 @@ import java.util.List;
*/
public interface GbOrderMapper extends BaseMapper<GbOrder> {
GbOrderCountVO countOrder(GbOrderQueryParam param);
List<GbOrderDetailVO> getGbOrderPage(GbOrderQueryParam param, Long shopId, Long mainShopId);
GbOrderDetailVO getDetailByDetailId(Long mainShopId, Long shopId, Long detailId);

View File

@@ -22,10 +22,7 @@ import com.czg.order.entity.GbOrderDetail;
import com.czg.order.enums.PaymentPayTypeEnum;
import com.czg.order.service.GbOrderDetailService;
import com.czg.order.service.GbOrderService;
import com.czg.order.vo.GbOrderDetailVO;
import com.czg.order.vo.GbOrderUserVO;
import com.czg.order.vo.GbWareOrderVO;
import com.czg.order.vo.GbWareVO;
import com.czg.order.vo.*;
import com.czg.resp.CzgResult;
import com.czg.sa.StpKit;
import com.czg.service.order.mapper.GbOrderMapper;
@@ -90,6 +87,11 @@ public class GbOrderServiceImpl extends ServiceImpl<GbOrderMapper, GbOrder> impl
return update;
}
@Override
public GbOrderCountVO countOrder(GbOrderQueryParam param) {
return mapper.countOrder(param);
}
@Override
public Page<GbOrderDetailVO> getGbOrderPage(GbOrderQueryParam param) {
Long mainIdByShopId = shopInfoService.getMainIdByShopId(param.getShopId());

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,