提交 1d2eef21 authored 作者: zhoushaopan's avatar zhoushaopan

feat(装备管理模块): 新增修改单位名称同时修改装备的所属所在

新增修改单位名称同时修改装备的所属所在
上级 4d78a7cd
...@@ -1133,10 +1133,18 @@ public class DeviceLibraryController { ...@@ -1133,10 +1133,18 @@ public class DeviceLibraryController {
@ApiOperation(value = "为工作交接查询装备", notes = "为工作交接查询装备") @ApiOperation(value = "为工作交接查询装备", notes = "为工作交接查询装备")
@GetMapping("/selectDeviceForWorkUse") @GetMapping("/selectDeviceForWorkUse")
@Transactional(rollbackFor = Exception.class)
public List<WorkUseVo> selectDeviceForWorkUse(){ public List<WorkUseVo> selectDeviceForWorkUse(){
return deviceLibraryService.getDevicesForWorkUse(); return deviceLibraryService.getDevicesForWorkUse();
} }
@ApiOperation(value = "修改单位名称", notes = "修改单位名称")
@PostMapping("/updateDeviceLocationAndOwnUnit")
@Transactional(rollbackFor = Exception.class)
public ResponseEntity<String> updateDeviceLocationAndOwnUnit(@RequestBody UpdateUnitVo updateUnitVo){
deviceLibraryService.updateDeviceLocationAndOwnUnit(updateUnitVo);
return ResponseEntity.ok("修改成功");
}
public List<DeviceLibrary> getAllListAndParent(){ public List<DeviceLibrary> getAllListAndParent(){
DeviceLibrarySelectVo deviceLibrarySelectVo = new DeviceLibrarySelectVo(); DeviceLibrarySelectVo deviceLibrarySelectVo = new DeviceLibrarySelectVo();
......
...@@ -228,5 +228,18 @@ public interface DeviceLibraryDao extends JpaRepository<DeviceLibrary, Integer>, ...@@ -228,5 +228,18 @@ public interface DeviceLibraryDao extends JpaRepository<DeviceLibrary, Integer>,
@Query("update DeviceLibrary o set o.storageLocation = :storageLocation where o.id in :deviceIds") @Query("update DeviceLibrary o set o.storageLocation = :storageLocation where o.id in :deviceIds")
int updateStorageLocation( @Param("storageLocation") String storageLocation, int updateStorageLocation( @Param("storageLocation") String storageLocation,
@Param("deviceIds") List<Integer> deviceIds); @Param("deviceIds") List<Integer> deviceIds);
@Transactional
@Modifying
@Query("update DeviceLibrary o set o.locationUnit = :updateUnitName where o.locationUnit = :originUnitName")
int updateLocationUnit(@Param("originUnitName") String originUnitName,
@Param("updateUnitName") String updateUnitName);
@Transactional
@Modifying
@Query("update DeviceLibrary o set o.ownUnit = :updateUnitName where o.ownUnit = :originUnitName")
int updateOwnUnit( @Param("originUnitName") String originUnitName,
@Param("updateUnitName") String updateUnitName);
} }
...@@ -505,4 +505,12 @@ public interface DeviceLibraryService { ...@@ -505,4 +505,12 @@ public interface DeviceLibraryService {
* @return WorkUseVos * @return WorkUseVos
*/ */
List<WorkUseVo> getDevicesForWorkUse(); List<WorkUseVo> getDevicesForWorkUse();
/**
* 修改单位名称则装备的所属所在也需要进行修改
* @param updateUnitVo 修改单位名称的vo
*/
void updateDeviceLocationAndOwnUnit(UpdateUnitVo updateUnitVo);
} }
...@@ -1203,6 +1203,15 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService { ...@@ -1203,6 +1203,15 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
return workUseVos; return workUseVos;
} }
@Override
@UpdateCache
public void updateDeviceLocationAndOwnUnit(UpdateUnitVo updateUnitVo) {
//先修改所在
deviceLibraryDao.updateLocationUnit(updateUnitVo.getOriginUnitName(),updateUnitVo.getUpdateUnitName());
//修改所属
deviceLibraryDao.updateOwnUnit(updateUnitVo.getOriginUnitName(),updateUnitVo.getUpdateUnitName());
}
// @Override // @Override
// @UpdateCache // @UpdateCache
// public int updatePartParentId(List<Integer> deviceIds) { // public int updatePartParentId(List<Integer> deviceIds) {
......
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;
import java.util.List;
/**
* @author zsp
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel("修改单位名称的vo")
public class UpdateUnitVo {
@ApiModelProperty(value = "原单位名称")
private String originUnitName;
@ApiModelProperty(value = "修改后单位名称")
private String updateUnitName;
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论