mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
小程序 部件查询配件优化、速度优化
This commit is contained in:
+1
-1
@@ -1068,7 +1068,7 @@ public class PackServiceImpl implements PackService {
|
|||||||
PlateDO plate = plateService.getPlateByNo(id, ArrayUtil.toArray(orderIds, Long.class));
|
PlateDO plate = plateService.getPlateByNo(id, ArrayUtil.toArray(orderIds, Long.class));
|
||||||
AssertUtils.notEmpty(plate, PLATE_NOT_EXISTS);
|
AssertUtils.notEmpty(plate, PLATE_NOT_EXISTS);
|
||||||
// 查询关联部件id
|
// 查询关联部件id
|
||||||
itemDOS = orderItemService.getPlateItemCompId(plate.getId());
|
itemDOS = orderItemService.getPlateItemCompId(plate.getOrderId(), plate.getId());
|
||||||
} else {
|
} else {
|
||||||
Long partsId = Long.valueOf(id);
|
Long partsId = Long.valueOf(id);
|
||||||
// 配件
|
// 配件
|
||||||
|
|||||||
+1
-1
@@ -18,7 +18,7 @@ public interface OrderItemService {
|
|||||||
* @param plateId
|
* @param plateId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<OrderItemDO> getPlateItemCompId(Long plateId);
|
List<OrderItemDO> getPlateItemCompId(Long orderId, Long plateId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询配件订单明细关联的部件id
|
* 查询配件订单明细关联的部件id
|
||||||
|
|||||||
+2
-1
@@ -22,9 +22,10 @@ public class OrderItemServiceImpl implements OrderItemService {
|
|||||||
private OrderItemMapper orderItemMapper;
|
private OrderItemMapper orderItemMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<OrderItemDO> getPlateItemCompId(Long id) {
|
public List<OrderItemDO> getPlateItemCompId(Long orderId, Long id) {
|
||||||
List<OrderItemDO> plateItemDOS = orderItemMapper.selectList(new LambdaQueryWrapper<OrderItemDO>()
|
List<OrderItemDO> plateItemDOS = orderItemMapper.selectList(new LambdaQueryWrapper<OrderItemDO>()
|
||||||
.eq(OrderItemDO::getPlateId, id)
|
.eq(OrderItemDO::getPlateId, id)
|
||||||
|
.eq(OrderItemDO::getOrderId, orderId)
|
||||||
.select(OrderItemDO::getCompId, OrderItemDO::getGroupId, OrderItemDO::getBodyId));
|
.select(OrderItemDO::getCompId, OrderItemDO::getGroupId, OrderItemDO::getBodyId));
|
||||||
if (CollUtil.isNotEmpty(plateItemDOS)) {
|
if (CollUtil.isNotEmpty(plateItemDOS)) {
|
||||||
return plateItemDOS;
|
return plateItemDOS;
|
||||||
|
|||||||
+1
-1
@@ -1431,7 +1431,7 @@ public class PlateServiceImpl implements PlateService {
|
|||||||
if (CollUtil.isNotEmpty(bodyIds)) {
|
if (CollUtil.isNotEmpty(bodyIds)) {
|
||||||
detailReqVO.setBodyIds(bodyIds);
|
detailReqVO.setBodyIds(bodyIds);
|
||||||
} else {
|
} else {
|
||||||
List<OrderItemDO> plateItems = orderItemService.getPlateItemCompId(plateDO.getId());
|
List<OrderItemDO> plateItems = orderItemService.getPlateItemCompId(plateDO.getOrderId(), plateDO.getId());
|
||||||
if (CollUtil.isEmpty(plateItems)) {
|
if (CollUtil.isEmpty(plateItems)) {
|
||||||
throw new ServiceException(PLATE_NOT_EXISTS);
|
throw new ServiceException(PLATE_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
|
|||||||
+18
-13
@@ -889,25 +889,30 @@
|
|||||||
SELECT parts_id,
|
SELECT parts_id,
|
||||||
body_id,
|
body_id,
|
||||||
cad_view_id,
|
cad_view_id,
|
||||||
SUM(num) AS num
|
<choose>
|
||||||
<if test="componentIds != null and componentIds.size() > 0">
|
<when test="componentIds != null and componentIds.size() > 0">
|
||||||
, MIN(comp_id) AS comp_id
|
MIN(num) AS num,
|
||||||
</if>
|
MIN(comp_id) AS comp_id
|
||||||
FROM order_item
|
FROM order_item
|
||||||
WHERE order_id = #{orderId} and parts_id != 0 and source_id = 0
|
WHERE order_id = #{orderId} and parts_id != 0 and source_id = 0
|
||||||
and ((group_id is null and comp_id is null) or group_id = 0)
|
AND comp_id IN
|
||||||
|
<foreach item="componentId" collection="componentIds" open="(" separator="," close=")">
|
||||||
|
#{componentId}
|
||||||
|
</foreach>
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
SUM(num) AS num
|
||||||
|
FROM order_item
|
||||||
|
WHERE order_id = #{orderId} and parts_id != 0 and source_id = 0
|
||||||
|
and ((group_id is null and comp_id is null) or group_id = 0)
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
<if test="bodyIds != null and bodyIds.size() > 0">
|
<if test="bodyIds != null and bodyIds.size() > 0">
|
||||||
AND body_id IN
|
AND body_id IN
|
||||||
<foreach item="bodyId" collection="bodyIds" open="(" separator="," close=")">
|
<foreach item="bodyId" collection="bodyIds" open="(" separator="," close=")">
|
||||||
#{bodyId}
|
#{bodyId}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
<if test="componentIds != null and componentIds.size() > 0">
|
|
||||||
AND comp_id IN
|
|
||||||
<foreach item="componentId" collection="componentIds" open="(" separator="," close=")">
|
|
||||||
#{componentId}
|
|
||||||
</foreach>
|
|
||||||
</if>
|
|
||||||
GROUP BY body_id, parts_id, cad_view_id
|
GROUP BY body_id, parts_id, cad_view_id
|
||||||
) t ON t.parts_id = op.id
|
) t ON t.parts_id = op.id
|
||||||
JOIN order_body ob ON ob.order_id = op.order_id and ob.id = t.body_id
|
JOIN order_body ob ON ob.order_id = op.order_id and ob.id = t.body_id
|
||||||
|
|||||||
Reference in New Issue
Block a user