feat:食堂菜品购买统计

This commit is contained in:
dzc committed 2025-05-12 17:26:34 +08:00
1 parent b7c3751f68
commit 3808f2a26d
4 files changed
+27 -4

No files matched your search

@@ -14,4 +14,6 @@ public class HardCarDto extends HardCarEntity {
private LocalDate[] createTimeList;
private String hourType;
}
@@ -17,4 +17,7 @@ public class HardCanteenProductTotalVo {
@Schema(description = "食品总数量")
private Long payCount;
@Schema(description = "食品总价格")
private Long totalPrice;
}
@@ -50,7 +50,10 @@
</sql>
<select id="productTotal" resultType="com.bsd.pjcloud.hard.api.vo.order.HardCanteenProductTotalVo">
select DATE_FORMAT(a.create_time, '%Y-%m-%d') as createTime, o.hour_type, COUNT(a.product_count) as payCount
select DATE_FORMAT(a.create_time, '%Y-%m-%d') as createTime,
o.hour_type,
COUNT(a.product_count) as payCount,
SUM(a.total_price) as totalPrice
from hard_car a
inner join hard_parent_car p on a.parent_car_id = p.id and p.del_flag = '0'
inner join hard_order o on o.parent_car_id = p.id and o.del_flag = '0' and o.hour_type is not null
@@ -110,12 +113,27 @@
</if>
</where>
group by DATE_FORMAT(a.create_time, '%Y-%m-%d'), o.hour_type
order by DATE_FORMAT(a.create_time, '%Y-%m-%d') desc, o.hour_type;
order by DATE_FORMAT(a.create_time, '%Y-%m-%d') desc, o.hour_type desc;
</select>
<select id="proudctQuery" resultType="com.bsd.pjcloud.hard.api.vo.order.HardCarVo">
select a.product_id,
a.product_name,
a.product_pic,
a.product_price,
SUM(a.product_count) as count,
SUM(a.product_price) as totalPrice,
DATE_FORMAT(a.create_time, '%Y-%m-%d') as create_time
from hard_car a
inner join hard_parent_car p on a.parent_car_id = p.id and p.del_flag = '0'
inner join hard_order o on o.parent_car_id = p.id and o.del_flag = '0' and o.hour_type is not null
<where>
<include refid="whereA" />
<include refid="whereA"/>
<if test="dto.hourType != null and dto.hourType != '' ">
and o.hour_type = #{dto.hourType}
</if>
</where>
group by a.product_id
order by SUM(a.product_count) desc
</select>
</mapper>
@@ -29,7 +29,7 @@ import java.util.Map;
@SpringBootTest(classes = ThirdPartyApp.class)
public class PayTest {
private final String baseUrl = "127.0.0.1:9999";
private final String baseUrl = "http://123.156.230.15:8089/api";
private final String walletInfoUrl = "/third/third-pay-api/user-wallet";