feat:商品统计权限

This commit is contained in:
dzc committed 2026-06-16 17:17:04 +08:00
1 parent 0b81ac20ca
commit 04990cb1bd
3 files changed
+15

No files matched your search

@@ -21,4 +21,6 @@ public class HardCarDto extends HardCarEntity {
private Long merchantId;
private List<Long> mchIds;
}
@@ -133,6 +133,13 @@ public class HardCanteenTotalController {
@Operation(summary = "菜品出售商户统计", description = "菜品出售商户统计")
@PostMapping("/proudct-mch-query")
public R<Page<HardCarVo>> proudctMchQuery(@ParameterObject Page page, @RequestBody HardCarDto dto) {
// 查询商户
MchManageDto mchManageDto = new MchManageDto();
mchManageDto.setTypesList(List.of(MerchantTypeEnum.CANTEEN.getType()));
List<MchManageVo> mchList = remoteMchService.scopeList(mchManageDto).getData();
if (ObjectUtil.isNotEmpty(mchList) && ObjectUtil.isEmpty(dto.getMchIds())) {
dto.setMchIds(mchList.stream().map(MchManageVo::getId).toList());
}
return R.ok(canteenTotalService.proudctMchQuery(page, dto));
}
@@ -261,6 +261,12 @@
<if test="dto.productName != null and dto.productName != '' ">
and a.product_name LIKE concat('%',#{dto.productName},'%')
</if>
<if test="dto.mchIds != null and dto.mchIds.size() != 0">
and o.merchant_id in
<foreach collection="dto.mchIds" item="v" open="(" close=")" separator=",">
#{v}
</foreach>
</if>
</where>
group by o.merchant_id, a.product_id
order by o.merchant_id, SUM(a.product_count) desc