优化设备和网关机批量操作请求参数
This commit is contained in:
parent
1442a9e113
commit
e44db147af
@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||||||
import com.yfd.platform.annotation.Log;
|
import com.yfd.platform.annotation.Log;
|
||||||
import com.yfd.platform.config.ResponseResult;
|
import com.yfd.platform.config.ResponseResult;
|
||||||
import com.yfd.platform.modules.auxcontrol.domain.GatewayDevice;
|
import com.yfd.platform.modules.auxcontrol.domain.GatewayDevice;
|
||||||
|
import com.yfd.platform.modules.auxcontrol.domain.GatewayDeviceRequest;
|
||||||
import com.yfd.platform.modules.auxcontrol.service.IGatewayDeviceService;
|
import com.yfd.platform.modules.auxcontrol.service.IGatewayDeviceService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
@ -132,11 +133,11 @@ public class GatewayDeviceController {
|
|||||||
@Log(module = "数据变电站系统设备", value = "根据ID删除变电站网关设备", type = "1")
|
@Log(module = "数据变电站系统设备", value = "根据ID删除变电站网关设备", type = "1")
|
||||||
@PostMapping("/batchDeleteGateway")
|
@PostMapping("/batchDeleteGateway")
|
||||||
@ApiOperation("根据ID批量删除变电站网关设备")
|
@ApiOperation("根据ID批量删除变电站网关设备")
|
||||||
public ResponseResult batchDeleteGateway(@RequestBody List<String> ids) {
|
public ResponseResult batchDeleteGateway(@RequestBody GatewayDeviceRequest gatewayDeviceRequest) {
|
||||||
if (ids.size() <= 0) {
|
if (gatewayDeviceRequest.getIds() == null || gatewayDeviceRequest.getIds().size() <= 0) {
|
||||||
return ResponseResult.error("参数为空");
|
return ResponseResult.error("参数为空");
|
||||||
}
|
}
|
||||||
boolean isOk = gatewayDeviceService.removeByIds(ids);
|
boolean isOk = gatewayDeviceService.removeByIds(gatewayDeviceRequest.getIds());
|
||||||
if (isOk) {
|
if (isOk) {
|
||||||
return ResponseResult.success();
|
return ResponseResult.success();
|
||||||
} else {
|
} else {
|
||||||
|
@ -5,15 +5,14 @@ import cn.hutool.core.util.StrUtil;
|
|||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.yfd.platform.annotation.Log;
|
import com.yfd.platform.annotation.Log;
|
||||||
import com.yfd.platform.config.ResponseResult;
|
import com.yfd.platform.config.ResponseResult;
|
||||||
|
import com.yfd.platform.modules.auxcontrol.domain.MeterDeviceRequest;
|
||||||
import com.yfd.platform.modules.auxcontrol.domain.MeterDevice;
|
import com.yfd.platform.modules.auxcontrol.domain.MeterDevice;
|
||||||
import com.yfd.platform.modules.auxcontrol.service.IMeterDeviceService;
|
import com.yfd.platform.modules.auxcontrol.service.IMeterDeviceService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@ -119,12 +118,15 @@ public class MeterDeviceController {
|
|||||||
@Log(module = "数据变电站辅控设备", value = "批量修改变电站辅控设备信息", type = "1")
|
@Log(module = "数据变电站辅控设备", value = "批量修改变电站辅控设备信息", type = "1")
|
||||||
@PostMapping("/batchUpdateMeterDeviceIp")
|
@PostMapping("/batchUpdateMeterDeviceIp")
|
||||||
@ApiOperation("批量修改变电站辅控设备信息")
|
@ApiOperation("批量修改变电站辅控设备信息")
|
||||||
public ResponseResult batchUpdateMeterDeviceIp(@RequestParam String ids, @RequestParam String ip) {
|
public ResponseResult batchUpdateMeterDeviceIp(@RequestBody MeterDeviceRequest batchUpdateIpRequest) {
|
||||||
|
|
||||||
if (StrUtil.isBlank(ids) || StrUtil.isBlank(ip)) {
|
if (batchUpdateIpRequest.getIds() == null || batchUpdateIpRequest.getIds().size() <= 0) {
|
||||||
return ResponseResult.error("参数为空");
|
return ResponseResult.error("参数为空");
|
||||||
}
|
}
|
||||||
boolean isOk = meterDeviceService.batchUpdateDeviceIp(ids, ip);
|
if (StrUtil.isBlank(batchUpdateIpRequest.getIp())) {
|
||||||
|
return ResponseResult.error("参数为空");
|
||||||
|
}
|
||||||
|
boolean isOk = meterDeviceService.batchUpdateDeviceIp(batchUpdateIpRequest.getIds(), batchUpdateIpRequest.getIp());
|
||||||
if (isOk) {
|
if (isOk) {
|
||||||
return ResponseResult.success();
|
return ResponseResult.success();
|
||||||
} else {
|
} else {
|
||||||
|
@ -0,0 +1,15 @@
|
|||||||
|
package com.yfd.platform.modules.auxcontrol.domain;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Date: 2025/4/29 14:26
|
||||||
|
* @Description:
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class GatewayDeviceRequest {
|
||||||
|
|
||||||
|
private List<String> ids;
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
package com.yfd.platform.modules.auxcontrol.domain;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class MeterDeviceRequest {
|
||||||
|
|
||||||
|
private String ip;
|
||||||
|
|
||||||
|
private List<String> ids;
|
||||||
|
|
||||||
|
}
|
@ -49,7 +49,7 @@ public interface IMeterDeviceService extends IService<MeterDevice> {
|
|||||||
* 参数说明 ip 设备ip
|
* 参数说明 ip 设备ip
|
||||||
* 返回值说明: boolean
|
* 返回值说明: boolean
|
||||||
***********************************/
|
***********************************/
|
||||||
boolean batchUpdateDeviceIp(String ids, String ip);
|
boolean batchUpdateDeviceIp(List<String> ids, String ip);
|
||||||
|
|
||||||
/**********************************
|
/**********************************
|
||||||
* 用途说明: 根据系统编号查询设备
|
* 用途说明: 根据系统编号查询设备
|
||||||
|
@ -89,10 +89,9 @@ public class MeterDeviceServiceImpl extends ServiceImpl<MeterDeviceMapper, Meter
|
|||||||
* 返回值说明: boolean
|
* 返回值说明: boolean
|
||||||
***********************************/
|
***********************************/
|
||||||
@Override
|
@Override
|
||||||
public boolean batchUpdateDeviceIp(String ids, String ip) {
|
public boolean batchUpdateDeviceIp(List<String> ids, String ip) {
|
||||||
List<String> idList = StrUtil.split(ids, ",");
|
|
||||||
LambdaUpdateWrapper<MeterDevice> updateWrapper = new LambdaUpdateWrapper<>();
|
LambdaUpdateWrapper<MeterDevice> updateWrapper = new LambdaUpdateWrapper<>();
|
||||||
updateWrapper.in(MeterDevice::getDeviceId, idList).set(MeterDevice::getNetdeviceIp, ip);
|
updateWrapper.in(MeterDevice::getDeviceId, ids).set(MeterDevice::getNetdeviceIp, ip);
|
||||||
return this.update(updateWrapper);
|
return this.update(updateWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user