feat(智能柜): 添加订单关联字段以支持订单信息展示

在CabinetCellEntity、CabinetDetailDTO和SmartCabinetApplicationService中添加orderId和orderGoodsId字段
修改CabinetCellMapper查询以获取关联订单信息
This commit is contained in:
dzq 2025-07-03 09:35:38 +08:00
parent ebe6ac21c6
commit 11743ff77d
4 changed files with 13 additions and 1 deletions

View File

@ -77,6 +77,14 @@ public class CabinetCellEntity extends BaseEntity<CabinetCellEntity> {
@TableField("goods_id") @TableField("goods_id")
private Long goodsId; private Long goodsId;
@ApiModelProperty("关联订单ID")
@TableField(exist = false)
private Long orderId;
@ApiModelProperty("关联订单商品ID")
@TableField(exist = false)
private Long orderGoodsId;
@Override @Override
public Serializable pkVal() { public Serializable pkVal() {

View File

@ -112,7 +112,7 @@ public interface CabinetCellMapper extends BaseMapper<CabinetCellEntity> {
"${ew.customSqlSegment} ") "${ew.customSqlSegment} ")
List<CabinetCellLatestOrderDTO> selectLatestOrderInfoByCell(@Param(Constants.WRAPPER) Wrapper<?> queryWrapper); List<CabinetCellLatestOrderDTO> selectLatestOrderInfoByCell(@Param(Constants.WRAPPER) Wrapper<?> queryWrapper);
@Select("SELECT DISTINCT cc.* " + @Select("SELECT DISTINCT cc.*, sog.order_id as orderId, sog.order_goods_id as orderGoodsId " +
"FROM cabinet_cell cc " + "FROM cabinet_cell cc " +
"INNER JOIN shop_order_goods sog ON cc.cell_id = sog.cell_id AND sog.deleted = 0 " + "INNER JOIN shop_order_goods sog ON cc.cell_id = sog.cell_id AND sog.deleted = 0 " +
"INNER JOIN shop_order so ON sog.order_id = so.order_id AND so.deleted = 0 " + "INNER JOIN shop_order so ON sog.order_id = so.order_id AND so.deleted = 0 " +

View File

@ -353,6 +353,8 @@ public class SmartCabinetApplicationService {
cellInfo.setPinNo(cell.getPinNo()); cellInfo.setPinNo(cell.getPinNo());
cellInfo.setStock(cell.getStock()); cellInfo.setStock(cell.getStock());
cellInfo.setCellPrice(cell.getCellPrice()); cellInfo.setCellPrice(cell.getCellPrice());
cellInfo.setOrderId(cell.getOrderId());
cellInfo.setOrderGoodsId(cell.getOrderGoodsId());
return cellInfo; return cellInfo;
}).collect(Collectors.toList()); }).collect(Collectors.toList());

View File

@ -19,6 +19,8 @@ public class CabinetDetailDTO {
private Integer pinNo; private Integer pinNo;
private Integer stock; private Integer stock;
private BigDecimal cellPrice; private BigDecimal cellPrice;
private Long orderId;
private Long orderGoodsId;
private ProductInfoDTO product; private ProductInfoDTO product;
} }