refactor(shop): 移除冗余日志并优化订单查询

- 移除 `ShopController` 和 `ShopGoodsServiceImpl` 中的冗余日志记录
- 在 `ShopOrderMapper` 中添加 `cabinet_cell` 表的连接以优化订单查询
- 在 `SearchShopOrderQuery` 中添加 `cabinetId` 查询条件以支持按柜子ID筛选订单
This commit is contained in:
dzq 2025-05-09 16:05:52 +08:00
parent 931bbd1a4b
commit 4655eb4df0
4 changed files with 3 additions and 2 deletions

View File

@ -40,7 +40,6 @@ public class ShopController {
@GetMapping("/goods") @GetMapping("/goods")
public ResponseDTO<ShopGoodsResponse> getShopGoodsInfo(@RequestParam(required = false) Long shopId) { public ResponseDTO<ShopGoodsResponse> getShopGoodsInfo(@RequestParam(required = false) Long shopId) {
log.info("getShopGoodsInfo shopId: {}", shopId);
/*// 获取商品列表 /*// 获取商品列表
List<ShopGoodsEntity> goodsList = goodsApplicationService.getGoodsAll(); List<ShopGoodsEntity> goodsList = goodsApplicationService.getGoodsAll();
goodsList.forEach(goods -> { goodsList.forEach(goods -> {

View File

@ -37,7 +37,6 @@ public class ShopGoodsServiceImpl extends ServiceImpl<ShopGoodsMapper, ShopGoods
if (shopId == null) { if (shopId == null) {
return baseMapper.getGoodsWithCabinetList(); return baseMapper.getGoodsWithCabinetList();
} else { } else {
log.info("getGoodsWithCabinetList shopId: {}", shopId);
return baseMapper.getGoodsWithCabinetListByShopId(shopId); return baseMapper.getGoodsWithCabinetListByShopId(shopId);
} }
} }

View File

@ -23,6 +23,7 @@ public interface ShopOrderMapper extends BaseMapper<ShopOrderEntity> {
"GROUP_CONCAT(DISTINCT og.cover_img) AS coverImgs " + "GROUP_CONCAT(DISTINCT og.cover_img) AS coverImgs " +
"FROM shop_order o " + "FROM shop_order o " +
"LEFT JOIN shop_order_goods og ON o.order_id = og.order_id AND og.deleted = 0 " + "LEFT JOIN shop_order_goods og ON o.order_id = og.order_id AND og.deleted = 0 " +
"LEFT JOIN cabinet_cell cc ON cc.cell_id = og.cell_id " +
"${ew.customSqlSegment}") "${ew.customSqlSegment}")
Page<OrderWithGoodsDTO> getOrderList( Page<OrderWithGoodsDTO> getOrderList(
Page<OrderWithGoodsDTO> page, Page<OrderWithGoodsDTO> page,

View File

@ -14,6 +14,7 @@ public class SearchShopOrderQuery<T> extends AbstractPageQuery<T> {
private Long orderId; private Long orderId;
private Long cellId; private Long cellId;
private Long cabinetId;
private Integer status; private Integer status;
private Integer payStatus; private Integer payStatus;
private Date startTime; private Date startTime;
@ -28,6 +29,7 @@ public class SearchShopOrderQuery<T> extends AbstractPageQuery<T> {
queryWrapper queryWrapper
.eq(orderId != null, "o.order_id", orderId) .eq(orderId != null, "o.order_id", orderId)
.eq(cellId != null, "og.cell_id", cellId) .eq(cellId != null, "og.cell_id", cellId)
.eq(cabinetId != null, "cc.cabinet_id", cabinetId)
.eq(status != null, "o.status", status) .eq(status != null, "o.status", status)
.eq(payStatus != null, "o.pay_status", payStatus) .eq(payStatus != null, "o.pay_status", payStatus)
.eq(StrUtil.isNotEmpty(paymentMethod), "o.payment_method", paymentMethod) .eq(StrUtil.isNotEmpty(paymentMethod), "o.payment_method", paymentMethod)