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

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

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