feat(ebom): 调整批量查询物料信息接口
This commit is contained in:
parent
4cf4c95c83
commit
a724c8f2f4
|
|
@ -452,9 +452,14 @@ public class EbomApi extends BaseApi {
|
|||
return ResultVO.success(bomNewEbomParentService.getSource(rowId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量查询物料信息
|
||||
* @param query query
|
||||
* @return 物料信息
|
||||
*/
|
||||
@PostMapping("queryMaterials")
|
||||
@ApiOperation("批量查询物料信息")
|
||||
public ResultVO<List<BaseMaterialVO>> queryMaterials(@Valid @RequestBody QueryMaterialsQuery query) {
|
||||
public ResultVO<List<BaseMaterialVO>> queryMaterials(@Valid @RequestBody @NotEmpty List<QueryMaterialsQuery> query) {
|
||||
return ResultVO.success(bomNewEbomParentService.queryMaterials(query));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2350,13 +2350,23 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
return null;
|
||||
}
|
||||
|
||||
public List<BaseMaterialVO> queryMaterials(QueryMaterialsQuery query) {
|
||||
if (query.getType() == 0) {
|
||||
return SpringUtil.getBean(MaterialMainMapper.class).getMaterialBaseInfo(query.getKeys());
|
||||
} else if (query.getType() == 1) {
|
||||
return SpringUtil.getBean(MaterialMainMapper.class).getMaterialByDrawingNo(query.getKeys());
|
||||
} else {
|
||||
throw new NflgBusinessException(STATE.BusinessError, "无效的类别");
|
||||
public List<BaseMaterialVO> queryMaterials(List<QueryMaterialsQuery> query) {
|
||||
List<BaseMaterialVO> datas = new ArrayList<>();
|
||||
List<String> keys = query.stream().map(QueryMaterialsQuery::getMaterialNo)
|
||||
.filter(StrUtil::isNotBlank)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(keys)) {
|
||||
datas.addAll(SpringUtil.getBean(MaterialMainMapper.class).getMaterialBaseInfo(keys));
|
||||
}
|
||||
keys = query.stream()
|
||||
.filter(it -> StrUtil.isBlank(it.getMaterialNo()) && StrUtil.isNotBlank(it.getDrawingNo()))
|
||||
.map(QueryMaterialsQuery::getDrawingNo)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(keys)) {
|
||||
datas.addAll(SpringUtil.getBean(MaterialMainMapper.class).getMaterialByDrawingNo(keys));
|
||||
}
|
||||
return datas;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue