提交 ab9f7b9c authored 作者: zhoushaopan's avatar zhoushaopan

fix(装备模块,3D模块): 修改查询不到库房id为null的bug

修改查询不到库房id为null的bug
上级 8267e085
......@@ -1184,7 +1184,7 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
if (!CollectionUtils.isEmpty(deviceIds)){
//添加装备日志
deviceIds.forEach(integer -> {
if (updateStorageLocationVo.getStorageLocationId() != getOne(integer).getStorageLocationId()){
if (!updateStorageLocationVo.getStorageLocationId().equals(getOne(integer).getStorageLocationId())){
DeviceLogDto deviceLogDto= new DeviceLogDto(integer,"将存放位置修改为"+
updateStorageLocationVo.getStorageLocation(),null,userId);
deviceLogDtos.add(deviceLogDto);
......@@ -1284,7 +1284,9 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
DeviceLibrarySelectVo deviceLibrarySelectVo = new DeviceLibrarySelectVo();
BeanUtils.copyProperties(queryTheWarehouseVo,deviceLibrarySelectVo);
PredicateBuilder<DeviceLibrary> predicateBuilder = getPredicateBuilder(deviceLibrarySelectVo);
List<DeviceLibrary> deviceLibraries = deviceLibraryDao.findAll(predicateBuilder.build());
Specification<DeviceLibrary> or =
predicateBuilder.build().or(getPredicateBuilder2(deviceLibrarySelectVo.getNonStorageLocationId()).build());
List<DeviceLibrary> deviceLibraries = deviceLibraryDao.findAll(or);
deviceLibraries.forEach(DeviceLibrary::setConfigName);
//拿到所有的装备id
List<Integer> deviceIds = deviceLibraries.stream().map(DeviceLibrary::getId).collect(Collectors.toList());
......@@ -1520,15 +1522,26 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
//新增装备的形态
predicateBuilder.eq(deviceLibrarySelectVo.getType() != null,"type",deviceLibrarySelectVo.getType());
//新增库房集合查询
if (deviceLibrarySelectVo.getStorageLocationIds() != null){
predicateBuilder.notIn("storageLocationId",
deviceLibrarySelectVo.getStorageLocationIds().toArray(new Integer[]{}));
}
// if (deviceLibrarySelectVo.getStorageLocationIds() != null){
// predicateBuilder.notIn("storageLocationId",
// deviceLibrarySelectVo.getStorageLocationIds().toArray(new Integer[]{}));
// }
predicateBuilder.ne(deviceLibrarySelectVo.getNonStorageLocationId() != null,"storageLocationId",deviceLibrarySelectVo.getNonStorageLocationId());
}
return predicateBuilder;
}
/**
* 查询库房id为null 取反
* @param nonStorageLocationId 库房id
* @return PredicateBuilder
*/
private PredicateBuilder<DeviceLibrary> getPredicateBuilder2(Integer nonStorageLocationId) {
PredicateBuilder<DeviceLibrary> predicateBuilder = Specifications.and();
predicateBuilder.eq(nonStorageLocationId != null, "storageLocationId",null);
return predicateBuilder;
}
private List<String> getAllModel() {
List<DeviceLibrary> list = deviceLibraryDao.findAll();
Set<String> s = new HashSet<>();
......
......@@ -36,4 +36,7 @@ public class QueryTheWarehouseVo extends CustomPage {
@ApiModelProperty(value = "出库")
private Integer out;
@ApiModelProperty(value = "库房id")
private Integer nonStorageLocationId;
}
......@@ -140,4 +140,7 @@ public class DeviceLibrarySelectVo extends CustomPage {
@ApiModelProperty(value = "库房ids")
private List<Integer> storageLocationIds;
@ApiModelProperty(value = "库房id")
private Integer nonStorageLocationId;
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论