优化代码
This commit is contained in:
parent
1a110afcf8
commit
cb340a99fc
@ -59,6 +59,13 @@ public class AlgorithmArrangeController {
|
|||||||
@PostMapping("/saveAlgorithmArrange")
|
@PostMapping("/saveAlgorithmArrange")
|
||||||
@ApiOperation("新增算法布点")
|
@ApiOperation("新增算法布点")
|
||||||
public ResponseResult saveAlgorithmArrange(AlgorithmArrange algorithmArrange, MultipartFile file) {
|
public ResponseResult saveAlgorithmArrange(AlgorithmArrange algorithmArrange, MultipartFile file) {
|
||||||
|
|
||||||
|
// 判断是否存在相同的方案
|
||||||
|
LambdaQueryWrapper<AlgorithmArrange> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(AlgorithmArrange::getArrangeName, algorithmArrange.getArrangeName());
|
||||||
|
if (algorithmArrangeService.getOne(queryWrapper) != null) {
|
||||||
|
return ResponseResult.error("方案名称已存在");
|
||||||
|
}
|
||||||
algorithmArrange.setLastmodifier("admin");
|
algorithmArrange.setLastmodifier("admin");
|
||||||
algorithmArrange.setLastmodifydate(LocalDateTime.now());
|
algorithmArrange.setLastmodifydate(LocalDateTime.now());
|
||||||
algorithmArrange.setDatastatus("1");
|
algorithmArrange.setDatastatus("1");
|
||||||
@ -85,6 +92,12 @@ public class AlgorithmArrangeController {
|
|||||||
@PostMapping("/updateAlgorithmArrange")
|
@PostMapping("/updateAlgorithmArrange")
|
||||||
@ApiOperation("修改算法布点")
|
@ApiOperation("修改算法布点")
|
||||||
public ResponseResult updateAlgorithmArrange(AlgorithmArrange algorithmArrange, MultipartFile file) {
|
public ResponseResult updateAlgorithmArrange(AlgorithmArrange algorithmArrange, MultipartFile file) {
|
||||||
|
// 判断是否存在相同的方案
|
||||||
|
LambdaQueryWrapper<AlgorithmArrange> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.ne(AlgorithmArrange::getId, algorithmArrange.getId()).eq(AlgorithmArrange::getArrangeName, algorithmArrange.getArrangeName());
|
||||||
|
if (algorithmArrangeService.getOne(queryWrapper) != null) {
|
||||||
|
return ResponseResult.error("方案名称已存在");
|
||||||
|
}
|
||||||
algorithmArrange.setLastmodifier(SecurityUtils.getCurrentUsername());
|
algorithmArrange.setLastmodifier(SecurityUtils.getCurrentUsername());
|
||||||
algorithmArrange.setLastmodifydate(LocalDateTime.now());
|
algorithmArrange.setLastmodifydate(LocalDateTime.now());
|
||||||
// 文件上传逻辑
|
// 文件上传逻辑
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package com.yfd.platform.modules.algorithm.controller;
|
package com.yfd.platform.modules.algorithm.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.yfd.platform.config.ResponseResult;
|
import com.yfd.platform.config.ResponseResult;
|
||||||
|
import com.yfd.platform.modules.algorithm.domain.AlgorithmArrangeDevice;
|
||||||
import com.yfd.platform.modules.algorithm.service.IAlgorithmArrangeDeviceService;
|
import com.yfd.platform.modules.algorithm.service.IAlgorithmArrangeDeviceService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
@ -34,4 +36,13 @@ public class AlgorithmArrangeDeviceController {
|
|||||||
List<Map<String, Object>> maps = algorithmArrangeDeviceService.getArrangeDeviceInfo(arrangeId);
|
List<Map<String, Object>> maps = algorithmArrangeDeviceService.getArrangeDeviceInfo(arrangeId);
|
||||||
return ResponseResult.successData(maps);
|
return ResponseResult.successData(maps);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getArrangeDeviceById")
|
||||||
|
@ApiOperation("根据ID查询当前布点详情")
|
||||||
|
public ResponseResult getArrangeDeviceById(String arrangeId) {
|
||||||
|
LambdaQueryWrapper<AlgorithmArrangeDevice> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(AlgorithmArrangeDevice::getArrangeId, arrangeId);
|
||||||
|
List<Map<String, Object>> maps = algorithmArrangeDeviceService.listMaps(queryWrapper);
|
||||||
|
return ResponseResult.successData(maps);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -115,7 +115,7 @@ public class SubstationMaindeviceController {
|
|||||||
}
|
}
|
||||||
LambdaQueryWrapper<SubstationMaindevice> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<SubstationMaindevice> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
queryWrapper.eq(StrUtil.isNotBlank(stationCode), SubstationMaindevice::getStationCode, stationCode);
|
queryWrapper.eq(StrUtil.isNotBlank(stationCode), SubstationMaindevice::getStationCode, stationCode);
|
||||||
queryWrapper.eq(StrUtil.isNotBlank(deviceTypeList), SubstationMaindevice::getDeviceType, StrUtil.split(deviceTypeList
|
queryWrapper.in(StrUtil.isNotBlank(deviceTypeList), SubstationMaindevice::getDeviceType, StrUtil.split(deviceTypeList
|
||||||
, ","));
|
, ","));
|
||||||
queryWrapper.select(SubstationMaindevice::getMainDeviceId, SubstationMaindevice::getMainDeviceName,
|
queryWrapper.select(SubstationMaindevice::getMainDeviceId, SubstationMaindevice::getMainDeviceName,
|
||||||
SubstationMaindevice::getDeviceType, SubstationMaindevice::getFileUrl);
|
SubstationMaindevice::getDeviceType, SubstationMaindevice::getFileUrl);
|
||||||
|
Loading…
Reference in New Issue
Block a user