Merge remote-tracking branch 'origin/master'

This commit is contained in:
2025-03-12 10:48:19 +08:00
8 changed files with 80 additions and 25 deletions

View File

@@ -5,6 +5,7 @@ import com.czg.order.param.DataSummaryProductSaleParam;
import com.czg.order.param.SaleSummaryCountParam;
import com.czg.order.vo.DataSummaryProductSaleRankingVo;
import com.czg.order.vo.SaleSummaryCountVo;
import com.czg.order.vo.SaleSummaryInfoVo;
import com.mybatisflex.core.BaseMapper;
import java.util.List;
@@ -21,4 +22,6 @@ public interface ShopProdStatisticMapper extends BaseMapper<ShopProdStatistic> {
SaleSummaryCountVo getSaleSummaryCount(SaleSummaryCountParam param);
List<SaleSummaryInfoVo> findSaleSummaryList(SaleSummaryCountParam param);
}

View File

@@ -5,11 +5,13 @@ import com.czg.order.service.SaleSummaryService;
import com.czg.order.vo.SaleSummaryCountVo;
import com.czg.order.vo.SaleSummaryInfoVo;
import com.czg.service.order.mapper.ShopProdStatisticMapper;
import com.czg.utils.PageUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.mybatisflex.core.paginate.Page;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
@@ -34,13 +36,13 @@ public class SaleSummaryServiceImpl implements SaleSummaryService {
@Override
public Page<SaleSummaryInfoVo> summaryPage(SaleSummaryCountParam param) {
Page<SaleSummaryInfoVo> page = new Page<>();
page.setRecords(new ArrayList<SaleSummaryInfoVo>());
return page;
PageHelper.startPage(PageUtil.buildPageHelp());
PageInfo<SaleSummaryInfoVo> pageInfo = new PageInfo<>(shopProdStatisticMapper.findSaleSummaryList(param));
return PageUtil.convert(pageInfo);
}
@Override
public List<SaleSummaryInfoVo> summaryList(SaleSummaryCountParam param) {
return List.of();
return shopProdStatisticMapper.findSaleSummaryList(param);
}
}

View File

@@ -43,4 +43,35 @@
]]>
</if>
</select>
<select id="findSaleSummaryList" resultType="com.czg.order.vo.SaleSummaryInfoVo">
select
t1.prod_id,
max(t1.id) as id,
t2.NAME AS product_name,
t3.name as category_name,
sum(t1.sale_count) as sale_count,
sum(t1.sale_amount) as sale_amount,
sum(t1.refund_count) as refund_count,
sum(t1.refund_amount) as refund_amount
from tb_shop_prod_statistic t1
left join tb_product t2 on t1.prod_id = t2.id
left join tb_shop_prod_category t3 on t2.category_id = t3.id
where t1.shop_id = #{shopId}
<if test="productName != null and productName != ''">
and t2.name like concat('%', #{productName}, '%')
</if>
<if test="prodCategoryId != null">
and t2.category_id = #{prodCategoryId}
</if>
<if test="beginDate != null and beginDate != ''">
and t1.create_day >= str_to_date(#{beginDate}, '%Y-%m-%d')
</if>
<if test="endDate != null and endDate != ''">
<![CDATA[
and t1.create_day <= str_to_date(#{endDate}, '%Y-%m-%d')
]]>
</if>
group by t1.prod_id
ORDER BY sum( t1.sale_count ) DESC,max(t1.id) DESC
</select>
</mapper>