提交 368c48a3 authored 作者: zhoushaopan's avatar zhoushaopan

feat(装备模块): 新增根据装备id查询所有配件接口

新增根据装备id查询所有配件接口
上级 e003c2b7
...@@ -1273,6 +1273,14 @@ public class DeviceLibraryController { ...@@ -1273,6 +1273,14 @@ public class DeviceLibraryController {
return ResponseEntity.ok("导入成功"); return ResponseEntity.ok("导入成功");
} }
@Transactional(rollbackFor = Exception.class)
@GetMapping("/findParts")
@ApiOperation(value = "根据装备id查询配件")
public ResponseEntity<List<PartsVo>> findParts(Integer deviceId){
List<PartsVo> allParts = deviceLibraryService.findAllParts(deviceId);
return ResponseEntity.ok(allParts);
}
// @ApiOperation(value = "修改单位名称", notes = "修改单位名称") // @ApiOperation(value = "修改单位名称", notes = "修改单位名称")
// @PostMapping("/updateDeviceLocationAndOwnUnit") // @PostMapping("/updateDeviceLocationAndOwnUnit")
......
...@@ -567,4 +567,11 @@ public interface DeviceLibraryService { ...@@ -567,4 +567,11 @@ public interface DeviceLibraryService {
void batchUpdateDevicesByPackingIds(String newModel,List<Integer> packingIds); void batchUpdateDevicesByPackingIds(String newModel,List<Integer> packingIds);
void importData(); void importData();
/**
* 配件的集合
* @param deviceId 装备id
* @return 配件的集合
*/
List<PartsVo> findAllParts(Integer deviceId);
} }
...@@ -1463,6 +1463,18 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService { ...@@ -1463,6 +1463,18 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
deviceLibraryPositionService.batchDeviceLibraryPositions(deviceLibraryPositions); deviceLibraryPositionService.batchDeviceLibraryPositions(deviceLibraryPositions);
} }
@Override
public List<PartsVo> findAllParts(Integer deviceId) {
List<DeviceLibrary> deviceLibraries = deviceLibraryDao.findAllByPartParentId(deviceId);
List<PartsVo> partsVos = new ArrayList<>();
deviceLibraries.forEach(deviceLibrary -> {
PartsVo partsVo = new PartsVo();
BeanUtils.copyProperties(deviceLibrary,partsVo);
partsVos.add(partsVo);
});
return partsVos;
}
private Specification<DeviceLibrary> getSelectSpecification(DeviceLibrarySelectVo deviceLibrarySelectVo) { private Specification<DeviceLibrary> getSelectSpecification(DeviceLibrarySelectVo deviceLibrarySelectVo) {
PredicateBuilder<DeviceLibrary> predicateBuilder = getPredicateBuilder(deviceLibrarySelectVo); PredicateBuilder<DeviceLibrary> predicateBuilder = getPredicateBuilder(deviceLibrarySelectVo);
//unitId为空,默认查询当前单位 //unitId为空,默认查询当前单位
......
package com.tykj.dev.device.library.subject.vo;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author zsp
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel("根据装备id查询配件的vo")
public class PartsVo {
@ApiModelProperty(value = "型号")
private String model;
@ApiModelProperty(value = "名称")
private String name;
@ApiModelProperty(value = "序列号")
private String seqNumber;
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论