提交 7f688260 authored 作者: zhoushaopan's avatar zhoushaopan

feat(装备模块,3D模块): 修改接口接收的参数

修改接口接收的参数
上级 d0826a99
...@@ -40,23 +40,23 @@ public class DeviceLibraryPositionController { ...@@ -40,23 +40,23 @@ public class DeviceLibraryPositionController {
} }
@GetMapping("/findById") @GetMapping("/findById")
@ApiOperation(value = "根据id查询") @ApiOperation(value = "根据装备id查询")
public ResponseEntity<DeviceLibraryPosition> findById(Integer id){ public ResponseEntity<DeviceLibraryPosition> findById(Integer deviceId){
DeviceLibraryPosition deviceLibraryPosition = deviceLibraryPositionService.findById(id); DeviceLibraryPosition deviceLibraryPosition = deviceLibraryPositionService.findByDeviceId(deviceId);
return ResponseEntity.ok(deviceLibraryPosition); return ResponseEntity.ok(deviceLibraryPosition);
} }
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@GetMapping("/delete") @GetMapping("/delete")
@ApiOperation(value = "根据id删除") @ApiOperation(value = "根据装备id删除")
public ResponseEntity<String> deleteByPosition(Integer id){ public ResponseEntity<String> deleteByPosition(Integer deviceId){
deviceLibraryPositionService.deleteByPosition(id); deviceLibraryPositionService.deleteByDeviceId(deviceId);
return ResponseEntity.ok("删除成功"); return ResponseEntity.ok("删除成功");
} }
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@PostMapping("/fnUpdatePostionMessage") @PostMapping("/fnUpdatePostionMessage")
@ApiOperation(value = "批量修改x y z位置",notes = "修改x y z") @ApiOperation(value = "批量修改x y z 和u位置",notes = "修改x y z")
public ResponseEntity<String> fnUpdatePostionMessage(@RequestBody List<UpdatePostionMessageVO> updatePostionMessageVOS){ public ResponseEntity<String> fnUpdatePostionMessage(@RequestBody List<UpdatePostionMessageVO> updatePostionMessageVOS){
deviceLibraryPositionService.fnUpdatePostionMessage(updatePostionMessageVOS); deviceLibraryPositionService.fnUpdatePostionMessage(updatePostionMessageVOS);
return ResponseEntity.ok("修改成功"); return ResponseEntity.ok("修改成功");
......
...@@ -20,11 +20,15 @@ public interface DeviceLibraryPositionDao extends JpaRepository<DeviceLibraryPos ...@@ -20,11 +20,15 @@ public interface DeviceLibraryPositionDao extends JpaRepository<DeviceLibraryPos
List<DeviceLibraryPosition> findAllByDeviceIdIn(List<Integer> deviceIds); List<DeviceLibraryPosition> findAllByDeviceIdIn(List<Integer> deviceIds);
void deleteByDeviceId(Integer deviceId);
@Transactional @Transactional
@Modifying @Modifying
@Query("update DeviceLibraryPosition d set d.deviceLibraryPositionMessage = :deviceLibraryPositionMessage where d.id = :id") @Query("update DeviceLibraryPosition d set d.deviceLibraryPositionMessage = :deviceLibraryPositionMessage, " +
"d.uNum = :uNum where d.deviceId = :deviceId")
int fnUpdatePostionMessage(@Param("deviceLibraryPositionMessage") String deviceLibraryPositionMessage, int fnUpdatePostionMessage(@Param("deviceLibraryPositionMessage") String deviceLibraryPositionMessage,
@Param("id")Integer id); @Param("uNum") String uNum,
@Param("deviceId")Integer deviceId);
} }
...@@ -36,6 +36,13 @@ public interface DeviceLibraryPositionService { ...@@ -36,6 +36,13 @@ public interface DeviceLibraryPositionService {
*/ */
DeviceLibraryPosition findById(Integer id); DeviceLibraryPosition findById(Integer id);
/**
* 根据id查询单个对象
* @param deviceId 装备id
* @return 一个对象
*/
DeviceLibraryPosition findByDeviceId(Integer deviceId);
/** /**
* 根据id进行删除 * 根据id进行删除
* @param id id * @param id id
...@@ -43,11 +50,10 @@ public interface DeviceLibraryPositionService { ...@@ -43,11 +50,10 @@ public interface DeviceLibraryPositionService {
void deleteByPosition(Integer id); void deleteByPosition(Integer id);
/** /**
* 根据装备id查询 * 根据id进行删除
* @param deviceId 装备的id * @param deviceId id
* @return 对象
*/ */
DeviceLibraryPosition findByDeviceId(Integer deviceId); void deleteByDeviceId(Integer deviceId);
/** /**
* 根据装备id的集合进行查询 * 根据装备id的集合进行查询
......
...@@ -50,6 +50,11 @@ public class DeviceLibraryPositionServiceImpl implements DeviceLibraryPositionSe ...@@ -50,6 +50,11 @@ public class DeviceLibraryPositionServiceImpl implements DeviceLibraryPositionSe
deviceLibraryPositionDao.deleteById(id); deviceLibraryPositionDao.deleteById(id);
} }
@Override
public void deleteByDeviceId(Integer deviceId) {
deviceLibraryPositionDao.deleteByDeviceId(deviceId);
}
@Override @Override
public DeviceLibraryPosition findByDeviceId(Integer deviceId) { public DeviceLibraryPosition findByDeviceId(Integer deviceId) {
return deviceLibraryPositionDao.findByDeviceId(deviceId); return deviceLibraryPositionDao.findByDeviceId(deviceId);
...@@ -65,7 +70,8 @@ public class DeviceLibraryPositionServiceImpl implements DeviceLibraryPositionSe ...@@ -65,7 +70,8 @@ public class DeviceLibraryPositionServiceImpl implements DeviceLibraryPositionSe
if (!updatePostionMessageVO.isEmpty()){ if (!updatePostionMessageVO.isEmpty()){
updatePostionMessageVO.forEach(updatePostionMessageVO1 -> { updatePostionMessageVO.forEach(updatePostionMessageVO1 -> {
String json = updatePostionMessageVO1.getDeviceLibraryPositionMessageVo().toJson(); String json = updatePostionMessageVO1.getDeviceLibraryPositionMessageVo().toJson();
deviceLibraryPositionDao.fnUpdatePostionMessage(json, updatePostionMessageVO1.getId()); deviceLibraryPositionDao.fnUpdatePostionMessage(json, updatePostionMessageVO1.getUNum(),
updatePostionMessageVO1.getDeviceId());
}); });
} }
} }
......
...@@ -1327,14 +1327,9 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService { ...@@ -1327,14 +1327,9 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
pageAllVo = allVOS.stream().filter(allVO -> { pageAllVo = allVOS.stream().filter(allVO -> {
DeviceLibraryPosition deviceLibraryPosition = allVO.getDeviceLibraryPosition(); DeviceLibraryPosition deviceLibraryPosition = allVO.getDeviceLibraryPosition();
if (deviceLibraryPosition != null) { if (deviceLibraryPosition != null) {
String deviceLibraryPositionName = deviceLibraryPosition.getDeviceLibraryPositionName(); Integer ifCabinet = deviceLibraryPosition.getIfCabinet();
if (deviceLibraryPositionName == null) { return ifCabinet == 0;
return true;
}else {
return false;
}
}else { }else {
//为空 说明该装备不在3D库中
return false; return false;
} }
}).collect(Collectors.toList()); }).collect(Collectors.toList());
...@@ -1343,6 +1338,8 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService { ...@@ -1343,6 +1338,8 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
} }
Page<AllVO> allVOPage = PageUtil.getPerPage(queryTheWarehouseVo.getPage(), Page<AllVO> allVOPage = PageUtil.getPerPage(queryTheWarehouseVo.getPage(),
queryTheWarehouseVo.getSize(), pageAllVo, queryTheWarehouseVo.getPageable()); queryTheWarehouseVo.getSize(), pageAllVo, queryTheWarehouseVo.getPageable());
//不分页的数据
map.put("pageAllVo",pageAllVo);
List<DeviceLibrary> collect = pageAllVo.stream().map(AllVO::getDeviceLibrary).collect(Collectors.toList()); List<DeviceLibrary> collect = pageAllVo.stream().map(AllVO::getDeviceLibrary).collect(Collectors.toList());
List<String> models = List<String> models =
collect.stream().map(DeviceLibrary::getModel).distinct().collect(Collectors.toList()); collect.stream().map(DeviceLibrary::getModel).distinct().collect(Collectors.toList());
......
...@@ -14,10 +14,13 @@ import lombok.Data; ...@@ -14,10 +14,13 @@ import lombok.Data;
@ApiModel("修改xyz") @ApiModel("修改xyz")
public class UpdatePostionMessageVO extends CustomPage { public class UpdatePostionMessageVO extends CustomPage {
@ApiModelProperty(value = "id", example = "1") @ApiModelProperty(value = "装备id", example = "1")
public Integer id; public Integer deviceId;
@ApiModelProperty(value = "位置类vo", example = "1") @ApiModelProperty(value = "位置类vo", example = "1")
private DeviceLibraryPositionMessageVo deviceLibraryPositionMessageVo; private DeviceLibraryPositionMessageVo deviceLibraryPositionMessageVo;
@ApiModelProperty(value = "u位",notes = "1-1")
private String uNum;
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论