排单查询小板SQL参数修改

This commit is contained in:
liuzhaotian
2025-04-03 15:34:56 +08:00
parent b8b5a67b2e
commit 62221e096a
3 changed files with 47 additions and 12 deletions
@@ -43,7 +43,10 @@ public interface PlanItemMapper extends BaseMapperX<PlanItemDO> {
List<PlateInfoVO> selectOrderPlanPlateList(@Param("planIds") List<Long> planIds, @Param("organId") Long organId);
IPage<PlateResList> selectPlateListByPlateIds(@Param("page") IPage<PlateResList> page, @Param(Constants.WRAPPER) Wrapper<PlanItemDO> wrapper,@Param("organId") Long organId);
List<PlateResList> selectPlateListByPlateIds(@Param(Constants.WRAPPER) Wrapper<PlanItemDO> wrapper,@Param("pageNo") Integer pageNo,@Param("pageSize") Integer pageSize);
Long selectPlateCountByPlateIds(@Param(Constants.WRAPPER) Wrapper<PlanItemDO> wrapper);
IPage<OrderGoodsResp> selectNoPlanGoodsByRoomAndBodyIds(@Param("page") IPage page, @Param(Constants.WRAPPER) Wrapper<PlanItemDO> wrapper,@Param("organId") Long organId);
@@ -86,4 +89,5 @@ public interface PlanItemMapper extends BaseMapperX<PlanItemDO> {
.inIfPresent(PlanItemDO::getOrderId,orderIds)
.select(PlanItemDO::getGoodsId));
}
}
@@ -753,9 +753,19 @@ public class PlanServiceImpl implements PlanService {
if(vo.getPlanIds().isEmpty()){
return null;
}
for (Long planId : vo.getPlanIds()) {
validatePlan(planId);
List<Long> planIds = vo.getPlanIds();
List<PlanDO> planDOS = planMapper.selectBatchIds(planIds);
if(planDOS.size() != planIds.size()){
planDOS.forEach(f->{
if(!planIds.contains(f.getId())){
throw exception(PLAN_NOT_DATA_EXISTS,f.getId());
}
});
}
QueryWrapperX<PlanItemDO> queryWrapperX = new QueryWrapperX<>();
String filterTypes = "";
@@ -779,17 +789,18 @@ public class PlanServiceImpl implements PlanService {
.betweenIfPresent("op.height", new BigDecimal[]{vo.getLongMinRang(), vo.getLongMaxRang()})
.likeIfPresent("op.filter_type", insertSeparator(filterTypes));
PageDTO<PlateResList> page = new PageDTO<>(vo.getPageNo(), vo.getPageSize());
Integer pageNo = (vo.getPageNo() - 1) * vo.getPageSize();
IPage<PlateResList> pageResult = planItemMapper.selectPlateListByPlateIds(page,queryWrapperX,getUserOrganId());
List<PlateResList> pageResult = planItemMapper.selectPlateListByPlateIds(queryWrapperX,pageNo,vo.getPageSize());
if (CollUtil.isEmpty(pageResult.getRecords())) {
if (CollUtil.isEmpty(pageResult)) {
return new PageResult<>();
}
Long sum = planItemMapper.selectPlateCountByPlateIds(queryWrapperX);
return new PageResult<>(pageResult, sum);
return new PageResult<>(pageResult.getRecords(), pageResult.getTotal());
}
@@ -124,10 +124,30 @@
ob.room_name as roomName
from order_plan_item opi
join order_goods og on opi.order_id = og.order_id and opi.goods_id = og.id and og.organ_id = #{organId}
join order_plate op on opi.order_id = op.order_id and opi.goods_id = op.goods_id and opi.plate_id = op.id and op.organ_id = #{organId}
join order_item oi on op.order_id = oi.order_id and op.id = oi.plate_id and oi.organ_id = #{organId}
join order_body ob on oi.order_id = ob.order_id and oi.body_id = ob.id and ob.organ_id = #{organId}
join order_goods og on opi.order_id = og.order_id and opi.goods_id = og.id
join order_plate op on opi.order_id = op.order_id and opi.goods_id = op.goods_id and opi.plate_id = op.id
join order_item oi on op.order_id = oi.order_id and op.id = oi.plate_id
join order_body ob on oi.order_id = ob.order_id and oi.body_id = ob.id
${ew.customSqlSegment}
limit #{pageNo},#{pageSize};
</select>
<select id="selectPlateCountByPlateIds" resultType="java.lang.Long">
select count(distinct op.id)
from order_plan_item opi
join order_goods og on opi.order_id = og.order_id and opi.goods_id = og.id
join order_plate op on opi.order_id = op.order_id and opi.goods_id = op.goods_id and opi.plate_id = op.id
join order_item oi on op.order_id = oi.order_id and op.id = oi.plate_id
join order_body ob on oi.order_id = ob.order_id and oi.body_id = ob.id
${ew.customSqlSegment}