mirror of
https://github.com/Sagit-chu/flvx.git
synced 2026-11-16 09:34:22 +08:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 60fc80b6ac | |||
| c8f0c55fda |
@@ -15,6 +15,7 @@ import com.admin.service.*;
|
|||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -142,10 +143,26 @@ public class NodeServiceImpl extends ServiceImpl<NodeMapper, Node> implements No
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
Node updateNode = buildUpdateNode(nodeUpdateDto);
|
Node updateNode = buildUpdateNode(nodeUpdateDto);
|
||||||
this.updateById(updateNode);
|
// Use LambdaUpdateWrapper to explicitly set nullable fields (serverIpV4/V6)
|
||||||
return R.ok();
|
// because updateById() skips null fields by default
|
||||||
}
|
LambdaUpdateWrapper<Node> wrapper = new LambdaUpdateWrapper<>();
|
||||||
|
wrapper.eq(Node::getId, updateNode.getId())
|
||||||
|
.set(Node::getName, updateNode.getName())
|
||||||
|
.set(Node::getServerIp, updateNode.getServerIp())
|
||||||
|
.set(Node::getServerIpV4, updateNode.getServerIpV4())
|
||||||
|
.set(Node::getServerIpV6, updateNode.getServerIpV6())
|
||||||
|
.set(Node::getPort, updateNode.getPort())
|
||||||
|
.set(Node::getHttp, updateNode.getHttp())
|
||||||
|
.set(Node::getTls, updateNode.getTls())
|
||||||
|
.set(Node::getSocks, updateNode.getSocks())
|
||||||
|
.set(Node::getInterfaceName, updateNode.getInterfaceName())
|
||||||
|
.set(Node::getTcpListenAddr, updateNode.getTcpListenAddr())
|
||||||
|
.set(Node::getUdpListenAddr, updateNode.getUdpListenAddr())
|
||||||
|
.set(Node::getUpdatedTime, updateNode.getUpdatedTime());
|
||||||
|
this.update(wrapper);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public R deleteNode(Long id) {
|
public R deleteNode(Long id) {
|
||||||
|
|||||||
@@ -536,7 +536,8 @@ public class TunnelServiceImpl extends ServiceImpl<TunnelMapper, Tunnel> impleme
|
|||||||
tunnel.setTrafficRatio(tunnelUpdateDto.getTrafficRatio());
|
tunnel.setTrafficRatio(tunnelUpdateDto.getTrafficRatio());
|
||||||
tunnel.setInIp(tunnelUpdateDto.getInIp());
|
tunnel.setInIp(tunnelUpdateDto.getInIp());
|
||||||
|
|
||||||
if (StringUtils.isEmpty(tunnel.getInIp())) {
|
boolean forceRegenerateInIp = hasNodeChanges && tunnelUpdateDto.getInNodeId() != null;
|
||||||
|
if (StringUtils.isEmpty(tunnel.getInIp()) || forceRegenerateInIp) {
|
||||||
java.util.LinkedHashSet<String> inIps = new java.util.LinkedHashSet<>();
|
java.util.LinkedHashSet<String> inIps = new java.util.LinkedHashSet<>();
|
||||||
List<ChainTunnel> chainTunnels = chainTunnelService.list(
|
List<ChainTunnel> chainTunnels = chainTunnelService.list(
|
||||||
new QueryWrapper<ChainTunnel>().eq("tunnel_id", tunnel.getId()).eq("chain_type", 1)
|
new QueryWrapper<ChainTunnel>().eq("tunnel_id", tunnel.getId()).eq("chain_type", 1)
|
||||||
|
|||||||
Reference in New Issue
Block a user