修改入库bug 资源管理模块bug

This commit is contained in:
gaoyutao
2025-09-02 19:54:54 +08:00
parent 05e57a2fe7
commit 4dd9324dba
24 changed files with 315 additions and 724 deletions

View File

@@ -54,14 +54,6 @@ public class RmResourceRegistrationController extends BaseController
public void export(HttpServletResponse response, RmResourceRegistration rmResourceRegistration)
{
List<RmResourceRegistration> list = rmResourceRegistrationService.selectRmResourceRegistrationList(rmResourceRegistration);
for (RmResourceRegistration resourceRegistration : list) {
// 根据端口类型导出端口名称
if("1".equals(resourceRegistration.getResourcePort())){
resourceRegistration.setResourcePort("162(SNMP)");
}else{
resourceRegistration.setResourcePort(resourceRegistration.getOtherPortName());
}
}
ExcelUtil<RmResourceRegistration> util = new ExcelUtil<RmResourceRegistration>(RmResourceRegistration.class);
util.showColumn(rmResourceRegistration.getProperties());
util.exportExcel(response, list, "资源注册数据");

View File

@@ -4,6 +4,8 @@ import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity;
import lombok.Data;
import java.util.Set;
/**
* 所有接口名称对象 all_interface_name
*
@@ -62,4 +64,14 @@ public class AllInterfaceName extends BaseEntity
@Excel(name = "交换机硬件SN")
private String switchSn;
/** 接口名称集合 */
private Set<String> interfaceNames;
/** 交换机ip */
@Excel(name = "交换机ip")
private String switchIp;
/** 服务器ip */
@Excel(name = "服务器ip")
private String serverIp;
}

View File

@@ -62,4 +62,6 @@ public class EpsServerRevenueConfig extends BaseEntity
private String endTime;
/** 业务是否有变化 */
private String changed;
/** 服务器ip */
private String serverIp;
}

View File

@@ -93,4 +93,7 @@ public class InitialSwitchInfoDetails extends BaseEntity
private String bandwidthType;
/** 日或月 */
private String dayOrMonth;
/** 交换机ip */
private String switchIp;
}

View File

@@ -3,8 +3,7 @@ package com.ruoyi.system.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import lombok.Data;
import java.util.Date;
@@ -14,6 +13,7 @@ import java.util.Date;
* @author gyt
* @date 2025-08-12
*/
@Data
public class RmEpsTopologyManagement extends BaseEntity
{
private static final long serialVersionUID = 1L;
@@ -71,166 +71,6 @@ public class RmEpsTopologyManagement extends BaseEntity
/** 修改人名称 */
private String updaterName;
@Override
public Date getCreateTime() {
return createTime;
}
@Override
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@Override
public Date getUpdateTime() {
return updateTime;
}
@Override
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setSwitchName(String switchName)
{
this.switchName = switchName;
}
public String getSwitchName()
{
return switchName;
}
public void setSwitchSn(String switchSn)
{
this.switchSn = switchSn;
}
public String getSwitchSn()
{
return switchSn;
}
public void setInterfaceName(String interfaceName)
{
this.interfaceName = interfaceName;
}
public String getInterfaceName()
{
return interfaceName;
}
public void setConnectedDeviceType(String connectedDeviceType)
{
this.connectedDeviceType = connectedDeviceType;
}
public String getConnectedDeviceType()
{
return connectedDeviceType;
}
public void setServerName(String serverName)
{
this.serverName = serverName;
}
public String getServerName()
{
return serverName;
}
public void setServerSn(String serverSn)
{
this.serverSn = serverSn;
}
public String getServerSn()
{
return serverSn;
}
public void setServerPort(String serverPort)
{
this.serverPort = serverPort;
}
public String getServerPort()
{
return serverPort;
}
public void setCreatorId(Long creatorId)
{
this.creatorId = creatorId;
}
public Long getCreatorId()
{
return creatorId;
}
public void setCreatorName(String creatorName)
{
this.creatorName = creatorName;
}
public String getCreatorName()
{
return creatorName;
}
public void setUpdaterId(Long updaterId)
{
this.updaterId = updaterId;
}
public Long getUpdaterId()
{
return updaterId;
}
public void setUpdaterName(String updaterName)
{
this.updaterName = updaterName;
}
public String getUpdaterName()
{
return updaterName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("switchName", getSwitchName())
.append("switchSn", getSwitchSn())
.append("interfaceName", getInterfaceName())
.append("connectedDeviceType", getConnectedDeviceType())
.append("serverName", getServerName())
.append("serverSn", getServerSn())
.append("serverPort", getServerPort())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.append("creatorId", getCreatorId())
.append("creatorName", getCreatorName())
.append("updaterId", getUpdaterId())
.append("updaterName", getUpdaterName())
.toString();
}
/** 交换机ip */
private String switchIpAddress;
}

View File

@@ -1,9 +1,8 @@
package com.ruoyi.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity;
import lombok.Data;
/**
* 资源注册对象 rm_resource_registration
@@ -11,6 +10,7 @@ import com.ruoyi.common.core.web.domain.BaseEntity;
* @author gyt
* @date 2025-08-12
*/
@Data
public class RmResourceRegistration extends BaseEntity
{
private static final long serialVersionUID = 1L;
@@ -42,19 +42,32 @@ public class RmResourceRegistration extends BaseEntity
/**其他端口名称 */
private String otherPortName;
/** agent版本 */
@Excel(name = "agent版本")
private String agentVersion;
/** 协议 1.TCP,2.UDP */
@Excel(name = "协议",readConverterExp = "1=TCP,2=UDP")
private String protocol;
/** SNMP探测 0=否,1=是 */
@Excel(name = "",readConverterExp = "0=否,1=是")
private String snmpDetect;
/** 版本(1.SNMPv2,2.SNMPv3) */
@Excel(name = "版本",readConverterExp = "1=SNMPv2,2=SNMPv3")
@Excel(name = "SNMP版本",readConverterExp = "1=华为SNMPv2c,2=华为SNMPv3")
private String resourceVersion;
/** 读写权限(1.RW,2.ReadOnly) */
@Excel(name = "读写权限",readConverterExp = "1=RW,2=ReadOnly")
@Excel(name = "读写权限",readConverterExp = "1=只读,2=可读可写")
private String rwPermission;
/** 团体名称 */
@Excel(name = "团体名称")
private String teamName;
/** SNMP采集地址 */
@Excel(name = "SNMP采集地址")
private String snmpCollectAddr;
/** 安全级别(1.authPriv、2.authNoPriv3.noAuthNoPriv) */
@Excel(name = "安全级别",readConverterExp = "1=authPriv,2=authNoPriv,3=noAuthNoPriv")
@@ -106,271 +119,4 @@ public class RmResourceRegistration extends BaseEntity
/** 修改人名称 */
private String updaterName;
public String getOtherPortName() {
return otherPortName;
}
public void setOtherPortName(String otherPortName) {
this.otherPortName = otherPortName;
}
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setHardwareSn(String hardwareSn)
{
this.hardwareSn = hardwareSn;
}
public String getHardwareSn()
{
return hardwareSn;
}
public void setResourceType(String resourceType)
{
this.resourceType = resourceType;
}
public String getResourceType()
{
return resourceType;
}
public void setResourceName(String resourceName)
{
this.resourceName = resourceName;
}
public String getResourceName()
{
return resourceName;
}
public void setIpAddress(String ipAddress)
{
this.ipAddress = ipAddress;
}
public String getIpAddress()
{
return ipAddress;
}
public void setResourcePort(String resourcePort)
{
this.resourcePort = resourcePort;
}
public String getResourcePort()
{
return resourcePort;
}
public void setProtocol(String protocol)
{
this.protocol = protocol;
}
public String getProtocol()
{
return protocol;
}
public void setResourceVersion(String resourceVersion)
{
this.resourceVersion = resourceVersion;
}
public String getResourceVersion()
{
return resourceVersion;
}
public void setRwPermission(String rwPermission)
{
this.rwPermission = rwPermission;
}
public String getRwPermission()
{
return rwPermission;
}
public void setSecurityLevel(String securityLevel)
{
this.securityLevel = securityLevel;
}
public String getSecurityLevel()
{
return securityLevel;
}
public void setEncryption(String encryption)
{
this.encryption = encryption;
}
public String getEncryption()
{
return encryption;
}
public void setResourcePwd(String resourcePwd)
{
this.resourcePwd = resourcePwd;
}
public String getResourcePwd()
{
return resourcePwd;
}
public void setRegistrationStatus(String registrationStatus)
{
this.registrationStatus = registrationStatus;
}
public String getRegistrationStatus()
{
return registrationStatus;
}
public void setOnlineStatus(String onlineStatus)
{
this.onlineStatus = onlineStatus;
}
public String getOnlineStatus()
{
return onlineStatus;
}
public void setDescription(String description)
{
this.description = description;
}
public String getDescription()
{
return description;
}
public void setCustomerId(Long customerId)
{
this.customerId = customerId;
}
public Long getCustomerId()
{
return customerId;
}
public void setCustomerName(String customerName)
{
this.customerName = customerName;
}
public String getCustomerName()
{
return customerName;
}
public void setServiceNumber(String serviceNumber)
{
this.serviceNumber = serviceNumber;
}
public String getServiceNumber()
{
return serviceNumber;
}
public void setCreatorId(Long creatorId)
{
this.creatorId = creatorId;
}
public Long getCreatorId()
{
return creatorId;
}
public void setCreatorName(String creatorName)
{
this.creatorName = creatorName;
}
public String getCreatorName()
{
return creatorName;
}
public void setUpdaterId(Long updaterId)
{
this.updaterId = updaterId;
}
public Long getUpdaterId()
{
return updaterId;
}
public void setUpdaterName(String updaterName)
{
this.updaterName = updaterName;
}
public String getUpdaterName()
{
return updaterName;
}
public String getResourceUserName() {
return resourceUserName;
}
public void setResourceUserName(String resourceUserName) {
this.resourceUserName = resourceUserName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("hardwareSn", getHardwareSn())
.append("resourceType", getResourceType())
.append("resourceName", getResourceName())
.append("ipAddress", getIpAddress())
.append("resourcePort", getResourcePort())
.append("otherPortName", getOtherPortName())
.append("protocol", getProtocol())
.append("resourceVersion", getResourceVersion())
.append("rwPermission", getRwPermission())
.append("securityLevel", getSecurityLevel())
.append("encryption", getEncryption())
.append("resourcePwd", getResourcePwd())
.append("resourceUserName", getResourceName())
.append("registrationStatus", getRegistrationStatus())
.append("onlineStatus", getOnlineStatus())
.append("description", getDescription())
.append("customerId", getCustomerId())
.append("customerName", getCustomerName())
.append("serviceNumber", getServiceNumber())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.append("creatorId", getCreatorId())
.append("creatorName", getCreatorName())
.append("updaterId", getUpdaterId())
.append("updaterName", getUpdaterName())
.toString();
}
}

View File

@@ -4,7 +4,6 @@ import com.ruoyi.system.domain.AllInterfaceName;
import org.springframework.data.repository.query.Param;
import java.util.List;
import java.util.Set;
/**
* 所有接口名称Mapper接口
@@ -64,10 +63,10 @@ public interface AllInterfaceNameMapper
/**
* 根据接口名称查询表中是否存在信息
* @param names
* @param interfaceName
* @return
*/
List<AllInterfaceName> selectByNames(Set<String> names);
List<AllInterfaceName> selectByNames(AllInterfaceName interfaceName);
/**
* 批量插入接口名称

View File

@@ -179,12 +179,12 @@ public class EpsServerRevenueConfigServiceImpl implements IEpsServerRevenueConfi
Map nodeMsg = epsServerRevenueConfigMapper.getNodeMsgByIp(ip);
// 赋值
if(nodeMsg != null){
initialTrafficData.setServiceSn(nodeMsg.get("hardwareSn") + "");
initialTrafficData.setNodeName(nodeMsg.get("resourceName") + "");
initialTrafficData.setRevenueMethod(nodeMsg.get("revenueMethod") + "");
initialTrafficData.setBusinessId(nodeMsg.get("businessCode") + "");
initialTrafficData.setBusinessName(nodeMsg.get("businessName") + "");
if("2".equals(String.valueOf(nodeMsg.get("revenueMethod")))
initialTrafficData.setServiceSn(getNullableString(nodeMsg, "hardwareSn"));
initialTrafficData.setNodeName(getNullableString(nodeMsg, "resourceName"));
initialTrafficData.setRevenueMethod(getNullableString(nodeMsg, "revenueMethod"));
initialTrafficData.setBusinessId(getNullableString(nodeMsg, "businessCode"));
initialTrafficData.setBusinessName(getNullableString(nodeMsg, "businessName"));
if("2".equals(nodeMsg.get("revenueMethod") + "")
&& nodeMsg.containsKey("packageBandwidth")){
Object bandwidth = nodeMsg.get("packageBandwidth");
if (bandwidth instanceof BigDecimal) {
@@ -210,6 +210,13 @@ public class EpsServerRevenueConfigServiceImpl implements IEpsServerRevenueConfi
return R.fail("数据保存失败:" + e.getMessage());
}
}
private static String getNullableString(Map<String, Object> map, String key) {
Object value = map.get(key);
return value != null ? value.toString() : null;
}
private String getCompositeKey(String clientId, String interfaceName) {
return clientId + "|" + interfaceName;
}
/**
* 批量处理接口名称
*/
@@ -225,11 +232,19 @@ public class EpsServerRevenueConfigServiceImpl implements IEpsServerRevenueConfi
}
// 批量查询已存在的接口名称
List<AllInterfaceName> existingNames = allInterfaceNameMapper.selectByNames(interfaceNames);
AllInterfaceName allInterfaceName = new AllInterfaceName();
if(!trafficDataList.isEmpty()){
allInterfaceName.setClientId(trafficDataList.get(0).getClientId());
allInterfaceName.setInterfaceNames(interfaceNames);
}
List<AllInterfaceName> existingNames = allInterfaceNameMapper.selectByNames(allInterfaceName);
// 转为 Map<接口名称, 数据库记录> 便于快速查找
Map<String, AllInterfaceName> existingNameMap = existingNames.stream()
.collect(Collectors.toMap(AllInterfaceName::getInterfaceName, Function.identity()));
.collect(Collectors.toMap(
item -> item.getClientId() + "|" + item.getInterfaceName(), // 关键修改点
Function.identity(),
(oldValue, newValue) -> oldValue // 重复时保留旧记录
));
// 分类处理:新增列表 vs 更新列表
List<AllInterfaceName> namesToInsert = new ArrayList<>();
List<AllInterfaceName> namesToUpdate = new ArrayList<>();
@@ -249,10 +264,11 @@ public class EpsServerRevenueConfigServiceImpl implements IEpsServerRevenueConfi
newRecord.setNodeName(data.getNodeName());
newRecord.setBusinessCode(data.getBusinessId());
newRecord.setBusinessName(data.getBusinessName());
newRecord.setServerIp(data.getIpV4());
// 判断是否需要更新
if (existingNameMap.containsKey(name)) {
AllInterfaceName oldRecord = existingNameMap.get(name);
String compositeKey = data.getClientId() + "|" + name;
if (existingNameMap.containsKey(compositeKey)) {
AllInterfaceName oldRecord = existingNameMap.get(compositeKey);
if (isRecordChanged(oldRecord, newRecord)) {
newRecord.setId(oldRecord.getId()); // 保留原ID
namesToUpdate.add(newRecord);
@@ -279,7 +295,8 @@ public class EpsServerRevenueConfigServiceImpl implements IEpsServerRevenueConfi
!Objects.equals(oldRecord.getDeviceSn(), newRecord.getDeviceSn()) ||
!Objects.equals(oldRecord.getNodeName(), newRecord.getNodeName()) ||
!Objects.equals(oldRecord.getBusinessCode(), newRecord.getBusinessCode()) ||
!Objects.equals(oldRecord.getBusinessName(), newRecord.getBusinessName());
!Objects.equals(oldRecord.getBusinessName(), newRecord.getBusinessName()) ||
!Objects.equals(oldRecord.getServerIp(), newRecord.getServerIp());
}
/**
* 批量删除服务器收益方式配置

View File

@@ -127,8 +127,10 @@ public class InitialSwitchInfoDetailsServiceImpl implements IInitialSwitchInfoDe
for (InitialSwitchInfoDetails details : dataList) {
// 根据接口名称查询交换机信息
String interfaceName = details.getName();
String switchIp = details.getSwitchIp();
RmEpsTopologyManagement rmEpsTopologyManagement = new RmEpsTopologyManagement();
rmEpsTopologyManagement.setInterfaceName(interfaceName);
rmEpsTopologyManagement.setSwitchIpAddress(switchIp);
List<RmEpsTopologyManagement> managements = rmEpsTopologyManagementMapper.selectRmEpsTopologyManagementList(rmEpsTopologyManagement);
// 赋值
if(!managements.isEmpty()){
@@ -190,12 +192,19 @@ public class InitialSwitchInfoDetailsServiceImpl implements IInitialSwitchInfoDe
if (interfaceNames.isEmpty()) {
return;
}
AllInterfaceName allInterfaceName = new AllInterfaceName();
if(!initialSwitchInfoDetails.isEmpty()){
allInterfaceName.setClientId(initialSwitchInfoDetails.get(0).getClientId());
allInterfaceName.setInterfaceNames(interfaceNames);
}
// 批量查询已存在的接口名称
List<AllInterfaceName> existingNames = allInterfaceNameMapper.selectByNames(interfaceNames);
List<AllInterfaceName> existingNames = allInterfaceNameMapper.selectByNames(allInterfaceName);
Map<String, AllInterfaceName> existingNameMap = existingNames.stream()
.collect(Collectors.toMap(AllInterfaceName::getInterfaceName, Function.identity()));
.collect(Collectors.toMap(
item -> item.getClientId() + "|" + item.getInterfaceName(), // 关键修改点
Function.identity(),
(oldValue, newValue) -> oldValue // 重复时保留旧记录
));
// 分类处理:新增列表 vs 更新列表
List<AllInterfaceName> namesToInsert = new ArrayList<>();
List<AllInterfaceName> namesToUpdate = new ArrayList<>();
@@ -216,6 +225,7 @@ public class InitialSwitchInfoDetailsServiceImpl implements IInitialSwitchInfoDe
record.setInterfaceDeviceType(data.getInterfaceDeviceType());
record.setSwitchName(data.getSwitchName());
record.setSwitchSn(data.getSwitchSn());
record.setSwitchIp(data.getSwitchIp());
// 根据服务器sn查询业务
if(data.getServerSn() != null){
EpsServerRevenueConfig epsServerRevenueConfig = new EpsServerRevenueConfig();
@@ -231,8 +241,9 @@ public class InitialSwitchInfoDetailsServiceImpl implements IInitialSwitchInfoDe
record.setBusinessName(null);
}
// 判断是否需要更新
if (existingNameMap.containsKey(name)) {
AllInterfaceName existingRecord = existingNameMap.get(name);
String compositeKey = data.getClientId() + "|" + name;
if (existingNameMap.containsKey(compositeKey)) {
AllInterfaceName existingRecord = existingNameMap.get(compositeKey);
if (isRecordChanged(existingRecord, record)) {
record.setId(existingRecord.getId()); // 保留原ID
namesToUpdate.add(record);
@@ -264,7 +275,8 @@ public class InitialSwitchInfoDetailsServiceImpl implements IInitialSwitchInfoDe
!Objects.equals(oldRecord.getSwitchName(), newRecord.getSwitchName()) ||
!Objects.equals(oldRecord.getBusinessCode(), newRecord.getBusinessCode()) ||
!Objects.equals(oldRecord.getBusinessName(), newRecord.getBusinessName()) ||
!Objects.equals(oldRecord.getSwitchSn(), newRecord.getSwitchSn());
!Objects.equals(oldRecord.getSwitchSn(), newRecord.getSwitchSn()) ||
!Objects.equals(oldRecord.getSwitchIp(), newRecord.getSwitchIp());
}
public void calculateSwitch95BandwidthDaily(InitialSwitchInfoDetails queryParam, String dailyStartTime, String dailyEndTime) {

View File

@@ -126,6 +126,7 @@ public class RmResourceRegistrationServiceImpl implements IRmResourceRegistratio
epsServerRevenueConfig.setNodeName(rmResourceRegistration.getResourceName());
epsServerRevenueConfig.setCreateTime(DateUtils.getNowDate());
epsServerRevenueConfig.setRegistrationStatus(rmResourceRegistration.getRegistrationStatus());
epsServerRevenueConfig.setServerIp(rmResourceRegistration.getIpAddress());
// 新增前判断是否存在
EpsServerRevenueConfig exits = epsServerRevenueConfigMapper.countBySn(epsServerRevenueConfig.getHardwareSn());
if(exits != null){

View File

@@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.AllInterfaceNameMapper">
<resultMap type="AllInterfaceName" id="AllInterfaceNameResult">
<result property="id" column="id" />
<result property="clientId" column="client_id" />
@@ -17,15 +17,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateTime" column="update_time" />
<result property="createBy" column="create_by" />
<result property="updateBy" column="update_by" />
<result property="switchName" column="switch_name" />
<result property="interfaceDeviceType" column="interface_device_type" />
<result property="serverPort" column="server_port" />
<result property="switchSn" column="switch_sn" />
<result property="switchIp" column="switch_ip" />
<result property="serverIp" column="server_ip" />
</resultMap>
<sql id="selectAllInterfaceNameVo">
select id, client_id, interface_name, device_sn, node_name, business_code, business_name, resource_type, switch_name, interface_device_type, server_port, switch_sn, create_time, update_time, create_by, update_by from all_interface_name
select id, client_id, interface_name, device_sn, node_name, business_code, business_name, resource_type, create_time, update_time, create_by, update_by, switch_name, interface_device_type, server_port, switch_sn, switch_ip, server_ip from all_interface_name
</sql>
<select id="selectAllInterfaceNameList" parameterType="AllInterfaceName" resultMap="AllInterfaceNameResult">
<include refid="selectAllInterfaceNameVo"/>
<where>
<where>
<if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if>
<if test="interfaceName != null and interfaceName != ''"> and interface_name like concat('%', #{interfaceName}, '%')</if>
<if test="deviceSn != null and deviceSn != ''"> and device_sn = #{deviceSn}</if>
@@ -33,9 +39,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="businessCode != null and businessCode != ''"> and business_code = #{businessCode}</if>
<if test="businessName != null and businessName != ''"> and business_name like concat('%', #{businessName}, '%')</if>
<if test="resourceType != null and resourceType != ''"> and resource_type = #{resourceType}</if>
<if test="switchName != null and switchName != ''"> and switch_name like concat('%', #{switchName}, '%')</if>
<if test="interfaceDeviceType != null and interfaceDeviceType != ''"> and interface_device_type = #{interfaceDeviceType}</if>
<if test="serverPort != null and serverPort != ''"> and server_port = #{serverPort}</if>
<if test="switchSn != null and switchSn != ''"> and switch_sn = #{switchSn}</if>
<if test="switchIp != null and switchIp != ''"> and switch_ip = #{switchIp}</if>
<if test="serverIp != null and serverIp != ''"> and server_ip = #{serverIp}</if>
</where>
</select>
<select id="selectAllInterfaceNameById" parameterType="Long" resultMap="AllInterfaceNameResult">
<include refid="selectAllInterfaceNameVo"/>
where id = #{id}
@@ -51,15 +63,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="businessCode != null">business_code,</if>
<if test="businessName != null">business_name,</if>
<if test="resourceType != null">resource_type,</if>
<if test="switchName != null">switch_name,</if>
<if test="interfaceDeviceType != null">interface_device_type,</if>
<if test="serverPort != null">server_port,</if>
<if test="switchSn != null">switch_sn,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="createBy != null">create_by,</if>
<if test="updateBy != null">update_by,</if>
</trim>
<if test="switchName != null">switch_name,</if>
<if test="interfaceDeviceType != null">interface_device_type,</if>
<if test="serverPort != null">server_port,</if>
<if test="switchSn != null">switch_sn,</if>
<if test="switchIp != null">switch_ip,</if>
<if test="serverIp != null">server_ip,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="clientId != null and clientId != ''">#{clientId},</if>
<if test="interfaceName != null and interfaceName != ''">#{interfaceName},</if>
@@ -68,15 +82,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="businessCode != null">#{businessCode},</if>
<if test="businessName != null">#{businessName},</if>
<if test="resourceType != null">#{resourceType},</if>
<if test="switchName != null">#{switchName},</if>
<if test="interfaceDeviceType != null">#{interfaceDeviceType},</if>
<if test="serverPort != null">#{serverPort},</if>
<if test="switchSn != null">#{switchSn},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateBy != null">#{updateBy},</if>
</trim>
<if test="switchName != null">#{switchName},</if>
<if test="interfaceDeviceType != null">#{interfaceDeviceType},</if>
<if test="serverPort != null">#{serverPort},</if>
<if test="switchSn != null">#{switchSn},</if>
<if test="switchIp != null">#{switchIp},</if>
<if test="serverIp != null">#{serverIp},</if>
</trim>
</insert>
<update id="updateAllInterfaceName" parameterType="AllInterfaceName">
@@ -89,14 +105,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="businessCode != null">business_code = #{businessCode},</if>
<if test="businessName != null">business_name = #{businessName},</if>
<if test="resourceType != null">resource_type = #{resourceType},</if>
<if test="switchName != null">switch_name = #{switchName},</if>
<if test="interfaceDeviceType != null">interface_device_type = #{interfaceDeviceType},</if>
<if test="serverPort != null">server_port = #{serverPort},</if>
<if test="switchSn != null">switch_sn = #{switchSn},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="switchName != null">switch_name = #{switchName},</if>
<if test="interfaceDeviceType != null">interface_device_type = #{interfaceDeviceType},</if>
<if test="serverPort != null">server_port = #{serverPort},</if>
<if test="switchSn != null">switch_sn = #{switchSn},</if>
<if test="switchIp != null">switch_ip = #{switchIp},</if>
<if test="serverIp != null">server_ip = #{serverIp},</if>
</trim>
where id = #{id}
</update>
@@ -106,13 +124,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<delete id="deleteAllInterfaceNameByIds" parameterType="String">
delete from all_interface_name where id in
delete from all_interface_name where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<!-- 根据接口名称批量查询 -->
<select id="selectByNames" parameterType="java.lang.String" resultType="AllInterfaceName">
<select id="selectByNames" parameterType="AllInterfaceName" resultType="AllInterfaceName">
SELECT
id,
interface_name AS interfaceName,
@@ -125,12 +143,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
switch_name AS switchName,
interface_device_type AS interfaceDeviceType,
server_port AS serverPort,
switch_sn AS switchSn
switch_sn AS switchSn,
switch_ip AS switchIp,
server_ip AS serverIp
FROM
all_interface_name
WHERE
client_id = #{clientId} and
interface_name IN
<foreach collection="collection" item="name" open="(" separator="," close=")">
<foreach collection="interfaceNames" item="name" open="(" separator="," close=")">
#{name}
</foreach>
</select>
@@ -146,7 +167,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
node_name,
business_code,
business_name,
switch_name, interface_device_type, server_port, switch_sn,
switch_name, interface_device_type, server_port, switch_sn, switch_ip, server_ip,
create_time,
update_time
)
@@ -160,7 +181,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{item.nodeName},
#{item.businessCode},
#{item.businessName},
#{item.switchName}, #{item.interfaceDeviceType}, #{item.serverPort}, #{item.switchSn},
#{item.switchName}, #{item.interfaceDeviceType}, #{item.serverPort}, #{item.switchSn}, #{item.switchIp}, #{item.serverIp},
NOW(),
NOW()
)
@@ -203,7 +224,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
server_port = #{item.serverPort},
interface_device_type = #{item.interfaceDeviceType},
switch_name = #{item.switchName},
switch_sn = #{item.switchSn}
switch_sn = #{item.switchSn},
switch_ip = #{item.switchIp},
server_ip = #{item.serverIp}
WHERE id = #{item.id}
</foreach>
</update>

View File

@@ -12,8 +12,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
`status` VARCHAR(20) COMMENT '运行状态',
`type` VARCHAR(30) COMMENT '接口类型',
ipV4 VARCHAR(20) COMMENT 'IPv4地址',
`in_dropped` DECIMAL(5,2) COMMENT '入站丢包率(%)',
`out_dropped` DECIMAL(5,2) COMMENT '出站丢包率(%)',
`in_dropped` DECIMAL(20,2) COMMENT '入站丢包率(%)',
`out_dropped` DECIMAL(20,2) COMMENT '出站丢包率(%)',
`in_speed` varchar(50) COMMENT '接收带宽(Mbps)',
`out_speed` varchar(50) COMMENT '发送带宽(Mbps)',
`speed` varchar(100) COMMENT '协商速度',
@@ -43,8 +43,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
`status` VARCHAR(20) COMMENT '运行状态',
`type` VARCHAR(30) COMMENT '接口类型',
ipV4 VARCHAR(20) COMMENT 'IPv4地址',
`in_dropped` DECIMAL(5,2) COMMENT '入站丢包率(%)',
`out_dropped` DECIMAL(5,2) COMMENT '出站丢包率(%)',
`in_dropped` DECIMAL(20,2) COMMENT '入站丢包率(%)',
`out_dropped` DECIMAL(20,2) COMMENT '出站丢包率(%)',
`in_speed` VARCHAR(20) COMMENT '接收带宽(Mbps)',
`out_speed` VARCHAR(20) COMMENT '发送带宽(Mbps)',
`speed` varchar(100) COMMENT '协商速度',

View File

@@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.EpsServerRevenueConfigMapper">
<resultMap type="EpsServerRevenueConfig" id="EpsServerRevenueConfigResult">
<result property="id" column="id" />
<result property="nodeName" column="node_name" />
@@ -20,16 +20,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateBy" column="update_by" />
<result property="createTime" column="create_time" />
<result property="changed" column="changed" />
<result property="serverIp" column="server_ip" />
</resultMap>
<sql id="selectEpsServerRevenueConfigVo">
select id, node_name, revenue_method, hardware_sn, traffic_port, bandwidth_95, package_bandwidth, update_time, business_name, business_code, registration_status, create_by, update_by, create_time, changed from eps_server_revenue_config
select id, node_name, revenue_method, hardware_sn, traffic_port, bandwidth_95, package_bandwidth, update_time, business_name, business_code, registration_status, create_by, update_by, create_time, changed, server_ip from eps_server_revenue_config
</sql>
<select id="selectEpsServerRevenueConfigList" parameterType="EpsServerRevenueConfig" resultMap="EpsServerRevenueConfigResult">
<include refid="selectEpsServerRevenueConfigVo"/>
<where>
and registration_status = '1'
and registration_status = "1"
<if test="nodeName != null and nodeName != ''"> and node_name like concat('%', #{nodeName}, '%')</if>
<if test="revenueMethod != null and revenueMethod != ''"> and revenue_method = #{revenueMethod}</if>
<if test="hardwareSn != null and hardwareSn != ''"> and hardware_sn = #{hardwareSn}</if>
@@ -39,19 +40,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="businessName != null and businessName != ''"> and business_name like concat('%', #{businessName}, '%')</if>
<if test="businessCode != null and businessCode != ''"> and business_code = #{businessCode}</if>
<if test="changed != null and changed != ''"> and changed = #{changed}</if>
<if test="serverIp != null and serverIp != ''"> and server_ip = #{serverIp}</if>
</where>
</select>
<select id="selectEpsServerRevenueConfigById" parameterType="Long" resultMap="EpsServerRevenueConfigResult">
<include refid="selectEpsServerRevenueConfigVo"/>
where id = #{id}
</select>
<select id="countBySn" parameterType="String">
<include refid="selectEpsServerRevenueConfigVo"/>
where hardware_sn = #{hardwareSn}
</select>
<insert id="insertEpsServerRevenueConfig" parameterType="EpsServerRevenueConfig">
insert into eps_server_revenue_config
<trim prefix="(" suffix=")" suffixOverrides=",">
@@ -70,7 +67,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null">update_by,</if>
<if test="createTime != null">create_time,</if>
<if test="changed != null">changed,</if>
</trim>
<if test="serverIp != null">server_ip,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="nodeName != null">#{nodeName},</if>
@@ -87,7 +85,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null">#{updateBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="changed != null">#{changed},</if>
</trim>
<if test="serverIp != null">#{serverIp},</if>
</trim>
</insert>
<update id="updateEpsServerRevenueConfig" parameterType="EpsServerRevenueConfig">
@@ -107,6 +106,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="changed != null">changed = #{changed},</if>
<if test="serverIp != null">server_ip = #{serverIp},</if>
</trim>
where id = #{id}
</update>
@@ -116,7 +116,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<delete id="deleteEpsServerRevenueConfigByIds" parameterType="String">
delete from eps_server_revenue_config where id in
delete from eps_server_revenue_config where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
@@ -141,4 +141,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and rrr.ip_address = #{ipAddress}
</where>
</select>
<select id="countBySn" parameterType="String">
<include refid="selectEpsServerRevenueConfigVo"/>
where hardware_sn = #{hardwareSn}
</select>
</mapper>

View File

@@ -14,6 +14,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="type" column="type" />
<result property="inSpeed" column="in_speed" />
<result property="outSpeed" column="out_speed" />
<result property="switchIp" column="switch_ip" />
<result property="createBy" column="create_by" />
<result property="updateBy" column="update_by" />
<result property="createTime" column="create_time" />
@@ -29,7 +30,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectInitialSwitchInfoDetailsVo">
select id, client_id, name, in_bytes, out_bytes, status, type, in_speed, out_speed, create_by, update_by, create_time, update_time, switch_name, interface_device_type, server_name, server_port, server_sn, switch_sn, business_code, business_name from initial_switch_info_details
select id, client_id, name, in_bytes, out_bytes, status, type, in_speed, out_speed, switch_ip, create_by, update_by, create_time, update_time, switch_name, interface_device_type, server_name, server_port, server_sn, switch_sn, business_code, business_name from initial_switch_info_details
</sql>
<select id="selectInitialSwitchInfoDetailsList" parameterType="InitialSwitchInfoDetails" resultMap="InitialSwitchInfoDetailsResult">
@@ -43,6 +44,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="type != null and type != ''"> and type = #{type}</if>
<if test="inSpeed != null "> and in_speed = #{inSpeed}</if>
<if test="outSpeed != null "> and out_speed = #{outSpeed}</if>
<if test="switchIp != null and switchIp != ''"> and switch_ip = #{switchIp}</if>
<if test="switchName != null and switchName != ''"> and switch_name like concat('%', #{switchName}, '%')</if>
<if test="interfaceDeviceType != null and interfaceDeviceType != ''"> and interface_device_type = #{interfaceDeviceType}</if>
<if test="serverName != null and serverName != ''"> and server_name like concat('%', #{serverName}, '%')</if>
@@ -70,6 +72,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="type != null">type,</if>
<if test="inSpeed != null">in_speed,</if>
<if test="outSpeed != null">out_speed,</if>
<if test="switchIp != null">switch_ip,</if>
<if test="createBy != null">create_by,</if>
<if test="updateBy != null">update_by,</if>
<if test="createTime != null">create_time,</if>
@@ -92,6 +95,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="type != null">#{type},</if>
<if test="inSpeed != null">#{inSpeed},</if>
<if test="outSpeed != null">#{outSpeed},</if>
<if test="switchIp != null">#{switchIp},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="createTime != null">#{createTime},</if>
@@ -118,6 +122,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="type != null">type = #{type},</if>
<if test="inSpeed != null">in_speed = #{inSpeed},</if>
<if test="outSpeed != null">out_speed = #{outSpeed},</if>
<if test="switchIp != null">switch_ip = #{switchIp},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
@@ -156,6 +161,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
`type`,
in_speed AS inSpeed,
out_speed AS outSpeed,
switch_ip AS switchIp,
create_by AS createBy,
update_by AS updateBy,
create_time AS createTime,
@@ -173,16 +179,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
INSERT INTO initial_switch_info_details
(
client_id,
name,
`name`,
in_bytes,
out_bytes,
status,
type,
`type`,
in_speed,
out_speed,
switch_ip,
switch_name,
interface_device_type,
server_name,
`server_name`,
server_port,
server_sn,
switch_sn,
@@ -204,6 +211,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{item.type},
#{item.inSpeed},
#{item.outSpeed},
#{item.switchIp},
#{item.switchName},
#{item.interfaceDeviceType},
#{item.serverName},

View File

@@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.RmEpsTopologyManagementMapper">
<resultMap type="RmEpsTopologyManagement" id="RmEpsTopologyManagementResult">
<result property="id" column="id" />
<result property="switchName" column="switch_name" />
@@ -19,18 +19,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="creatorName" column="creator_name" />
<result property="updaterId" column="updater_id" />
<result property="updaterName" column="updater_name" />
<result property="switchIpAddress" column="switch_ip_address" />
</resultMap>
<sql id="selectRmEpsTopologyManagementVo">
select id, switch_name, switch_sn, interface_name, connected_device_type, server_name, server_sn, server_port, create_time, update_time, creator_id, creator_name, updater_id, updater_name from rm_eps_topology_management
select id, switch_name, switch_sn, interface_name, connected_device_type, server_name, server_sn, server_port, create_time, update_time, creator_id, creator_name, updater_id, updater_name, switch_ip_address from rm_eps_topology_management
</sql>
<select id="selectRmEpsTopologyManagementList" parameterType="RmEpsTopologyManagement" resultMap="RmEpsTopologyManagementResult">
<include refid="selectRmEpsTopologyManagementVo"/>
<where>
<where>
<if test="switchName != null and switchName != ''"> and switch_name like concat('%', #{switchName}, '%')</if>
<if test="switchSn != null and switchSn != ''"> and switch_sn = #{switchSn}</if>
<if test="interfaceName != null and interfaceName != ''"> and interface_name= #{interfaceName}</if>
<if test="interfaceName != null and interfaceName != ''"> and interface_name like concat('%', #{interfaceName}, '%')</if>
<if test="connectedDeviceType != null and connectedDeviceType != ''"> and connected_device_type = #{connectedDeviceType}</if>
<if test="serverName != null and serverName != ''"> and server_name like concat('%', #{serverName}, '%')</if>
<if test="serverSn != null and serverSn != ''"> and server_sn = #{serverSn}</if>
@@ -39,9 +40,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="creatorName != null and creatorName != ''"> and creator_name like concat('%', #{creatorName}, '%')</if>
<if test="updaterId != null "> and updater_id = #{updaterId}</if>
<if test="updaterName != null and updaterName != ''"> and updater_name like concat('%', #{updaterName}, '%')</if>
<if test="switchIpAddress != null and switchIpAddress != ''"> and switch_ip_address = #{switchIpAddress}</if>
</where>
</select>
<select id="selectRmEpsTopologyManagementById" parameterType="Long" resultMap="RmEpsTopologyManagementResult">
<include refid="selectRmEpsTopologyManagementVo"/>
where id = #{id}
@@ -63,7 +65,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="creatorName != null">creator_name,</if>
<if test="updaterId != null">updater_id,</if>
<if test="updaterName != null">updater_name,</if>
</trim>
<if test="switchIpAddress != null">switch_ip_address,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="switchName != null">#{switchName},</if>
<if test="switchSn != null">#{switchSn},</if>
@@ -78,7 +81,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="creatorName != null">#{creatorName},</if>
<if test="updaterId != null">#{updaterId},</if>
<if test="updaterName != null">#{updaterName},</if>
</trim>
<if test="switchIpAddress != null">#{switchIpAddress},</if>
</trim>
</insert>
<update id="updateRmEpsTopologyManagement" parameterType="RmEpsTopologyManagement">
@@ -97,6 +101,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="creatorName != null">creator_name = #{creatorName},</if>
<if test="updaterId != null">updater_id = #{updaterId},</if>
<if test="updaterName != null">updater_name = #{updaterName},</if>
<if test="switchIpAddress != null">switch_ip_address = #{switchIpAddress},</if>
</trim>
where id = #{id}
</update>
@@ -106,7 +111,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<delete id="deleteRmEpsTopologyManagementByIds" parameterType="String">
delete from rm_eps_topology_management where id in
delete from rm_eps_topology_management where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>

View File

@@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.RmResourceRegistrationMapper">
<resultMap type="RmResourceRegistration" id="RmResourceRegistrationResult">
<result property="id" column="id" />
<result property="hardwareSn" column="hardware_sn" />
@@ -12,9 +12,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="ipAddress" column="ip_address" />
<result property="resourcePort" column="resource_port" />
<result property="otherPortName" column="other_port_name" />
<result property="agentVersion" column="agent_version" />
<result property="protocol" column="protocol" />
<result property="resourceVersion" column="resource_version" />
<result property="rwPermission" column="rw_permission" />
<result property="snmpDetect" column="snmp_detect" />
<result property="teamName" column="team_name" />
<result property="snmpCollectAddr" column="snmp_collect_addr" />
<result property="securityLevel" column="security_level" />
<result property="encryption" column="encryption" />
<result property="resourceUserName" column="resource_user_name" />
@@ -34,24 +38,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectRmResourceRegistrationVo">
select id, hardware_sn, resource_type, resource_name, ip_address, resource_port, other_port_name, protocol, resource_version, rw_permission, security_level, encryption, resource_user_name,resource_pwd, registration_status, online_status, description, customer_id, customer_name, service_number, create_time, update_time, creator_id, creator_name, updater_id, updater_name from rm_resource_registration
select id, hardware_sn, resource_type, resource_name, ip_address, resource_port, other_port_name, agent_version, protocol, resource_version, rw_permission, snmp_detect, team_name, snmp_collect_addr, security_level, encryption, resource_user_name, resource_pwd, registration_status, online_status, description, customer_id, customer_name, service_number, create_time, update_time, creator_id, creator_name, updater_id, updater_name from rm_resource_registration
</sql>
<select id="selectRmResourceRegistrationList" parameterType="RmResourceRegistration" resultMap="RmResourceRegistrationResult">
<include refid="selectRmResourceRegistrationVo"/>
<where>
<where>
<if test="hardwareSn != null and hardwareSn != ''"> and hardware_sn = #{hardwareSn}</if>
<if test="resourceType != null and resourceType != ''"> and resource_type = #{resourceType}</if>
<if test="resourceName != null and resourceName != ''"> and resource_name like concat('%', #{resourceName}, '%')</if>
<if test="ipAddress != null and ipAddress != ''"> and ip_address = #{ipAddress}</if>
<if test="resourcePort != null and resourcePort != ''"> and resource_port = #{resourcePort}</if>
<if test="otherPortName != null and otherPortName != ''"> and other_port_name = #{otherPortName}</if>
<if test="otherPortName != null and otherPortName != ''"> and other_port_name like concat('%', #{otherPortName}, '%')</if>
<if test="agentVersion != null and agentVersion != ''"> and agent_version = #{agentVersion}</if>
<if test="protocol != null and protocol != ''"> and protocol = #{protocol}</if>
<if test="resourceVersion != null and resourceVersion != ''"> and resource_version = #{resourceVersion}</if>
<if test="rwPermission != null and rwPermission != ''"> and rw_permission = #{rwPermission}</if>
<if test="snmpDetect != null and snmpDetect != ''"> and snmp_detect = #{snmpDetect}</if>
<if test="teamName != null and teamName != ''"> and team_name like concat('%', #{teamName}, '%')</if>
<if test="snmpCollectAddr != null and snmpCollectAddr != ''"> and snmp_collect_addr = #{snmpCollectAddr}</if>
<if test="securityLevel != null and securityLevel != ''"> and security_level = #{securityLevel}</if>
<if test="encryption != null and encryption != ''"> and encryption = #{encryption}</if>
<if test="resourceUserName != null and resourceUserName != ''"> and resource_user_name = #{resourceUserName}</if>
<if test="resourceUserName != null and resourceUserName != ''"> and resource_user_name like concat('%', #{resourceUserName}, '%')</if>
<if test="resourcePwd != null and resourcePwd != ''"> and resource_pwd = #{resourcePwd}</if>
<if test="registrationStatus != null and registrationStatus != ''"> and registration_status = #{registrationStatus}</if>
<if test="onlineStatus != null and onlineStatus != ''"> and online_status = #{onlineStatus}</if>
@@ -64,17 +72,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updaterId != null "> and updater_id = #{updaterId}</if>
<if test="updaterName != null and updaterName != ''"> and updater_name like concat('%', #{updaterName}, '%')</if>
</where>
order by create_time desc
</select>
<select id="selectRmResourceRegistrationById" parameterType="Long" resultMap="RmResourceRegistrationResult">
<include refid="selectRmResourceRegistrationVo"/>
where id = #{id}
</select>
<select id="countBySn" parameterType="String">
select count(1) from rm_resource_registration
where hardware_sn = #{hardwareSn}
</select>
<insert id="insertRmResourceRegistration" parameterType="RmResourceRegistration" useGeneratedKeys="true" keyProperty="id">
insert into rm_resource_registration
@@ -85,9 +88,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="ipAddress != null">ip_address,</if>
<if test="resourcePort != null">resource_port,</if>
<if test="otherPortName != null">other_port_name,</if>
<if test="agentVersion != null">agent_version,</if>
<if test="protocol != null">protocol,</if>
<if test="resourceVersion != null">resource_version,</if>
<if test="rwPermission != null">rw_permission,</if>
<if test="snmpDetect != null">snmp_detect,</if>
<if test="teamName != null">team_name,</if>
<if test="snmpCollectAddr != null">snmp_collect_addr,</if>
<if test="securityLevel != null">security_level,</if>
<if test="encryption != null">encryption,</if>
<if test="resourceUserName != null">resource_user_name,</if>
@@ -104,7 +111,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="creatorName != null">creator_name,</if>
<if test="updaterId != null">updater_id,</if>
<if test="updaterName != null">updater_name,</if>
</trim>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="hardwareSn != null">#{hardwareSn},</if>
<if test="resourceType != null">#{resourceType},</if>
@@ -112,9 +119,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="ipAddress != null">#{ipAddress},</if>
<if test="resourcePort != null">#{resourcePort},</if>
<if test="otherPortName != null">#{otherPortName},</if>
<if test="agentVersion != null">#{agentVersion},</if>
<if test="protocol != null">#{protocol},</if>
<if test="resourceVersion != null">#{resourceVersion},</if>
<if test="rwPermission != null">#{rwPermission},</if>
<if test="snmpDetect != null">#{snmpDetect},</if>
<if test="teamName != null">#{teamName},</if>
<if test="snmpCollectAddr != null">#{snmpCollectAddr},</if>
<if test="securityLevel != null">#{securityLevel},</if>
<if test="encryption != null">#{encryption},</if>
<if test="resourceUserName != null">#{resourceUserName},</if>
@@ -131,7 +142,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="creatorName != null">#{creatorName},</if>
<if test="updaterId != null">#{updaterId},</if>
<if test="updaterName != null">#{updaterName},</if>
</trim>
</trim>
</insert>
<update id="updateRmResourceRegistration" parameterType="RmResourceRegistration">
@@ -143,9 +154,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="ipAddress != null">ip_address = #{ipAddress},</if>
<if test="resourcePort != null">resource_port = #{resourcePort},</if>
<if test="otherPortName != null">other_port_name = #{otherPortName},</if>
<if test="agentVersion != null">agent_version = #{agentVersion},</if>
<if test="protocol != null">protocol = #{protocol},</if>
<if test="resourceVersion != null">resource_version = #{resourceVersion},</if>
<if test="rwPermission != null">rw_permission = #{rwPermission},</if>
<if test="snmpDetect != null">snmp_detect = #{snmpDetect},</if>
<if test="teamName != null">team_name = #{teamName},</if>
<if test="snmpCollectAddr != null">snmp_collect_addr = #{snmpCollectAddr},</if>
<if test="securityLevel != null">security_level = #{securityLevel},</if>
<if test="encryption != null">encryption = #{encryption},</if>
<if test="resourceUserName != null">resource_user_name = #{resourceUserName},</if>
@@ -171,7 +186,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<delete id="deleteRmResourceRegistrationByIds" parameterType="String">
delete from rm_resource_registration where id in
delete from rm_resource_registration where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
@@ -186,7 +201,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<!-- 查询所有资源名称-->
<select id="selectAllResourceNameByType" parameterType="RmResourceRegistration" resultType="java.util.Map">
select resource_name resourceName from rm_resource_registration
select resource_name resourceName,ip_address ipAddress,hardware_sn hardwareSn from rm_resource_registration
<where>
and registration_status = 1
<if test="hardwareSn != null and hardwareSn != ''"> and hardware_sn = #{hardwareSn}</if>
@@ -215,4 +230,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
group by resource_name
</select>
<select id="countBySn" parameterType="String">
select count(1) from rm_resource_registration
where hardware_sn = #{hardwareSn}
</select>
</mapper>

View File

@@ -337,9 +337,14 @@ public class RocketMsgListener implements MessageListenerConcurrently {
}
}
});
}else{
switchInfos.forEach(switchInfo -> {
switchInfo.setClientId(message.getClientId());
switchInfo.setCreateTime(createTime);
});
}
// 清空临时表
initialSwitchInfoTempService.truncateSwitchInfoTemp();
// 清空临时表对应switch信息
initialSwitchInfoTempService.truncateSwitchInfoTemp(message.getClientId());
// 临时表 用来计算inSpeed outSeppd
initialSwitchInfoTempService.batchInsertInitialSwitchInfoTemp(switchInfos);
// 初始交换机数据入库

View File

@@ -39,6 +39,8 @@ public class InitialSwitchInfo extends BaseEntity
private BigDecimal inSpeed;
/** 发送流量(bytes/s) */
private BigDecimal outSpeed;
/** 交换机ip */
private String switchIp;
}

View File

@@ -1,10 +1,10 @@
package com.ruoyi.rocketmq.domain;
import java.math.BigDecimal;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity;
import lombok.Data;
import java.math.BigDecimal;
/**
* 交换机监控信息对象 initial_switch_info_temp
@@ -12,6 +12,7 @@ import com.ruoyi.common.core.web.domain.BaseEntity;
* @author gyt
* @date 2025-08-26
*/
@Data
public class InitialSwitchInfoTemp extends BaseEntity
{
private static final long serialVersionUID = 1L;
@@ -50,113 +51,6 @@ public class InitialSwitchInfoTemp extends BaseEntity
/** 发送流量bytes/s */
@Excel(name = "发送流量", readConverterExp = "b=ytes/s")
private BigDecimal outSpeed;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setClientId(String clientId)
{
this.clientId = clientId;
}
public String getClientId()
{
return clientId;
}
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
public void setInBytes(BigDecimal inBytes)
{
this.inBytes = inBytes;
}
public BigDecimal getInBytes()
{
return inBytes;
}
public void setOutBytes(BigDecimal outBytes)
{
this.outBytes = outBytes;
}
public BigDecimal getOutBytes()
{
return outBytes;
}
public void setStatus(String status)
{
this.status = status;
}
public String getStatus()
{
return status;
}
public void setType(String type)
{
this.type = type;
}
public String getType()
{
return type;
}
public void setInSpeed(BigDecimal inSpeed)
{
this.inSpeed = inSpeed;
}
public BigDecimal getInSpeed()
{
return inSpeed;
}
public void setOutSpeed(BigDecimal outSpeed)
{
this.outSpeed = outSpeed;
}
public BigDecimal getOutSpeed()
{
return outSpeed;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("clientId", getClientId())
.append("name", getName())
.append("inBytes", getInBytes())
.append("outBytes", getOutBytes())
.append("status", getStatus())
.append("type", getType())
.append("inSpeed", getInSpeed())
.append("outSpeed", getOutSpeed())
.append("createBy", getCreateBy())
.append("updateBy", getUpdateBy())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.toString();
}
/** 交换机ip */
private String switchIp;
}

View File

@@ -69,5 +69,5 @@ public interface InitialSwitchInfoTempMapper
*/
public int batchInsertInitialSwitchInfoTemp(@Param("list") List<InitialSwitchInfo> list);
void truncateSwitchInfoTemp();
void truncateSwitchInfoTemp(String clientId);
}

View File

@@ -69,5 +69,5 @@ public interface IInitialSwitchInfoTempService
*/
public int batchInsertInitialSwitchInfoTemp(List<InitialSwitchInfo> list);
void truncateSwitchInfoTemp();
void truncateSwitchInfoTemp(String clientId);
}

View File

@@ -116,7 +116,7 @@ public class InitialSwitchInfoTempServiceImpl implements IInitialSwitchInfoTempS
}
@Override
public void truncateSwitchInfoTemp() {
initialSwitchInfoTempMapper.truncateSwitchInfoTemp();
public void truncateSwitchInfoTemp(String clientId) {
initialSwitchInfoTempMapper.truncateSwitchInfoTemp(clientId);
}
}

View File

@@ -5,51 +5,39 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<mapper namespace="com.ruoyi.rocketmq.mapper.InitialSwitchInfoMapper">
<resultMap type="InitialSwitchInfo" id="InitialSwitchInfoResult">
<id property="id" column="id"/>
<result property="clientId" column="client_id"/>
<result property="name" column="name"/>
<result property="inBytes" column="in_bytes"/>
<result property="outBytes" column="out_bytes"/>
<result property="status" column="status"/>
<result property="type" column="type"/>
<result property="inSpeed" column="in_speed"/>
<result property="outSpeed" column="out_speed"/>
<result property="createBy" column="create_by"/>
<result property="updateBy" column="update_by"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
<result property="id" column="id" />
<result property="clientId" column="client_id" />
<result property="name" column="name" />
<result property="inBytes" column="in_bytes" />
<result property="outBytes" column="out_bytes" />
<result property="status" column="status" />
<result property="type" column="type" />
<result property="inSpeed" column="in_speed" />
<result property="outSpeed" column="out_speed" />
<result property="switchIp" column="switch_ip" />
<result property="createBy" column="create_by" />
<result property="updateBy" column="update_by" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectInitialSwitchInfoVo">
SELECT
id, client_id, `name`, in_bytes, out_bytes, status, `type`,
in_speed, out_speed, create_by, update_by, create_time, update_time
FROM initial_switch_info
select id, client_id, name, in_bytes, out_bytes, status, type, in_speed, out_speed, switch_ip, create_by, update_by, create_time, update_time from initial_switch_info
</sql>
<select id="selectInitialSwitchInfoList" parameterType="InitialSwitchInfo" resultMap="InitialSwitchInfoResult">
<include refid="selectInitialSwitchInfoVo"/>
<where>
<if test="clientId != null and clientId != ''">
AND client_id = #{clientId}
</if>
<if test="name != null and name != ''">
AND name LIKE CONCAT('%', #{name}, '%')
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
<if test="type != null and type != ''">
AND type = #{type}
</if>
<if test="params.beginTime != null and params.beginTime != ''">
AND create_time &gt;= #{params.beginTime}
</if>
<if test="params.endTime != null and params.endTime != ''">
AND create_time &lt;= #{params.endTime}
</if>
<if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="inBytes != null "> and in_bytes = #{inBytes}</if>
<if test="outBytes != null "> and out_bytes = #{outBytes}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="type != null and type != ''"> and type = #{type}</if>
<if test="inSpeed != null "> and in_speed = #{inSpeed}</if>
<if test="outSpeed != null "> and out_speed = #{outSpeed}</if>
<if test="switchIp != null and switchIp != ''"> and switch_ip = #{switchIp}</if>
</where>
ORDER BY create_time DESC
</select>
<select id="selectInitialSwitchInfoById" parameterType="Long" resultMap="InitialSwitchInfoResult">
@@ -58,52 +46,57 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<insert id="insertInitialSwitchInfo" parameterType="InitialSwitchInfo" useGeneratedKeys="true" keyProperty="id">
INSERT INTO initial_switch_info
insert into initial_switch_info
<trim prefix="(" suffix=")" suffixOverrides=",">
client_id,
<if test="name != null">name,</if>
<if test="clientId != null and clientId != ''">client_id,</if>
<if test="name != null and name != ''">name,</if>
<if test="inBytes != null">in_bytes,</if>
<if test="outBytes != null">out_bytes,</if>
<if test="status != null">status,</if>
<if test="type != null">type,</if>
<if test="inSpeed != null">in_speed,</if>
<if test="outSeppd != null">out_speed,</if>
<if test="outSpeed != null">out_speed,</if>
<if test="switchIp != null and switchIp != ''">switch_ip,</if>
<if test="createBy != null">create_by,</if>
<if test="updateBy != null">update_by,</if>
create_time,
update_time
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
#{clientId},
<if test="name != null">#{name},</if>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="clientId != null and clientId != ''">#{clientId},</if>
<if test="name != null and name != ''">#{name},</if>
<if test="inBytes != null">#{inBytes},</if>
<if test="outBytes != null">#{outBytes},</if>
<if test="status != null">#{status},</if>
<if test="type != null">#{type},</if>
<if test="inSpeed != null">#{inSpeed},</if>
<if test="outSeppd != null">#{outSpeed},</if>
<if test="outSpeed != null">#{outSpeed},</if>
<if test="switchIp != null and switchIp != ''">#{switchIp},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateBy != null">#{updateBy},</if>
NOW(),
NOW()
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateInitialSwitchInfo" parameterType="InitialSwitchInfo">
UPDATE initial_switch_info
<set>
<if test="clientId != null">client_id = #{clientId},</if>
<if test="name != null">name = #{name},</if>
update initial_switch_info
<trim prefix="SET" suffixOverrides=",">
<if test="clientId != null and clientId != ''">client_id = #{clientId},</if>
<if test="name != null and name != ''">name = #{name},</if>
<if test="inBytes != null">in_bytes = #{inBytes},</if>
<if test="outBytes != null">out_bytes = #{outBytes},</if>
<if test="status != null">status = #{status},</if>
<if test="type != null">type = #{type},</if>
<if test="inSpeed != null">in_speed = #{inSpeed}</if>
<if test="outSeppd != null">out_speed = #{outSpeed}</if>
<if test="inSpeed != null">in_speed = #{inSpeed},</if>
<if test="outSpeed != null">out_speed = #{outSpeed},</if>
<if test="switchIp != null and switchIp != ''">switch_ip = #{switchIp},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
update_time = NOW()
</set>
WHERE id = #{id}
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteInitialSwitchInfoById" parameterType="Long">
@@ -120,14 +113,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="batchInsertInitialSwitchInfo" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
INSERT INTO initial_switch_info
(
client_id, name, in_bytes, out_bytes, status, type, in_speed, out_speed,
client_id, `name`, in_bytes, out_bytes, status, `type`, in_speed, out_speed, switch_ip,
create_by, update_by, create_time, update_time
)
VALUES
<foreach collection="list" item="item" separator=",">
(
#{item.clientId}, #{item.name}, #{item.inBytes}, #{item.outBytes},
#{item.status}, #{item.type}, #{item.inSpeed}, #{item.outSpeed}, #{item.createBy}, #{item.updateBy},
#{item.status}, #{item.type}, #{item.inSpeed}, #{item.outSpeed}, #{item.switchIp}, #{item.createBy}, #{item.updateBy},
<choose>
<when test="item.createTime != null">
#{item.createTime}

View File

@@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.rocketmq.mapper.InitialSwitchInfoTempMapper">
<resultMap type="InitialSwitchInfoTemp" id="InitialSwitchInfoTempResult">
<result property="id" column="id" />
<result property="clientId" column="client_id" />
@@ -14,6 +14,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="type" column="type" />
<result property="inSpeed" column="in_speed" />
<result property="outSpeed" column="out_speed" />
<result property="switchIp" column="switch_ip" />
<result property="createBy" column="create_by" />
<result property="updateBy" column="update_by" />
<result property="createTime" column="create_time" />
@@ -21,12 +22,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectInitialSwitchInfoTempVo">
select id, client_id, name, in_bytes, out_bytes, status, type, in_speed, out_speed, create_by, update_by, create_time, update_time from initial_switch_info_temp
select id, client_id, name, in_bytes, out_bytes, status, type, in_speed, out_speed, switch_ip, create_by, update_by, create_time, update_time from initial_switch_info_temp
</sql>
<select id="selectInitialSwitchInfoTempList" parameterType="InitialSwitchInfoTemp" resultMap="InitialSwitchInfoTempResult">
<include refid="selectInitialSwitchInfoTempVo"/>
<where>
<where>
<if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="inBytes != null "> and in_bytes = #{inBytes}</if>
@@ -35,9 +36,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="type != null and type != ''"> and type = #{type}</if>
<if test="inSpeed != null "> and in_speed = #{inSpeed}</if>
<if test="outSpeed != null "> and out_speed = #{outSpeed}</if>
<if test="switchIp != null and switchIp != ''"> and switch_ip = #{switchIp}</if>
</where>
</select>
<select id="selectInitialSwitchInfoTempById" parameterType="Long" resultMap="InitialSwitchInfoTempResult">
<include refid="selectInitialSwitchInfoTempVo"/>
where id = #{id}
@@ -54,11 +56,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="type != null">type,</if>
<if test="inSpeed != null">in_speed,</if>
<if test="outSpeed != null">out_speed,</if>
<if test="switchIp != null">switch_ip,</if>
<if test="createBy != null">create_by,</if>
<if test="updateBy != null">update_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
</trim>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="clientId != null and clientId != ''">#{clientId},</if>
<if test="name != null and name != ''">#{name},</if>
@@ -68,11 +71,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="type != null">#{type},</if>
<if test="inSpeed != null">#{inSpeed},</if>
<if test="outSpeed != null">#{outSpeed},</if>
<if test="switchIp != null">#{switchIp},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</trim>
</insert>
<update id="updateInitialSwitchInfoTemp" parameterType="InitialSwitchInfoTemp">
@@ -86,6 +90,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="type != null">type = #{type},</if>
<if test="inSpeed != null">in_speed = #{inSpeed},</if>
<if test="outSpeed != null">out_speed = #{outSpeed},</if>
<if test="switchIp != null">switch_ip = #{switchIp},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
@@ -99,7 +104,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<delete id="deleteInitialSwitchInfoTempByIds" parameterType="String">
delete from initial_switch_info_temp where id in
delete from initial_switch_info_temp where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
@@ -107,14 +112,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="batchInsertInitialSwitchInfoTemp" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
INSERT INTO initial_switch_info_temp
(
client_id, name, in_bytes, out_bytes, status, type, in_speed, out_speed,
client_id, name, in_bytes, out_bytes, status, type, in_speed, out_speed, switch_ip,
create_by, update_by, create_time, update_time
)
VALUES
<foreach collection="list" item="item" separator=",">
(
#{item.clientId}, #{item.name}, #{item.inBytes}, #{item.outBytes},
#{item.status}, #{item.type}, #{item.inSpeed}, #{item.outSpeed}, #{item.createBy}, #{item.updateBy},
#{item.status}, #{item.type}, #{item.inSpeed}, #{item.outSpeed}, #{item.switchIp}, #{item.createBy}, #{item.updateBy},
<choose>
<when test="item.createTime != null">
#{item.createTime}
@@ -134,7 +139,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
)
</foreach>
</insert>
<update id="truncateSwitchInfoTemp">
truncate table initial_switch_info_temp
</update>
<delete id="truncateSwitchInfoTemp" parameterType="String">
DELETE FROM initial_switch_info_temp
WHERE
<choose>
<when test="clientId != null and clientId != ''">
client_id = #{clientId}
</when>
<otherwise>
1=0 <!-- 安全措施:条件不满足时不删除任何数据 -->
</otherwise>
</choose>
</delete>
</mapper>