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

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

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