增加服务器下架处理,
服务器详情增加agent最新版本、cpu核数、内存字段。 开发pppoe主表及子表CRUD
This commit is contained in:
+10
@@ -272,4 +272,14 @@ public class RmResourceRegistrationController extends BaseController
|
||||
return toAjax(rmResourceRegistrationService.removeAlarmFlag(rmResourceRegistration));
|
||||
}
|
||||
|
||||
/**
|
||||
* 下架
|
||||
*/
|
||||
@Log(title = "下架", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/removeServer")
|
||||
public AjaxResult removeServer(@RequestBody RmResourceRegistration rmResourceRegistration)
|
||||
{
|
||||
return toAjax(rmResourceRegistrationService.removeServer(rmResourceRegistration.getIds()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+10
@@ -259,8 +259,12 @@ public class RmResourceRegistration extends BaseEntity
|
||||
private Integer bandwidthResultSort;
|
||||
/** cpu利用率 */
|
||||
private BigDecimal cpuUtil;
|
||||
/** cpu核数 */
|
||||
private BigDecimal cpuCores;
|
||||
/** 内存使用率 */
|
||||
private BigDecimal memUtil;
|
||||
/** 总内存 */
|
||||
private Integer memTotalSize;
|
||||
/** 是否告警 */
|
||||
private boolean alarmFlag;
|
||||
/** 取消告警时间 */
|
||||
@@ -272,4 +276,10 @@ public class RmResourceRegistration extends BaseEntity
|
||||
private String frpcRemotePort;
|
||||
/** FRPC服务器地址 */
|
||||
private String frpcServerAddr;
|
||||
/** 下架标识(0未下架、1下架) */
|
||||
private Integer delFlag;
|
||||
/** agent最新版本号 */
|
||||
private String maxAgentVersion;
|
||||
/** id集合 */
|
||||
private Long[] ids;
|
||||
}
|
||||
+4
@@ -128,4 +128,8 @@ public interface RmResourceRegistrationMapper
|
||||
List<RmResourceRegistration> getMemUtil(@Param("clientIdsStr") String clientIdsStr);
|
||||
|
||||
int removeAlarmFlag(RmResourceRegistration rmResourceRegistration);
|
||||
|
||||
int removeServer(Long[] ids);
|
||||
|
||||
RmResourceRegistration getMaxAgentVersion();
|
||||
}
|
||||
|
||||
+7
@@ -146,4 +146,11 @@ public interface IRmResourceRegistrationService
|
||||
* @return
|
||||
*/
|
||||
int removeAlarmFlag(RmResourceRegistration rmResourceRegistration);
|
||||
|
||||
/**
|
||||
* 下架
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
int removeServer(Long[] ids);
|
||||
}
|
||||
|
||||
+24
-23
@@ -513,17 +513,6 @@ public class RmResourceRegistrationServiceImpl implements IRmResourceRegistratio
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 回退到单条查询
|
||||
*/
|
||||
private void fallbackSetNetworkInfo(List<RmResourceRegistration> pageList) {
|
||||
log.warn("批量查询失败,回退到单条查询");
|
||||
for (RmResourceRegistration registration : pageList) {
|
||||
if (registration.getClientId() != null) {
|
||||
setNetWorkMsg(registration);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 网卡信息赋值
|
||||
@@ -535,11 +524,18 @@ public class RmResourceRegistrationServiceImpl implements IRmResourceRegistratio
|
||||
List<RmResourceRegistration> cpuUtilList = rmResourceRegistrationMapper.getCpuUtil(clientId);
|
||||
// 根据clientId查询mem利用率
|
||||
List<RmResourceRegistration> memUtilList = rmResourceRegistrationMapper.getMemUtil(clientId);
|
||||
// 查询agent最新版本
|
||||
RmResourceRegistration rmResourceRegistration = rmResourceRegistrationMapper.getMaxAgentVersion();
|
||||
if(cpuUtilList != null && !cpuUtilList.isEmpty()){
|
||||
registration.setCpuUtil(cpuUtilList.get(0).getCpuUtil());
|
||||
registration.setCpuCores(cpuUtilList.get(0).getCpuCores());
|
||||
}
|
||||
if(memUtilList != null && !memUtilList.isEmpty()){
|
||||
registration.setMemUtil(memUtilList.get(0).getMemUtil());
|
||||
registration.setMemTotalSize(memUtilList.get(0).getMemTotalSize());
|
||||
}
|
||||
if(rmResourceRegistration != null){
|
||||
registration.setMaxAgentVersion(rmResourceRegistration.getMaxAgentVersion());
|
||||
}
|
||||
// 根据clientId查询网卡信息
|
||||
RmNetworkInterfaceRemote queryParam = new RmNetworkInterfaceRemote();
|
||||
@@ -1079,17 +1075,18 @@ public class RmResourceRegistrationServiceImpl implements IRmResourceRegistratio
|
||||
network.setId(Long.parseLong(map.get("id").toString()));
|
||||
network.setBindIp(map.get("status").toString());
|
||||
remoteRocketMqService.bindPublicIp(network, SecurityConstants.INNER);
|
||||
|
||||
// 添加变更记录
|
||||
EpsMethodChangeRecord record = new EpsMethodChangeRecord();
|
||||
record.setClientId(clientId);
|
||||
record.setTrafficPort(map.get("interfaceName").toString());
|
||||
record.setCreateTime(now);
|
||||
record.setUpdateTime(now);
|
||||
record.setUpdateBy(username);
|
||||
record.setCreatBy(username);
|
||||
record.setChangeContent("流量网口设置为" + map.get("interfaceName"));
|
||||
epsMethodChangeRecordMapper.insertEpsMethodChangeRecord(record);
|
||||
if("1".equals(map.get("status").toString()) || "3".equals(map.get("status").toString())){
|
||||
// 添加变更记录
|
||||
EpsMethodChangeRecord record = new EpsMethodChangeRecord();
|
||||
record.setClientId(clientId);
|
||||
record.setTrafficPort(map.get("interfaceName").toString());
|
||||
record.setCreateTime(now);
|
||||
record.setUpdateTime(now);
|
||||
record.setUpdateBy(username);
|
||||
record.setCreatBy(username);
|
||||
record.setChangeContent("流量网口设置为" + map.get("interfaceName"));
|
||||
epsMethodChangeRecordMapper.insertEpsMethodChangeRecord(record);
|
||||
}
|
||||
});
|
||||
|
||||
// 2. 更新注册状态
|
||||
@@ -1255,5 +1252,9 @@ public class RmResourceRegistrationServiceImpl implements IRmResourceRegistratio
|
||||
int rows = rmResourceRegistrationMapper.removeAlarmFlag(rmResourceRegistration);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int removeServer(Long[] ids)
|
||||
{
|
||||
return rmResourceRegistrationMapper.removeServer(ids);
|
||||
}
|
||||
}
|
||||
|
||||
+18
-4
@@ -37,6 +37,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<select id="selectRmResourceRegistrationList" parameterType="RmResourceRegistration" resultMap="RmResourceRegistrationResult">
|
||||
<include refid="selectRmResourceRegistrationVo"/>
|
||||
<where>
|
||||
and del_flag=0
|
||||
<if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if>
|
||||
<if test="hardwareSn != null and hardwareSn != ''"> and hardware_sn = #{hardwareSn}</if>
|
||||
<if test="businessName != null and businessName != ''"> and business_name like concat('%', #{businessName}, '%')</if>
|
||||
@@ -252,6 +253,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
left join rm_registration_machine b on a.client_id = b.client_id
|
||||
left join rm_frpc_config_manage c on a.client_id=c.client_id
|
||||
<where>
|
||||
and a.del_flag=0
|
||||
<if test="hardwareSn != null and hardwareSn != ''"> and a.hardware_sn = #{hardwareSn}</if>
|
||||
<if test="resourceType != null and resourceType != ''"> and a.resource_type = #{resourceType}</if>
|
||||
<if test="agentVersion != null and agentVersion != ''"> and a.agent_version = #{agentVersion}</if>
|
||||
@@ -295,6 +297,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<select id="getCpuUtil" resultType="RmResourceRegistration">
|
||||
SELECT
|
||||
d.client_id as clientId,
|
||||
d.cores as cpuCores,
|
||||
d.uti as cpuUtil
|
||||
FROM initial_cpu_info d
|
||||
INNER JOIN (
|
||||
@@ -311,16 +314,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
AND d.create_time = latest.latest_time
|
||||
</select>
|
||||
<select id="getMemUtil" resultType="RmResourceRegistration">
|
||||
SELECT
|
||||
select
|
||||
d.client_id as clientId,
|
||||
ROUND(d.collect_value, 1) as memUtil
|
||||
max(CASE WHEN d.collect_type = 'memorySizeTotalCollect' THEN floor(d.collect_value/(1024 * 1024)) END) as memTotalSize,
|
||||
max(CASE WHEN d.collect_type = 'memoryUtilizationCollect' THEN ROUND(d.collect_value, 1) END) as memUtil
|
||||
FROM initial_system_other_collect_data d
|
||||
INNER JOIN (
|
||||
SELECT
|
||||
client_id,
|
||||
MAX(create_time) as max_time
|
||||
FROM initial_system_other_collect_data
|
||||
WHERE collect_type='memoryUtilizationCollect'
|
||||
WHERE (collect_type='memoryUtilizationCollect' or collect_type='memorySizeTotalCollect')
|
||||
AND client_id in
|
||||
<foreach collection="clientIdsStr.split(',')" item="clientId" open="(" separator="," close=")">
|
||||
#{clientId}
|
||||
@@ -328,10 +332,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
GROUP BY client_id
|
||||
) latest ON d.client_id = latest.client_id
|
||||
AND d.create_time = latest.max_time
|
||||
AND d.collect_type='memoryUtilizationCollect'
|
||||
AND (d.collect_type='memoryUtilizationCollect' or d.collect_type='memorySizeTotalCollect')
|
||||
</select>
|
||||
<update id="removeAlarmFlag" parameterType="RmResourceRegistration">
|
||||
update rm_resource_registration set del_alarm_time = now()
|
||||
where id =#{id}
|
||||
</update>
|
||||
<update id="removeServer" parameterType="String">
|
||||
update rm_resource_registration set del_flag=1 where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
<select id="getMaxAgentVersion" resultType="RmResourceRegistration">
|
||||
select agent_version maxAgentVersion from rm_resource_registration where del_flag=0
|
||||
order by create_time desc limit 1
|
||||
</select>
|
||||
</mapper>
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
package com.tongran.rocketmq.controller;
|
||||
|
||||
import com.tongran.common.core.web.controller.BaseController;
|
||||
import com.tongran.common.core.web.domain.AjaxResult;
|
||||
import com.tongran.common.log.annotation.Log;
|
||||
import com.tongran.common.log.enums.BusinessType;
|
||||
import com.tongran.common.security.annotation.RequiresPermissions;
|
||||
import com.tongran.rocketmq.domain.RmPppoeConfigMain;
|
||||
import com.tongran.rocketmq.service.IRmPppoeConfigMainService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* PPPoE配置主表Controller
|
||||
*
|
||||
* @author tongran
|
||||
* @date 2025-12-29
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/rmPppoeConfigMain")
|
||||
@RequiresPermissions("system:registration")
|
||||
public class RmPppoeConfigMainController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IRmPppoeConfigMainService rmPppoeConfigMainService;
|
||||
|
||||
|
||||
/**
|
||||
* 获取PPPoE配置主表详细信息
|
||||
*/
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(rmPppoeConfigMainService.selectRmPppoeConfigMainById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增PPPoE配置主表
|
||||
*/
|
||||
@Log(title = "PPPoE配置主表", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody RmPppoeConfigMain rmPppoeConfigMain)
|
||||
{
|
||||
return toAjax(rmPppoeConfigMainService.insertRmPppoeConfigMain(rmPppoeConfigMain));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改PPPoE配置主表
|
||||
*/
|
||||
@Log(title = "PPPoE配置主表", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody RmPppoeConfigMain rmPppoeConfigMain)
|
||||
{
|
||||
return toAjax(rmPppoeConfigMainService.updateRmPppoeConfigMain(rmPppoeConfigMain));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除PPPoE配置主表
|
||||
*/
|
||||
@Log(title = "PPPoE配置主表", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(rmPppoeConfigMainService.deleteRmPppoeConfigMainByIds(ids));
|
||||
}
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
package com.tongran.rocketmq.controller;
|
||||
|
||||
import com.tongran.common.core.web.controller.BaseController;
|
||||
import com.tongran.common.core.web.domain.AjaxResult;
|
||||
import com.tongran.common.security.annotation.RequiresPermissions;
|
||||
import com.tongran.rocketmq.domain.RmPppoeConfigSub;
|
||||
import com.tongran.rocketmq.service.IRmPppoeConfigSubService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* PPPoE配置子表Controller
|
||||
*
|
||||
* @author tongran
|
||||
* @date 2025-12-29
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/rmPppoeConfigSub")
|
||||
@RequiresPermissions("system:registration")
|
||||
public class RmPppoeConfigSubController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IRmPppoeConfigSubService rmPppoeConfigSubService;
|
||||
|
||||
/**
|
||||
* 查询PPPoE配置子表列表
|
||||
*/
|
||||
@PostMapping("/list")
|
||||
public AjaxResult list(@RequestBody RmPppoeConfigSub rmPppoeConfigSub)
|
||||
{
|
||||
List<RmPppoeConfigSub> list = rmPppoeConfigSubService.selectRmPppoeConfigSubList(rmPppoeConfigSub);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -42,9 +42,12 @@ public class InitialCpuInfo extends BaseEntity
|
||||
@Excel(name = "CPU使用率(%)")
|
||||
private Long uti;
|
||||
|
||||
/** CPU数量(核数) */
|
||||
/** CPU数量 */
|
||||
@Excel(name = "CPU数量")
|
||||
private Long num;
|
||||
/** CPU核数 */
|
||||
@Excel(name = "CPU核数")
|
||||
private Long cores;
|
||||
|
||||
/** CPU正常运行时间(秒) */
|
||||
@Excel(name = "CPU正常运行时间")
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.tongran.rocketmq.domain;
|
||||
|
||||
import com.tongran.common.core.annotation.Excel;
|
||||
import com.tongran.common.core.web.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* PPPoE配置主表对象 rm_pppoe_config_main
|
||||
*
|
||||
* @author tongran
|
||||
* @date 2025-12-29
|
||||
*/
|
||||
@Data
|
||||
public class RmPppoeConfigMain extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键ID */
|
||||
private Long id;
|
||||
|
||||
/** 客户端ID */
|
||||
@Excel(name = "客户端ID")
|
||||
private String clientId;
|
||||
|
||||
/** 是否启用PPPoE(0-否,1-是) */
|
||||
@Excel(name = "是否启用PPPoE(0-否,1-是)")
|
||||
private Long pppoeEnabled;
|
||||
|
||||
/** PPPoE配置方式 */
|
||||
@Excel(name = "PPPoE配置方式")
|
||||
private String pppoeConfigMode;
|
||||
|
||||
/** PPPoE网卡名称 */
|
||||
@Excel(name = "PPPoE网卡名称")
|
||||
private String pppoeInterface;
|
||||
/** pppoe子表集合 */
|
||||
private List<RmPppoeConfigSub> subList;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.tongran.rocketmq.domain;
|
||||
|
||||
import com.tongran.common.core.annotation.Excel;
|
||||
import com.tongran.common.core.web.domain.BaseEntity;
|
||||
import com.tongran.rocketmq.domain.vo.RmPppoeConfigSubVo;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* PPPoE配置子表对象 rm_pppoe_config_sub
|
||||
*
|
||||
* @author tongran
|
||||
* @date 2025-12-29
|
||||
*/
|
||||
@Data
|
||||
public class RmPppoeConfigSub extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键ID */
|
||||
private Long id;
|
||||
|
||||
/** 主表ID */
|
||||
@Excel(name = "主表ID")
|
||||
private Long mainId;
|
||||
|
||||
/** 序号 */
|
||||
@Excel(name = "序号")
|
||||
private Long serialNumber;
|
||||
|
||||
/** VLANID */
|
||||
@Excel(name = "VLANID")
|
||||
private Long vlanId;
|
||||
|
||||
/** IPv4地址 */
|
||||
@Excel(name = "IPv4地址")
|
||||
private String ipv4Address;
|
||||
|
||||
/** IPv4掩码位数 */
|
||||
@Excel(name = "IPv4掩码位数")
|
||||
private Long ipv4MaskBits;
|
||||
|
||||
/** IPv4网关 */
|
||||
@Excel(name = "IPv4网关")
|
||||
private String ipv4Gateway;
|
||||
|
||||
public RmPppoeConfigSubVo toVo() {
|
||||
RmPppoeConfigSubVo vo = new RmPppoeConfigSubVo();
|
||||
vo.setSerialNumber(this.serialNumber);
|
||||
vo.setVlanId(this.vlanId);
|
||||
vo.setIpv4Address(this.ipv4Address);
|
||||
vo.setIpv4MaskBits(this.ipv4MaskBits);
|
||||
vo.setIpv4Gateway(this.ipv4Gateway);
|
||||
return vo;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -19,6 +19,8 @@ public class PolicyTypeVo {
|
||||
private String netName;
|
||||
/** frp配置信息 */
|
||||
private String frpMsg;
|
||||
/** pppoe配置信息 */
|
||||
private String pppoeConfig;
|
||||
/** 时间戳 */
|
||||
private Long timestamp = Instant.now().getEpochSecond();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.tongran.rocketmq.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class PppoeVo {
|
||||
|
||||
/** 是否启用PPPoE(0-否,1-是) */
|
||||
private Long pppoeEnabled;
|
||||
|
||||
/** PPPoE配置方式 */
|
||||
private String pppoeConfigMode;
|
||||
|
||||
/** PPPoE网卡名称 */
|
||||
private String pppoeInterface;
|
||||
/** pppoe子表集合 */
|
||||
private List<RmPppoeConfigSubVo> subList;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.tongran.rocketmq.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* PPPoE配置子表对象 rm_pppoe_config_sub
|
||||
*
|
||||
* @author tongran
|
||||
* @date 2025-12-29
|
||||
*/
|
||||
@Data
|
||||
public class RmPppoeConfigSubVo
|
||||
{
|
||||
|
||||
/** 序号 */
|
||||
private Long serialNumber;
|
||||
|
||||
/** VLANID */
|
||||
private Long vlanId;
|
||||
|
||||
/** IPv4地址 */
|
||||
private String ipv4Address;
|
||||
|
||||
/** IPv4掩码位数 */
|
||||
private Long ipv4MaskBits;
|
||||
|
||||
/** IPv4网关 */
|
||||
private String ipv4Gateway;
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
package com.tongran.rocketmq.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.tongran.rocketmq.domain.RmPppoeConfigMain;
|
||||
|
||||
/**
|
||||
* PPPoE配置主表Mapper接口
|
||||
*
|
||||
* @author tongran
|
||||
* @date 2025-12-29
|
||||
*/
|
||||
public interface RmPppoeConfigMainMapper
|
||||
{
|
||||
/**
|
||||
* 查询PPPoE配置主表
|
||||
*
|
||||
* @param id PPPoE配置主表主键
|
||||
* @return PPPoE配置主表
|
||||
*/
|
||||
public RmPppoeConfigMain selectRmPppoeConfigMainById(Long id);
|
||||
|
||||
/**
|
||||
* 查询PPPoE配置主表列表
|
||||
*
|
||||
* @param rmPppoeConfigMain PPPoE配置主表
|
||||
* @return PPPoE配置主表集合
|
||||
*/
|
||||
public List<RmPppoeConfigMain> selectRmPppoeConfigMainList(RmPppoeConfigMain rmPppoeConfigMain);
|
||||
|
||||
/**
|
||||
* 新增PPPoE配置主表
|
||||
*
|
||||
* @param rmPppoeConfigMain PPPoE配置主表
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRmPppoeConfigMain(RmPppoeConfigMain rmPppoeConfigMain);
|
||||
|
||||
/**
|
||||
* 修改PPPoE配置主表
|
||||
*
|
||||
* @param rmPppoeConfigMain PPPoE配置主表
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRmPppoeConfigMain(RmPppoeConfigMain rmPppoeConfigMain);
|
||||
|
||||
/**
|
||||
* 删除PPPoE配置主表
|
||||
*
|
||||
* @param id PPPoE配置主表主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmPppoeConfigMainById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除PPPoE配置主表
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmPppoeConfigMainByIds(Long[] ids);
|
||||
}
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
package com.tongran.rocketmq.mapper;
|
||||
|
||||
import com.tongran.rocketmq.domain.RmPppoeConfigSub;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* PPPoE配置子表Mapper接口
|
||||
*
|
||||
* @author tongran
|
||||
* @date 2025-12-29
|
||||
*/
|
||||
public interface RmPppoeConfigSubMapper
|
||||
{
|
||||
/**
|
||||
* 查询PPPoE配置子表
|
||||
*
|
||||
* @param id PPPoE配置子表主键
|
||||
* @return PPPoE配置子表
|
||||
*/
|
||||
public RmPppoeConfigSub selectRmPppoeConfigSubById(Long id);
|
||||
|
||||
/**
|
||||
* 查询PPPoE配置子表列表
|
||||
*
|
||||
* @param rmPppoeConfigSub PPPoE配置子表
|
||||
* @return PPPoE配置子表集合
|
||||
*/
|
||||
public List<RmPppoeConfigSub> selectRmPppoeConfigSubList(RmPppoeConfigSub rmPppoeConfigSub);
|
||||
|
||||
/**
|
||||
* 新增PPPoE配置子表
|
||||
*
|
||||
* @param rmPppoeConfigSub PPPoE配置子表
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRmPppoeConfigSub(RmPppoeConfigSub rmPppoeConfigSub);
|
||||
|
||||
/**
|
||||
* 修改PPPoE配置子表
|
||||
*
|
||||
* @param rmPppoeConfigSub PPPoE配置子表
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRmPppoeConfigSub(RmPppoeConfigSub rmPppoeConfigSub);
|
||||
|
||||
/**
|
||||
* 删除PPPoE配置子表
|
||||
*
|
||||
* @param id PPPoE配置子表主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmPppoeConfigSubById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除PPPoE配置子表
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmPppoeConfigSubByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 批量新增子表信息
|
||||
* @param subList
|
||||
* @return
|
||||
*/
|
||||
int batchInsertRmPppoeConfigSub(List<RmPppoeConfigSub> subList);
|
||||
|
||||
/**
|
||||
* 根据主表id删除子表信息
|
||||
* @param mainId
|
||||
* @return
|
||||
*/
|
||||
int deleteRmPppoeConfigSubByMainId(Long mainId);
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
package com.tongran.rocketmq.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.tongran.rocketmq.domain.RmPppoeConfigMain;
|
||||
|
||||
/**
|
||||
* PPPoE配置主表Service接口
|
||||
*
|
||||
* @author tongran
|
||||
* @date 2025-12-29
|
||||
*/
|
||||
public interface IRmPppoeConfigMainService
|
||||
{
|
||||
/**
|
||||
* 查询PPPoE配置主表
|
||||
*
|
||||
* @param id PPPoE配置主表主键
|
||||
* @return PPPoE配置主表
|
||||
*/
|
||||
public RmPppoeConfigMain selectRmPppoeConfigMainById(Long id);
|
||||
|
||||
/**
|
||||
* 查询PPPoE配置主表列表
|
||||
*
|
||||
* @param rmPppoeConfigMain PPPoE配置主表
|
||||
* @return PPPoE配置主表集合
|
||||
*/
|
||||
public List<RmPppoeConfigMain> selectRmPppoeConfigMainList(RmPppoeConfigMain rmPppoeConfigMain);
|
||||
|
||||
/**
|
||||
* 新增PPPoE配置主表
|
||||
*
|
||||
* @param rmPppoeConfigMain PPPoE配置主表
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRmPppoeConfigMain(RmPppoeConfigMain rmPppoeConfigMain);
|
||||
|
||||
/**
|
||||
* 修改PPPoE配置主表
|
||||
*
|
||||
* @param rmPppoeConfigMain PPPoE配置主表
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRmPppoeConfigMain(RmPppoeConfigMain rmPppoeConfigMain);
|
||||
|
||||
/**
|
||||
* 批量删除PPPoE配置主表
|
||||
*
|
||||
* @param ids 需要删除的PPPoE配置主表主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmPppoeConfigMainByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除PPPoE配置主表信息
|
||||
*
|
||||
* @param id PPPoE配置主表主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmPppoeConfigMainById(Long id);
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
package com.tongran.rocketmq.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.tongran.rocketmq.domain.RmPppoeConfigSub;
|
||||
|
||||
/**
|
||||
* PPPoE配置子表Service接口
|
||||
*
|
||||
* @author tongran
|
||||
* @date 2025-12-29
|
||||
*/
|
||||
public interface IRmPppoeConfigSubService
|
||||
{
|
||||
/**
|
||||
* 查询PPPoE配置子表
|
||||
*
|
||||
* @param id PPPoE配置子表主键
|
||||
* @return PPPoE配置子表
|
||||
*/
|
||||
public RmPppoeConfigSub selectRmPppoeConfigSubById(Long id);
|
||||
|
||||
/**
|
||||
* 查询PPPoE配置子表列表
|
||||
*
|
||||
* @param rmPppoeConfigSub PPPoE配置子表
|
||||
* @return PPPoE配置子表集合
|
||||
*/
|
||||
public List<RmPppoeConfigSub> selectRmPppoeConfigSubList(RmPppoeConfigSub rmPppoeConfigSub);
|
||||
|
||||
/**
|
||||
* 新增PPPoE配置子表
|
||||
*
|
||||
* @param rmPppoeConfigSub PPPoE配置子表
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRmPppoeConfigSub(RmPppoeConfigSub rmPppoeConfigSub);
|
||||
|
||||
/**
|
||||
* 修改PPPoE配置子表
|
||||
*
|
||||
* @param rmPppoeConfigSub PPPoE配置子表
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRmPppoeConfigSub(RmPppoeConfigSub rmPppoeConfigSub);
|
||||
|
||||
/**
|
||||
* 批量删除PPPoE配置子表
|
||||
*
|
||||
* @param ids 需要删除的PPPoE配置子表主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmPppoeConfigSubByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除PPPoE配置子表信息
|
||||
*
|
||||
* @param id PPPoE配置子表主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmPppoeConfigSubById(Long id);
|
||||
}
|
||||
+155
@@ -0,0 +1,155 @@
|
||||
package com.tongran.rocketmq.service.impl;
|
||||
|
||||
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.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.RmPppoeConfigMainMapper;
|
||||
import com.tongran.rocketmq.mapper.RmPppoeConfigSubMapper;
|
||||
import com.tongran.rocketmq.model.ProducerMode;
|
||||
import com.tongran.rocketmq.producer.MessageProducer;
|
||||
import com.tongran.rocketmq.service.IRmPppoeConfigMainService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* PPPoE配置主表Service业务层处理
|
||||
*
|
||||
* @author tongran
|
||||
* @date 2025-12-29
|
||||
*/
|
||||
@Service
|
||||
public class RmPppoeConfigMainServiceImpl implements IRmPppoeConfigMainService
|
||||
{
|
||||
@Autowired
|
||||
private RmPppoeConfigMainMapper rmPppoeConfigMainMapper;
|
||||
@Autowired
|
||||
private RmPppoeConfigSubMapper rmPppoeConfigSubMapper;
|
||||
@Autowired
|
||||
private ProducerMode producerMode;
|
||||
|
||||
/**
|
||||
* 查询PPPoE配置主表
|
||||
*
|
||||
* @param id PPPoE配置主表主键
|
||||
* @return PPPoE配置主表
|
||||
*/
|
||||
@Override
|
||||
public RmPppoeConfigMain selectRmPppoeConfigMainById(Long id)
|
||||
{
|
||||
RmPppoeConfigMain rmPppoeConfigMain = rmPppoeConfigMainMapper.selectRmPppoeConfigMainById(id);
|
||||
// 查询子表信息
|
||||
RmPppoeConfigSub rmPppoeConfigSub = new RmPppoeConfigSub();
|
||||
rmPppoeConfigSub.setMainId(id);
|
||||
List<RmPppoeConfigSub> subList = rmPppoeConfigSubMapper.selectRmPppoeConfigSubList(rmPppoeConfigSub);
|
||||
rmPppoeConfigMain.setSubList(subList);
|
||||
return rmPppoeConfigMain;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询PPPoE配置主表列表
|
||||
*
|
||||
* @param rmPppoeConfigMain PPPoE配置主表
|
||||
* @return PPPoE配置主表
|
||||
*/
|
||||
@Override
|
||||
public List<RmPppoeConfigMain> selectRmPppoeConfigMainList(RmPppoeConfigMain rmPppoeConfigMain)
|
||||
{
|
||||
return rmPppoeConfigMainMapper.selectRmPppoeConfigMainList(rmPppoeConfigMain);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增PPPoE配置主表
|
||||
*
|
||||
* @param rmPppoeConfigMain PPPoE配置主表
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertRmPppoeConfigMain(RmPppoeConfigMain rmPppoeConfigMain)
|
||||
{
|
||||
rmPppoeConfigMain.setCreateTime(DateUtils.getNowDate());
|
||||
int rows = rmPppoeConfigMainMapper.insertRmPppoeConfigMain(rmPppoeConfigMain);
|
||||
List<RmPppoeConfigSub> subList = rmPppoeConfigMain.getSubList();
|
||||
if(subList != null && !subList.isEmpty()){
|
||||
for (RmPppoeConfigSub rmPppoeConfigSub : subList) {
|
||||
rmPppoeConfigSub.setMainId(rmPppoeConfigMain.getId());
|
||||
rmPppoeConfigSub.setCreateTime(DateUtils.getNowDate());
|
||||
rmPppoeConfigSub.setUpdateTime(DateUtils.getNowDate());
|
||||
}
|
||||
// 删除子表信息
|
||||
rmPppoeConfigSubMapper.deleteRmPppoeConfigSubByMainId(rmPppoeConfigMain.getId());
|
||||
// 批量新增
|
||||
rmPppoeConfigSubMapper.batchInsertRmPppoeConfigSub(subList);
|
||||
}
|
||||
// 构建pppoe策略
|
||||
PppoeVo pppoeVo = new PppoeVo();
|
||||
BeanUtils.copyProperties(rmPppoeConfigMain, pppoeVo);
|
||||
List<RmPppoeConfigSubVo> voList = subList.stream()
|
||||
.map(RmPppoeConfigSub::toVo)
|
||||
.collect(Collectors.toList());
|
||||
pppoeVo.setSubList(voList);
|
||||
String pppoeStr = JSONObject.toJSONString(pppoeVo);
|
||||
PolicyTypeVo policyTypeVo = new PolicyTypeVo();
|
||||
policyTypeVo.setPppoeConfig(pppoeStr);
|
||||
MessageProducer messageProducer = new MessageProducer();
|
||||
String configJson = JSONObject.toJSONString(policyTypeVo);
|
||||
DeviceMessage message = new DeviceMessage();
|
||||
message.setClientId(rmPppoeConfigMain.getClientId());
|
||||
message.setData(configJson);
|
||||
message.setDataType(MsgEnum.获取最新策略应答.getValue());
|
||||
|
||||
messageProducer.sendAsyncProducerMessage(
|
||||
producerMode.getAgentTopic(),
|
||||
"",
|
||||
"",
|
||||
JSONObject.toJSONString(message)
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改PPPoE配置主表
|
||||
*
|
||||
* @param rmPppoeConfigMain PPPoE配置主表
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateRmPppoeConfigMain(RmPppoeConfigMain rmPppoeConfigMain)
|
||||
{
|
||||
rmPppoeConfigMain.setUpdateTime(DateUtils.getNowDate());
|
||||
return rmPppoeConfigMainMapper.updateRmPppoeConfigMain(rmPppoeConfigMain);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除PPPoE配置主表
|
||||
*
|
||||
* @param ids 需要删除的PPPoE配置主表主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRmPppoeConfigMainByIds(Long[] ids)
|
||||
{
|
||||
return rmPppoeConfigMainMapper.deleteRmPppoeConfigMainByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除PPPoE配置主表信息
|
||||
*
|
||||
* @param id PPPoE配置主表主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRmPppoeConfigMainById(Long id)
|
||||
{
|
||||
return rmPppoeConfigMainMapper.deleteRmPppoeConfigMainById(id);
|
||||
}
|
||||
}
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
package com.tongran.rocketmq.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.tongran.common.core.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.tongran.rocketmq.mapper.RmPppoeConfigSubMapper;
|
||||
import com.tongran.rocketmq.domain.RmPppoeConfigSub;
|
||||
import com.tongran.rocketmq.service.IRmPppoeConfigSubService;
|
||||
|
||||
/**
|
||||
* PPPoE配置子表Service业务层处理
|
||||
*
|
||||
* @author tongran
|
||||
* @date 2025-12-29
|
||||
*/
|
||||
@Service
|
||||
public class RmPppoeConfigSubServiceImpl implements IRmPppoeConfigSubService
|
||||
{
|
||||
@Autowired
|
||||
private RmPppoeConfigSubMapper rmPppoeConfigSubMapper;
|
||||
|
||||
/**
|
||||
* 查询PPPoE配置子表
|
||||
*
|
||||
* @param id PPPoE配置子表主键
|
||||
* @return PPPoE配置子表
|
||||
*/
|
||||
@Override
|
||||
public RmPppoeConfigSub selectRmPppoeConfigSubById(Long id)
|
||||
{
|
||||
return rmPppoeConfigSubMapper.selectRmPppoeConfigSubById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询PPPoE配置子表列表
|
||||
*
|
||||
* @param rmPppoeConfigSub PPPoE配置子表
|
||||
* @return PPPoE配置子表
|
||||
*/
|
||||
@Override
|
||||
public List<RmPppoeConfigSub> selectRmPppoeConfigSubList(RmPppoeConfigSub rmPppoeConfigSub)
|
||||
{
|
||||
return rmPppoeConfigSubMapper.selectRmPppoeConfigSubList(rmPppoeConfigSub);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增PPPoE配置子表
|
||||
*
|
||||
* @param rmPppoeConfigSub PPPoE配置子表
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertRmPppoeConfigSub(RmPppoeConfigSub rmPppoeConfigSub)
|
||||
{
|
||||
rmPppoeConfigSub.setCreateTime(DateUtils.getNowDate());
|
||||
return rmPppoeConfigSubMapper.insertRmPppoeConfigSub(rmPppoeConfigSub);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改PPPoE配置子表
|
||||
*
|
||||
* @param rmPppoeConfigSub PPPoE配置子表
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateRmPppoeConfigSub(RmPppoeConfigSub rmPppoeConfigSub)
|
||||
{
|
||||
rmPppoeConfigSub.setUpdateTime(DateUtils.getNowDate());
|
||||
return rmPppoeConfigSubMapper.updateRmPppoeConfigSub(rmPppoeConfigSub);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除PPPoE配置子表
|
||||
*
|
||||
* @param ids 需要删除的PPPoE配置子表主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRmPppoeConfigSubByIds(Long[] ids)
|
||||
{
|
||||
return rmPppoeConfigSubMapper.deleteRmPppoeConfigSubByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除PPPoE配置子表信息
|
||||
*
|
||||
* @param id PPPoE配置子表主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRmPppoeConfigSubById(Long id)
|
||||
{
|
||||
return rmPppoeConfigSubMapper.deleteRmPppoeConfigSubById(id);
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="interrupt" column="interrupt" />
|
||||
<result property="uti" column="uti" />
|
||||
<result property="num" column="num" />
|
||||
<result property="cores" column="cores" />
|
||||
<result property="normal" column="normal" />
|
||||
<result property="idle" column="idle" />
|
||||
<result property="iowait" column="iowait" />
|
||||
@@ -26,7 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectInitialCpuInfoVo">
|
||||
select id, client_id, avg1, avg5, avg15, interrupt, uti, num, normal, idle, iowait, system, noresp, user, create_by, update_by, create_time, update_time from initial_cpu_info
|
||||
select id, client_id, avg1, avg5, avg15, interrupt, uti, num, cores, normal, idle, iowait, system, noresp, user, create_by, update_by, create_time, update_time from initial_cpu_info
|
||||
</sql>
|
||||
|
||||
<select id="selectInitialCpuInfoList" parameterType="InitialCpuInfo" resultMap="InitialCpuInfoResult">
|
||||
@@ -54,6 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="interrupt != null">interrupt,</if>
|
||||
<if test="uti != null">uti,</if>
|
||||
<if test="num != null">num,</if>
|
||||
<if test="cores != null">cores,</if>
|
||||
<if test="normal != null">normal,</if>
|
||||
<if test="idle != null">idle,</if>
|
||||
<if test="iowait != null">iowait,</if>
|
||||
@@ -73,6 +75,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="interrupt != null">#{interrupt},</if>
|
||||
<if test="uti != null">#{uti},</if>
|
||||
<if test="num != null">#{num},</if>
|
||||
<if test="cores != null">#{cores},</if>
|
||||
<if test="normal != null">#{normal},</if>
|
||||
<if test="idle != null">#{idle},</if>
|
||||
<if test="iowait != null">#{iowait},</if>
|
||||
@@ -96,6 +99,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="interrupt != null">interrupt = #{interrupt},</if>
|
||||
<if test="uti != null">uti = #{uti},</if>
|
||||
<if test="num != null">num = #{num},</if>
|
||||
<if test="cores != null">cores = #{cores},</if>
|
||||
<if test="normal != null">normal = #{normal},</if>
|
||||
<if test="idle != null">idle = #{idle},</if>
|
||||
<if test="iowait != null">iowait = #{iowait},</if>
|
||||
@@ -121,7 +125,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<insert id="batchInsertInitialCpuInfo" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
|
||||
<insert id="batchInsertInitialCpuInfo" parameterType="java.util.List">
|
||||
INSERT IGNORE INTO initial_cpu_info
|
||||
(
|
||||
client_id,
|
||||
@@ -131,6 +135,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
interrupt,
|
||||
uti,
|
||||
num,
|
||||
cores,
|
||||
normal,
|
||||
idle,
|
||||
iowait,
|
||||
@@ -152,6 +157,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
#{item.interrupt},
|
||||
#{item.uti},
|
||||
#{item.num},
|
||||
#{item.cores},
|
||||
#{item.normal},
|
||||
#{item.idle},
|
||||
#{item.iowait},
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.tongran.rocketmq.mapper.RmPppoeConfigMainMapper">
|
||||
|
||||
<resultMap type="RmPppoeConfigMain" id="RmPppoeConfigMainResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="clientId" column="client_id" />
|
||||
<result property="pppoeEnabled" column="pppoe_enabled" />
|
||||
<result property="pppoeConfigMode" column="pppoe_config_mode" />
|
||||
<result property="pppoeInterface" column="pppoe_interface" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectRmPppoeConfigMainVo">
|
||||
select id, client_id, pppoe_enabled, pppoe_config_mode, pppoe_interface, create_time, update_time, create_by, update_by from rm_pppoe_config_main
|
||||
</sql>
|
||||
|
||||
<select id="selectRmPppoeConfigMainList" parameterType="RmPppoeConfigMain" resultMap="RmPppoeConfigMainResult">
|
||||
<include refid="selectRmPppoeConfigMainVo"/>
|
||||
<where>
|
||||
<if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if>
|
||||
<if test="pppoeEnabled != null "> and pppoe_enabled = #{pppoeEnabled}</if>
|
||||
<if test="pppoeConfigMode != null and pppoeConfigMode != ''"> and pppoe_config_mode = #{pppoeConfigMode}</if>
|
||||
<if test="pppoeInterface != null and pppoeInterface != ''"> and pppoe_interface = #{pppoeInterface}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectRmPppoeConfigMainById" parameterType="Long" resultMap="RmPppoeConfigMainResult">
|
||||
<include refid="selectRmPppoeConfigMainVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertRmPppoeConfigMain" parameterType="RmPppoeConfigMain" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into rm_pppoe_config_main
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="clientId != null">client_id,</if>
|
||||
<if test="pppoeEnabled != null">pppoe_enabled,</if>
|
||||
<if test="pppoeConfigMode != null">pppoe_config_mode,</if>
|
||||
<if test="pppoeInterface != null">pppoe_interface,</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>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="clientId != null">#{clientId},</if>
|
||||
<if test="pppoeEnabled != null">#{pppoeEnabled},</if>
|
||||
<if test="pppoeConfigMode != null">#{pppoeConfigMode},</if>
|
||||
<if test="pppoeInterface != null">#{pppoeInterface},</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>
|
||||
ON DUPLICATE KEY UPDATE
|
||||
<trim suffixOverrides=",">
|
||||
<if test="pppoeEnabled != null">pppoe_enabled = VALUES(pppoe_enabled),</if>
|
||||
<if test="pppoeConfigMode != null">pppoe_config_mode = VALUES(pppoe_config_mode),</if>
|
||||
<if test="pppoeInterface != null">pppoe_interface = VALUES(pppoe_interface),</if>
|
||||
<if test="updateTime != null">update_time = VALUES(update_time),</if>
|
||||
<if test="updateBy != null">update_by = VALUES(update_by),</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateRmPppoeConfigMain" parameterType="RmPppoeConfigMain">
|
||||
update rm_pppoe_config_main
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="clientId != null">client_id = #{clientId},</if>
|
||||
<if test="pppoeEnabled != null">pppoe_enabled = #{pppoeEnabled},</if>
|
||||
<if test="pppoeConfigMode != null">pppoe_config_mode = #{pppoeConfigMode},</if>
|
||||
<if test="pppoeInterface != null">pppoe_interface = #{pppoeInterface},</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>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteRmPppoeConfigMainById" parameterType="Long">
|
||||
delete from rm_pppoe_config_main where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteRmPppoeConfigMainByIds" parameterType="String">
|
||||
delete from rm_pppoe_config_main where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -0,0 +1,119 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.tongran.rocketmq.mapper.RmPppoeConfigSubMapper">
|
||||
|
||||
<resultMap type="RmPppoeConfigSub" id="RmPppoeConfigSubResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="mainId" column="main_id" />
|
||||
<result property="serialNumber" column="serial_number" />
|
||||
<result property="vlanId" column="vlan_id" />
|
||||
<result property="ipv4Address" column="ipv4_address" />
|
||||
<result property="ipv4MaskBits" column="ipv4_mask_bits" />
|
||||
<result property="ipv4Gateway" column="ipv4_gateway" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectRmPppoeConfigSubVo">
|
||||
select id, main_id, serial_number, vlan_id, ipv4_address, ipv4_mask_bits, ipv4_gateway, create_time, update_time, create_by, update_by from rm_pppoe_config_sub
|
||||
</sql>
|
||||
|
||||
<select id="selectRmPppoeConfigSubList" parameterType="RmPppoeConfigSub" resultMap="RmPppoeConfigSubResult">
|
||||
<include refid="selectRmPppoeConfigSubVo"/>
|
||||
<where>
|
||||
<if test="mainId != null "> and main_id = #{mainId}</if>
|
||||
<if test="serialNumber != null "> and serial_number = #{serialNumber}</if>
|
||||
<if test="vlanId != null "> and vlan_id = #{vlanId}</if>
|
||||
<if test="ipv4Address != null and ipv4Address != ''"> and ipv4_address = #{ipv4Address}</if>
|
||||
<if test="ipv4MaskBits != null "> and ipv4_mask_bits = #{ipv4MaskBits}</if>
|
||||
<if test="ipv4Gateway != null and ipv4Gateway != ''"> and ipv4_gateway = #{ipv4Gateway}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectRmPppoeConfigSubById" parameterType="Long" resultMap="RmPppoeConfigSubResult">
|
||||
<include refid="selectRmPppoeConfigSubVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertRmPppoeConfigSub" parameterType="RmPppoeConfigSub" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into rm_pppoe_config_sub
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="mainId != null">main_id,</if>
|
||||
<if test="serialNumber != null">serial_number,</if>
|
||||
<if test="vlanId != null">vlan_id,</if>
|
||||
<if test="ipv4Address != null">ipv4_address,</if>
|
||||
<if test="ipv4MaskBits != null">ipv4_mask_bits,</if>
|
||||
<if test="ipv4Gateway != null">ipv4_gateway,</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>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="mainId != null">#{mainId},</if>
|
||||
<if test="serialNumber != null">#{serialNumber},</if>
|
||||
<if test="vlanId != null">#{vlanId},</if>
|
||||
<if test="ipv4Address != null">#{ipv4Address},</if>
|
||||
<if test="ipv4MaskBits != null">#{ipv4MaskBits},</if>
|
||||
<if test="ipv4Gateway != null">#{ipv4Gateway},</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>
|
||||
</insert>
|
||||
|
||||
<update id="updateRmPppoeConfigSub" parameterType="RmPppoeConfigSub">
|
||||
update rm_pppoe_config_sub
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="mainId != null">main_id = #{mainId},</if>
|
||||
<if test="serialNumber != null">serial_number = #{serialNumber},</if>
|
||||
<if test="vlanId != null">vlan_id = #{vlanId},</if>
|
||||
<if test="ipv4Address != null">ipv4_address = #{ipv4Address},</if>
|
||||
<if test="ipv4MaskBits != null">ipv4_mask_bits = #{ipv4MaskBits},</if>
|
||||
<if test="ipv4Gateway != null">ipv4_gateway = #{ipv4Gateway},</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>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteRmPppoeConfigSubById" parameterType="Long">
|
||||
delete from rm_pppoe_config_sub where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteRmPppoeConfigSubByIds" parameterType="String">
|
||||
delete from rm_pppoe_config_sub where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
<insert id="batchInsertRmPppoeConfigSub" parameterType="java.util.List">
|
||||
insert into rm_pppoe_config_sub
|
||||
(main_id, serial_number, vlan_id, ipv4_address, ipv4_mask_bits, ipv4_gateway, create_time, update_time, create_by, update_by)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(
|
||||
#{item.mainId},
|
||||
#{item.serialNumber},
|
||||
#{item.vlanId},
|
||||
#{item.ipv4Address},
|
||||
#{item.ipv4MaskBits},
|
||||
#{item.ipv4Gateway},
|
||||
#{item.createTime},
|
||||
#{item.updateTime},
|
||||
#{item.createBy},
|
||||
#{item.updateBy}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
<delete id="deleteRmPppoeConfigSubByMainId" parameterType="Long">
|
||||
delete from rm_pppoe_config_sub where main_id = #{mainId}
|
||||
</delete>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user