feat(eqp): 添加检验部位关联检验清单功能
- 引入 EqpEquipmentChecklistVo 和 EqpEquipmentChecklist 实体类 - 添加 EqpEquipmentChecklistMapper 数据访问层依赖 - 在查询检验部位分页列表时关联查询检验清单数据 - 将检验清单列表映射到检验部位视图对象中 - 优化导入包使用通配符简化代码 - 在 EqpEquipmentPartVo 中添加 checklistList 字段存储关联清单数据
This commit is contained in:
@@ -6,6 +6,8 @@ import com.klp.common.annotation.ExcelDictFormat;
|
||||
import com.klp.common.convert.ExcelDictConvert;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 检验部位视图对象 eqp_equipment_part
|
||||
@@ -37,5 +39,9 @@ public class EqpEquipmentPartVo {
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 检验清单列表
|
||||
*/
|
||||
private List<EqpEquipmentChecklistVo> checklistList;
|
||||
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user