优化平台ppoe和非平台ppoe配置方式的虚拟网卡上报带宽值处理.
优化pppoe虚拟网卡处理逻辑
This commit is contained in:
@@ -110,6 +110,17 @@
|
||||
<artifactId>iotdb-session</artifactId>
|
||||
<version>1.3.2</version>
|
||||
</dependency>
|
||||
<!-- 阿里云发送短信-->
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>dysmsapi20170525</artifactId>
|
||||
<version>2.0.24</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>tea-util</artifactId>
|
||||
<version>0.2.21</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
+6
@@ -4,6 +4,8 @@ import com.tongran.common.core.annotation.Excel;
|
||||
import com.tongran.common.core.web.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 客户端网络接口子接口信息对象 rm_network_interface_child
|
||||
*
|
||||
@@ -74,4 +76,8 @@ public class RmNetworkInterfaceChild extends BaseEntity
|
||||
/** 是否连通外网(0否,1是) */
|
||||
@Excel(name = "是否连通外网(0否,1是)")
|
||||
private String status;
|
||||
/** 虚拟网卡上报带宽值(Mbps) */
|
||||
private BigDecimal bandwidthResult;
|
||||
/** 有ipv4的标识 */
|
||||
private boolean ipv4Flag;
|
||||
}
|
||||
|
||||
@@ -50,6 +50,8 @@ public class RmPppoeConfigSub extends BaseEntity
|
||||
private String macAddress;
|
||||
/** 客户端id */
|
||||
private String clientId;
|
||||
/** 接口名称 */
|
||||
private String interfaceName;
|
||||
|
||||
public RmPppoeConfigSubVo toVo() {
|
||||
RmPppoeConfigSubVo vo = new RmPppoeConfigSubVo();
|
||||
|
||||
@@ -1134,7 +1134,7 @@ public class MessageHandler {
|
||||
Date createTime = new Date(millis / 1000 * 1000);
|
||||
|
||||
List<NetworkInfo> networkInfoList = registerMsg.getNetworkInfo();
|
||||
if(networkInfoList.isEmpty()) {
|
||||
if (networkInfoList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1148,6 +1148,7 @@ public class MessageHandler {
|
||||
// 构建数据库中当前网卡MAC地址的集合
|
||||
Set<String> currentMacSet = currentInterfaces.stream()
|
||||
.map(RmNetworkInterface::getMacAddress)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
// 构建新数据中网卡MAC地址的集合
|
||||
@@ -1169,8 +1170,27 @@ public class MessageHandler {
|
||||
if (!macsToDelete.isEmpty() && !isRegister) {
|
||||
deleteNetworkInterfaces(clientId, macsToDelete);
|
||||
}
|
||||
|
||||
// 获取当前客户端的所有子网卡
|
||||
RmNetworkInterfaceChild childQuery = new RmNetworkInterfaceChild();
|
||||
childQuery.setClientId(clientId);
|
||||
List<RmNetworkInterfaceChild> existingChildren = rmNetworkInterfaceChildService.selectRmNetworkInterfaceChildList(childQuery);
|
||||
if(existingChildren == null){
|
||||
existingChildren = new ArrayList<>();
|
||||
}
|
||||
// 构建数据库中所有子网卡的key集合 (clientId_mac_name)
|
||||
Map<String, RmNetworkInterfaceChild> existingChildMap = new HashMap<>();
|
||||
for (RmNetworkInterfaceChild child : existingChildren) {
|
||||
String key = child.getClientId() + "_" + child.getMacAddress() + "_" + child.getInterfaceName();
|
||||
existingChildMap.put(key, child);
|
||||
}
|
||||
|
||||
// 构建本次接收到的所有子网卡key集合
|
||||
Set<String> newChildKeys = new HashSet<>();
|
||||
|
||||
for (NetworkInfo networkInfo : networkInfoList) {
|
||||
List<NetworkInfo> childList = networkInfo.getSubInterfaces();
|
||||
|
||||
// 查询该网卡信息是否存在
|
||||
RmNetworkInterface queryParam = new RmNetworkInterface();
|
||||
queryParam.setClientId(clientId);
|
||||
@@ -1178,7 +1198,7 @@ public class MessageHandler {
|
||||
queryParam.setNewFlag(1);
|
||||
List<RmNetworkInterface> exits = rmNetworkInterfaceService.selectRmNetworkInterfaceList(queryParam);
|
||||
|
||||
if(exits.isEmpty()) {
|
||||
if (exits.isEmpty()) {
|
||||
// 新增网卡信息
|
||||
RmNetworkInterface insertData = new RmNetworkInterface();
|
||||
setNetworkInterfaceData(insertData, networkInfo, clientId);
|
||||
@@ -1188,18 +1208,27 @@ public class MessageHandler {
|
||||
insertData.setBindIp("3");
|
||||
}
|
||||
rmNetworkInterfaceService.insertRmNetworkInterface(insertData);
|
||||
if(childList != null && !childList.isEmpty()){
|
||||
rmNetworkInterfaceChildService.deleteRmNetworkInterfaceChildByClientId(clientId);
|
||||
|
||||
// 处理子网卡
|
||||
if (childList != null && !childList.isEmpty()) {
|
||||
for (NetworkInfo info : childList) {
|
||||
RmNetworkInterfaceChild insertChild = new RmNetworkInterfaceChild();
|
||||
setNetworkInterfaceChildData(insertChild, info, clientId, networkInfo.getName());
|
||||
insertChild.setUpdateTime(DateUtils.getNowDate());
|
||||
// 设置bindIp
|
||||
if (isSingleInterface) {
|
||||
insertChild.setBindIp("3");
|
||||
}
|
||||
|
||||
// 构建子网卡唯一key
|
||||
String childKey = clientId + "_" + info.getMac() + "_" + info.getName();
|
||||
newChildKeys.add(childKey);
|
||||
|
||||
// 插入或更新子网卡
|
||||
rmNetworkInterfaceChildService.insertRmNetworkInterfaceChild(insertChild);
|
||||
}
|
||||
}
|
||||
|
||||
// 如果网卡数量有变动,需要更新网卡绑定状态
|
||||
if (!isRegister && interfaceCountChanged && !isSingleInterface) {
|
||||
RmResourceRegistrationRemote updateParam = new RmResourceRegistrationRemote();
|
||||
@@ -1210,22 +1239,48 @@ public class MessageHandler {
|
||||
} else {
|
||||
// 更新网卡信息
|
||||
RmNetworkInterface oldInterfaceMsg = exits.get(0);
|
||||
// cleanChildOldRecords(clientId, networkInfo.getMac());
|
||||
// 判断是否需要创建新记录
|
||||
boolean needCreateNew = (!StringUtils.equals(networkInfo.getName(), oldInterfaceMsg.getInterfaceName())
|
||||
|| !StringUtils.equals(networkInfo.getGateway(), oldInterfaceMsg.getGateway())) && StringUtils.equals(networkInfo.getMac(), oldInterfaceMsg.getMacAddress());
|
||||
if(childList != null && !childList.isEmpty()){
|
||||
rmNetworkInterfaceChildService.deleteRmNetworkInterfaceChildByClientId(clientId);
|
||||
|
||||
// 处理子网卡
|
||||
if (childList != null && !childList.isEmpty()) {
|
||||
for (NetworkInfo info : childList) {
|
||||
RmNetworkInterfaceChild insertChild = new RmNetworkInterfaceChild();
|
||||
setNetworkInterfaceChildData(insertChild, info, clientId, networkInfo.getName());
|
||||
insertChild.setUpdateTime(DateUtils.getNowDate());
|
||||
// 构建子网卡唯一key
|
||||
String childKey = clientId + "_" + info.getMac() + "_" + info.getName();
|
||||
newChildKeys.add(childKey);
|
||||
// 插入或更新子网卡
|
||||
rmNetworkInterfaceChildService.insertRmNetworkInterfaceChild(insertChild);
|
||||
}
|
||||
}
|
||||
// 判断是否需要创建新记录
|
||||
boolean needCreateNew = (!StringUtils.equals(networkInfo.getName(), oldInterfaceMsg.getInterfaceName())
|
||||
|| !StringUtils.equals(networkInfo.getGateway(), oldInterfaceMsg.getGateway())) && StringUtils.equals(networkInfo.getMac(), oldInterfaceMsg.getMacAddress());
|
||||
// 更新现有记录
|
||||
updateNetworkInterface(networkInfo, clientId, oldInterfaceMsg, isSingleInterface, isRegister);
|
||||
}
|
||||
}
|
||||
|
||||
// 删除数据库中不存在于本次接收数据中的子网卡
|
||||
// 计算需要删除的子网卡:数据库中有的,但本次没有接收到的
|
||||
Set<String> childKeysToDelete = new HashSet<>(existingChildMap.keySet());
|
||||
childKeysToDelete.removeAll(newChildKeys);
|
||||
|
||||
if (!childKeysToDelete.isEmpty() && !isRegister) {
|
||||
for (String keyToDelete : childKeysToDelete) {
|
||||
String[] parts = keyToDelete.split("_", 3);
|
||||
if (parts.length == 3) {
|
||||
String clientIdPart = parts[0];
|
||||
String mac = parts[1];
|
||||
String name = parts[2];
|
||||
|
||||
// 只删除当前客户端的子网卡
|
||||
if (clientId.equals(clientIdPart)) {
|
||||
deleteChildNetworkInterfaces(clientId, mac, name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 删除过时的网卡信息
|
||||
@@ -1249,7 +1304,28 @@ public class MessageHandler {
|
||||
// 记录删除操作日志
|
||||
log.info("删除客户端 {} 的过时网卡信息,MAC地址: {}", clientId, macsToDelete);
|
||||
}
|
||||
/**
|
||||
* 删除过时的子网卡信息
|
||||
* @param clientId
|
||||
* @param name
|
||||
* @param mac
|
||||
*/
|
||||
private void deleteChildNetworkInterfaces(String clientId, String mac, String name) {
|
||||
RmNetworkInterfaceChild query = new RmNetworkInterfaceChild();
|
||||
query.setClientId(clientId);
|
||||
query.setMacAddress(mac);
|
||||
query.setInterfaceName(name);
|
||||
query.setNewFlag(1);
|
||||
List<RmNetworkInterfaceChild> oldExits = rmNetworkInterfaceChildService.selectRmNetworkInterfaceChildList(query);
|
||||
if(!oldExits.isEmpty()) {
|
||||
oldExits.forEach(oldMsg -> {
|
||||
rmNetworkInterfaceChildService.deleteRmNetworkInterfaceChildById(oldMsg.getId());
|
||||
});
|
||||
}
|
||||
|
||||
// 记录删除操作日志
|
||||
log.info("删除客户端 {} 的过时子网卡信息,MAC地址: {},网卡名称:{}", clientId, mac, name);
|
||||
}
|
||||
/**
|
||||
* 设置网卡信息公共字段
|
||||
*/
|
||||
@@ -1350,6 +1426,10 @@ public class MessageHandler {
|
||||
updateData.setInterfaceType(networkInfo.getType());
|
||||
needUpdate = true;
|
||||
}
|
||||
if (!StringUtils.equals(networkInfo.getGateway(), oldInterfaceMsg.getGateway())) {
|
||||
updateData.setGateway(networkInfo.getGateway());
|
||||
needUpdate = true;
|
||||
}
|
||||
if (!StringUtils.equals(networkInfo.getName(), oldInterfaceMsg.getInterfaceName())) {
|
||||
if(networkInfo.getName() != null){
|
||||
// 添加业务变更记录
|
||||
|
||||
+3
@@ -1,6 +1,7 @@
|
||||
package com.tongran.rocketmq.mapper;
|
||||
|
||||
import com.tongran.rocketmq.domain.RmNetworkInterfaceChild;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -61,4 +62,6 @@ public interface RmNetworkInterfaceChildMapper
|
||||
public int deleteRmNetworkInterfaceChildByIds(Long[] ids);
|
||||
|
||||
void deleteRmNetworkInterfaceChildByClientId(String clientId);
|
||||
|
||||
void deleteByParentInterfaceName(@Param("clientId") String clientId, @Param("name") String name);
|
||||
}
|
||||
|
||||
+2
@@ -61,4 +61,6 @@ public interface IRmNetworkInterfaceChildService
|
||||
public int deleteRmNetworkInterfaceChildById(Long id);
|
||||
|
||||
void deleteRmNetworkInterfaceChildByClientId(String clientId);
|
||||
|
||||
void deleteByParentInterfaceName(String clientId, String name);
|
||||
}
|
||||
|
||||
-5
@@ -618,12 +618,7 @@ public class InitialBandwidthTrafficServiceImpl implements IInitialBandwidthTraf
|
||||
|
||||
@Override
|
||||
public Map<String, Object> serverDetails(InitialBandwidthTraffic initialBandwidthTraffic) {
|
||||
InitialBandwidthTraffic sppedMsg = getNetInterfaceDetailsMsg(initialBandwidthTraffic);
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
if(sppedMsg == null){
|
||||
sppedMsg = new InitialBandwidthTraffic();
|
||||
}
|
||||
resultMap.put("speed", sppedMsg.getSpeed());
|
||||
InitialSystemOtherCollectData memQuery = new InitialSystemOtherCollectData();
|
||||
memQuery.setClientId(initialBandwidthTraffic.getClientId());
|
||||
memQuery.setTableName(TableSubUtil.getTableName(DateUtils.getNowDate(), "initial_system_other_collect_data"));
|
||||
|
||||
+5
-3
@@ -210,9 +210,11 @@ public class RmAgentManagementServiceImpl implements IRmAgentManagementService
|
||||
if(managementList != null && !managementList.isEmpty()){
|
||||
RmAgentManagement agentManagement = managementList.get(0);
|
||||
String addr = agentManagement.getFileUrl();
|
||||
if(addr.contains(rmAgentManagement.getAgentVersion())){
|
||||
agentManagement.setNewFlag(true);
|
||||
return agentManagement;
|
||||
if(addr != null){
|
||||
if(addr.contains(rmAgentManagement.getAgentVersion())){
|
||||
agentManagement.setNewFlag(true);
|
||||
return agentManagement;
|
||||
}
|
||||
}
|
||||
}
|
||||
return new RmAgentManagement();
|
||||
|
||||
+5
@@ -99,4 +99,9 @@ public class RmNetworkInterfaceChildServiceImpl implements IRmNetworkInterfaceCh
|
||||
public void deleteRmNetworkInterfaceChildByClientId(String clientId) {
|
||||
rmNetworkInterfaceChildMapper.deleteRmNetworkInterfaceChildByClientId(clientId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByParentInterfaceName(String clientId, String name) {
|
||||
rmNetworkInterfaceChildMapper.deleteByParentInterfaceName(clientId, name);
|
||||
}
|
||||
}
|
||||
|
||||
+56
-12
@@ -4,11 +4,13 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.tongran.common.core.enums.MsgEnum;
|
||||
import com.tongran.common.core.utils.DateUtils;
|
||||
import com.tongran.rocketmq.domain.DeviceMessage;
|
||||
import com.tongran.rocketmq.domain.RmNetworkInterfaceChild;
|
||||
import com.tongran.rocketmq.domain.RmPppoeConfigMain;
|
||||
import com.tongran.rocketmq.domain.RmPppoeConfigSub;
|
||||
import com.tongran.rocketmq.domain.vo.PolicyTypeVo;
|
||||
import com.tongran.rocketmq.domain.vo.PppoeVo;
|
||||
import com.tongran.rocketmq.domain.vo.RmPppoeConfigSubVo;
|
||||
import com.tongran.rocketmq.mapper.RmNetworkInterfaceChildMapper;
|
||||
import com.tongran.rocketmq.mapper.RmPppoeConfigMainMapper;
|
||||
import com.tongran.rocketmq.mapper.RmPppoeConfigSubMapper;
|
||||
import com.tongran.rocketmq.model.ProducerMode;
|
||||
@@ -37,6 +39,8 @@ public class RmPppoeConfigMainServiceImpl implements IRmPppoeConfigMainService
|
||||
private RmPppoeConfigSubMapper rmPppoeConfigSubMapper;
|
||||
@Autowired
|
||||
private ProducerMode producerMode;
|
||||
@Autowired
|
||||
private RmNetworkInterfaceChildMapper rmNetworkInterfaceChildMapper;
|
||||
|
||||
@Override
|
||||
public RmPppoeConfigMain selectRmPppoeConfigMainByClientId(RmPppoeConfigMain rmPppoeConfigMain)
|
||||
@@ -49,6 +53,28 @@ public class RmPppoeConfigMainServiceImpl implements IRmPppoeConfigMainService
|
||||
RmPppoeConfigSub rmPppoeConfigSub = new RmPppoeConfigSub();
|
||||
rmPppoeConfigSub.setClientId(rmPppoeConfigMain.getClientId());
|
||||
List<RmPppoeConfigSub> subList = rmPppoeConfigSubMapper.selectRmPppoeConfigSubList(rmPppoeConfigSub);
|
||||
if("2".equals(pppoeConfigMain.getPppoeConfigMode())){
|
||||
subList = new ArrayList<>();
|
||||
// 查询虚拟网卡信息
|
||||
RmNetworkInterfaceChild childQuery = new RmNetworkInterfaceChild();
|
||||
childQuery.setNewFlag(1);
|
||||
childQuery.setIpv4Flag(true);
|
||||
childQuery.setClientId(rmPppoeConfigMain.getClientId());
|
||||
List<RmNetworkInterfaceChild> childList = rmNetworkInterfaceChildMapper.selectRmNetworkInterfaceChildList(childQuery);
|
||||
if(childList != null && !childList.isEmpty()){
|
||||
for (RmNetworkInterfaceChild child : childList) {
|
||||
RmPppoeConfigSub pppoeConfigSub = new RmPppoeConfigSub();
|
||||
pppoeConfigSub.setClientId(child.getClientId());
|
||||
pppoeConfigSub.setInterfaceName(child.getInterfaceName());
|
||||
pppoeConfigSub.setMacAddress(child.getMacAddress());
|
||||
pppoeConfigSub.setIpv4Address(child.getIpv4Address());
|
||||
pppoeConfigSub.setIpv4Gateway(child.getGateway());
|
||||
pppoeConfigSub.setStatus(child.getStatus());
|
||||
pppoeConfigSub.setBandwidthResult(child.getBandwidthResult());
|
||||
subList.add(pppoeConfigSub);
|
||||
}
|
||||
}
|
||||
}
|
||||
pppoeConfigMain.setSubList(subList);
|
||||
return pppoeConfigMain;
|
||||
}
|
||||
@@ -78,19 +104,23 @@ public class RmPppoeConfigMainServiceImpl implements IRmPppoeConfigMainService
|
||||
int rows = rmPppoeConfigMainMapper.insertRmPppoeConfigMain(rmPppoeConfigMain);
|
||||
List<RmPppoeConfigSub> subList = rmPppoeConfigMain.getSubList();
|
||||
List<RmPppoeConfigSubVo> voList = new ArrayList<>();
|
||||
if(subList != null && !subList.isEmpty()){
|
||||
for (RmPppoeConfigSub rmPppoeConfigSub : subList) {
|
||||
rmPppoeConfigSub.setClientId(rmPppoeConfigMain.getClientId());
|
||||
rmPppoeConfigSub.setCreateTime(DateUtils.getNowDate());
|
||||
rmPppoeConfigSub.setUpdateTime(DateUtils.getNowDate());
|
||||
if("1".equals(rmPppoeConfigMain.getPppoeConfigMode())){
|
||||
if(subList != null && !subList.isEmpty()){
|
||||
for (RmPppoeConfigSub rmPppoeConfigSub : subList) {
|
||||
rmPppoeConfigSub.setClientId(rmPppoeConfigMain.getClientId());
|
||||
rmPppoeConfigSub.setCreateTime(DateUtils.getNowDate());
|
||||
rmPppoeConfigSub.setUpdateTime(DateUtils.getNowDate());
|
||||
}
|
||||
// 删除子表信息
|
||||
rmPppoeConfigSubMapper.deleteRmPppoeConfigSubByClientId(rmPppoeConfigMain.getClientId());
|
||||
// 批量新增
|
||||
rmPppoeConfigSubMapper.batchInsertRmPppoeConfigSub(subList);
|
||||
voList = subList.stream()
|
||||
.map(RmPppoeConfigSub::toVo)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
// 删除子表信息
|
||||
rmPppoeConfigSubMapper.deleteRmPppoeConfigSubByClientId(rmPppoeConfigMain.getClientId());
|
||||
// 批量新增
|
||||
rmPppoeConfigSubMapper.batchInsertRmPppoeConfigSub(subList);
|
||||
voList = subList.stream()
|
||||
.map(RmPppoeConfigSub::toVo)
|
||||
.collect(Collectors.toList());
|
||||
}else if("2".equals(rmPppoeConfigMain.getPppoeConfigMode())) {
|
||||
processBandwidthResult(subList);
|
||||
}
|
||||
// 构建pppoe策略
|
||||
PppoeVo pppoeVo = new PppoeVo();
|
||||
@@ -115,6 +145,20 @@ public class RmPppoeConfigMainServiceImpl implements IRmPppoeConfigMainService
|
||||
return 1;
|
||||
}
|
||||
|
||||
public void processBandwidthResult(List<RmPppoeConfigSub> subList){
|
||||
if(subList != null && !subList.isEmpty()){
|
||||
for (RmPppoeConfigSub rmPppoeConfigSub : subList) {
|
||||
RmNetworkInterfaceChild insertData = new RmNetworkInterfaceChild();
|
||||
insertData.setBandwidthResult(rmPppoeConfigSub.getBandwidthResult());
|
||||
insertData.setMacAddress(rmPppoeConfigSub.getMacAddress());
|
||||
insertData.setInterfaceName(rmPppoeConfigSub.getInterfaceName());
|
||||
insertData.setClientId(rmPppoeConfigSub.getClientId());
|
||||
insertData.setNewFlag(1);
|
||||
rmNetworkInterfaceChildMapper.insertRmNetworkInterfaceChild(insertData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改PPPoE配置主表
|
||||
*
|
||||
|
||||
+27
-2
@@ -25,10 +25,11 @@
|
||||
<result property="bindIp" column="bind_ip" />
|
||||
<result property="newFlag" column="new_flag" />
|
||||
<result property="status" column="status" />
|
||||
<result property="bandwidthResult" column="bandwidth_result" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectRmNetworkInterfaceChildVo">
|
||||
select id, client_id, parent_interface, isp, province, city, public_ip, interface_name, mac_address, interface_type, ipv4_address, ipv6_address, gateway, create_time, update_time, create_by, update_by, bind_ip, new_flag, status from rm_network_interface_child
|
||||
select id, client_id, parent_interface, isp, province, city, public_ip, interface_name, mac_address, interface_type, ipv4_address, ipv6_address, gateway, create_time, update_time, create_by, update_by, bind_ip, new_flag, status, bandwidth_result from rm_network_interface_child
|
||||
</sql>
|
||||
|
||||
<select id="selectRmNetworkInterfaceChildList" parameterType="RmNetworkInterfaceChild" resultMap="RmNetworkInterfaceChildResult">
|
||||
@@ -49,6 +50,7 @@
|
||||
<if test="bindIp != null and bindIp != ''"> and bind_ip = #{bindIp}</if>
|
||||
<if test="newFlag != null "> and new_flag = #{newFlag}</if>
|
||||
<if test="status != null and status != ''"> and status = #{status}</if>
|
||||
<if test="ipv4Flag">and ipv4_address != '' and ipv4_address != 'N/A'</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
@@ -58,7 +60,7 @@
|
||||
</select>
|
||||
|
||||
<insert id="insertRmNetworkInterfaceChild" parameterType="RmNetworkInterfaceChild" useGeneratedKeys="true" keyProperty="id">
|
||||
insert IGNORE into rm_network_interface_child
|
||||
insert into rm_network_interface_child
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="clientId != null">client_id,</if>
|
||||
<if test="parentInterface != null">parent_interface,</if>
|
||||
@@ -79,6 +81,7 @@
|
||||
<if test="bindIp != null">bind_ip,</if>
|
||||
<if test="newFlag != null">new_flag,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="bandwidthResult != null">bandwidth_result,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="clientId != null">#{clientId},</if>
|
||||
@@ -100,6 +103,24 @@
|
||||
<if test="bindIp != null">#{bindIp},</if>
|
||||
<if test="newFlag != null">#{newFlag},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="bandwidthResult != null">#{bandwidthResult},</if>
|
||||
</trim>
|
||||
ON DUPLICATE KEY UPDATE
|
||||
<trim suffixOverrides=",">
|
||||
<if test="isp != null">isp = #{isp},</if>
|
||||
<if test="province != null">province = #{province},</if>
|
||||
<if test="city != null">city = #{city},</if>
|
||||
<if test="publicIp != null">public_ip = #{publicIp},</if>
|
||||
<if test="interfaceName != null">interface_name = #{interfaceName},</if>
|
||||
<if test="macAddress != null">mac_address = #{macAddress},</if>
|
||||
<if test="interfaceType != null">interface_type = #{interfaceType},</if>
|
||||
<if test="ipv4Address != null">ipv4_address = #{ipv4Address},</if>
|
||||
<if test="ipv6Address != null">ipv6_address = #{ipv6Address},</if>
|
||||
<if test="gateway != null">gateway = #{gateway},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="bandwidthResult != null">bandwidth_result = #{bandwidthResult},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
@@ -125,6 +146,7 @@
|
||||
<if test="bindIp != null">bind_ip = #{bindIp},</if>
|
||||
<if test="newFlag != null">new_flag = #{newFlag},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="bandwidthResult != null">bandwidth_result = #{bandwidthResult},</if>
|
||||
</trim>
|
||||
<where>
|
||||
<choose>
|
||||
@@ -154,4 +176,7 @@
|
||||
<delete id="deleteRmNetworkInterfaceChildByClientId" parameterType="String">
|
||||
delete from rm_network_interface_child where client_id = #{clientId}
|
||||
</delete>
|
||||
<delete id="deleteByParentInterfaceName" parameterType="String">
|
||||
delete from rm_network_interface_child where client_id = #{clientId} and parent_interface =#{name}
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -170,6 +170,7 @@
|
||||
city = #{city},
|
||||
public_ip = #{publicIp},
|
||||
interface_name = #{interfaceName},
|
||||
gateway = #{gateway},
|
||||
interface_type = #{interfaceType},
|
||||
ipv4_address = #{ipv4Address},
|
||||
ipv6_address = #{ipv6Address},
|
||||
|
||||
@@ -33,6 +33,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
a.ipv4_address ipv4Address,
|
||||
a.ipv4_mask_bits ipv4MaskBits,
|
||||
a.ipv4_gateway ipv4Gateway,
|
||||
a.bandwidth_result bandwidthResult,
|
||||
a.create_time createTime,
|
||||
a.update_time updateTime,
|
||||
a.create_by createBy,
|
||||
|
||||
Reference in New Issue
Block a user