|
|
|
|
@@ -11,13 +11,14 @@ import lombok.RequiredArgsConstructor;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import com.klp.mes.eqp.domain.bo.EqpEquipmentPartBo;
|
|
|
|
|
import com.klp.mes.eqp.domain.vo.EqpEquipmentPartVo;
|
|
|
|
|
import com.klp.mes.eqp.domain.vo.EqpEquipmentChecklistVo;
|
|
|
|
|
import com.klp.mes.eqp.domain.EqpEquipmentPart;
|
|
|
|
|
import com.klp.mes.eqp.domain.EqpEquipmentChecklist;
|
|
|
|
|
import com.klp.mes.eqp.mapper.EqpEquipmentPartMapper;
|
|
|
|
|
import com.klp.mes.eqp.mapper.EqpEquipmentChecklistMapper;
|
|
|
|
|
import com.klp.mes.eqp.service.IEqpEquipmentPartService;
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.Collection;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@@ -31,6 +32,7 @@ import java.util.stream.Collectors;
|
|
|
|
|
public class EqpEquipmentPartServiceImpl implements IEqpEquipmentPartService {
|
|
|
|
|
|
|
|
|
|
private final EqpEquipmentPartMapper baseMapper;
|
|
|
|
|
private final EqpEquipmentChecklistMapper checklistMapper;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询检验部位
|
|
|
|
|
@@ -47,7 +49,18 @@ public class EqpEquipmentPartServiceImpl implements IEqpEquipmentPartService {
|
|
|
|
|
public TableDataInfo<EqpEquipmentPartVo> queryPageList(EqpEquipmentPartBo bo, PageQuery pageQuery) {
|
|
|
|
|
LambdaQueryWrapper<EqpEquipmentPart> lqw = buildQueryWrapper(bo);
|
|
|
|
|
Page<EqpEquipmentPartVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
|
|
|
|
result.getRecords().stream().map(EqpEquipmentPartVo::getPartId).collect(Collectors.toList());
|
|
|
|
|
List<Long> partIds = result.getRecords().stream()
|
|
|
|
|
.map(EqpEquipmentPartVo::getPartId).collect(Collectors.toList());
|
|
|
|
|
if (!partIds.isEmpty()) {
|
|
|
|
|
LambdaQueryWrapper<EqpEquipmentChecklist> checklistLqw = Wrappers.lambdaQuery();
|
|
|
|
|
checklistLqw.in(EqpEquipmentChecklist::getPartId, partIds);
|
|
|
|
|
List<EqpEquipmentChecklistVo> checklistList = checklistMapper.selectVoList(checklistLqw);
|
|
|
|
|
Map<Long, List<EqpEquipmentChecklistVo>> checklistMap = checklistList.stream()
|
|
|
|
|
.collect(Collectors.groupingBy(EqpEquipmentChecklistVo::getPartId));
|
|
|
|
|
result.getRecords().forEach(vo ->
|
|
|
|
|
vo.setChecklistList(checklistMap.getOrDefault(vo.getPartId(), Collections.emptyList()))
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
return TableDataInfo.build(result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|