端口池管理增加编辑功能,支持修改端口池所属分组
This commit is contained in:
+9
@@ -51,6 +51,15 @@ public class PortPoolController {
|
||||
return portPoolService.page(pageQuery, req);
|
||||
}
|
||||
|
||||
@Post
|
||||
@Mapping("/update")
|
||||
public PortPoolUpdateRes update(PortPoolUpdateReq req) {
|
||||
ParamCheckUtil.checkNotNull(req, "req");
|
||||
ParamCheckUtil.checkNotNull(req.getId(), "id");
|
||||
ParamCheckUtil.checkNotNull(req.getGroupId(), "groupId");
|
||||
return portPoolService.update(req);
|
||||
}
|
||||
|
||||
@Get
|
||||
@Mapping("/list")
|
||||
public List<PortPoolListRes> list(PortPoolListReq req) {
|
||||
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package fun.asgc.neutrino.proxy.server.controller.req;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author: aoshiguchen
|
||||
* @date: 2023/3/25
|
||||
*/
|
||||
@Data
|
||||
public class PortPoolUpdateReq {
|
||||
private Integer id;
|
||||
|
||||
private Integer groupId;
|
||||
}
|
||||
+1
-1
@@ -62,5 +62,5 @@ public class PortPoolListRes {
|
||||
/**
|
||||
* 分组ID
|
||||
*/
|
||||
private String groupId;
|
||||
private Integer groupId;
|
||||
}
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package fun.asgc.neutrino.proxy.server.controller.res;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author: aoshiguchen
|
||||
* @date: 2023/3/25
|
||||
*/
|
||||
@Data
|
||||
public class PortPoolUpdateRes {
|
||||
}
|
||||
+10
-22
@@ -1,34 +1,13 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
* <p>
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
* <p>
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
* <p>
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import fun.asgc.neutrino.proxy.server.base.page.PageInfo;
|
||||
import fun.asgc.neutrino.proxy.server.base.page.PageQuery;
|
||||
import fun.asgc.neutrino.proxy.server.base.rest.ServiceException;
|
||||
import fun.asgc.neutrino.proxy.server.base.rest.SystemContextHolder;
|
||||
import fun.asgc.neutrino.proxy.server.constant.EnableStatusEnum;
|
||||
import fun.asgc.neutrino.proxy.server.constant.ExceptionConstant;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.*;
|
||||
@@ -94,6 +73,15 @@ public class PortPoolService {
|
||||
return list.stream().filter(item -> !serverPorts.contains(item.getPort())).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public PortPoolUpdateRes update(PortPoolUpdateReq req) {
|
||||
portPoolMapper.update(null, new LambdaUpdateWrapper<PortPoolDO>()
|
||||
.eq(PortPoolDO::getId, req.getId())
|
||||
.set(PortPoolDO::getGroupId, req.getGroupId())
|
||||
.set(PortPoolDO::getUpdateTime, new Date())
|
||||
);
|
||||
|
||||
return new PortPoolUpdateRes();
|
||||
}
|
||||
|
||||
public PortPoolCreateRes create(PortPoolCreateReq req) {
|
||||
PortPoolDO oldPortPoolDO = portPoolMapper.findByPort(req.getPort());
|
||||
|
||||
Reference in New Issue
Block a user