资源模板以及资源策略模块方法和接口。
This commit is contained in:
@@ -244,7 +244,7 @@ public class EpsNodeBandwidthController extends BaseController
|
||||
{
|
||||
// 设置时间
|
||||
DateUtil.setTimeDay(epsNodeBandwidth);
|
||||
Map list = epsNodeBandwidthService.graphicalAnalysis(epsNodeBandwidth, "1", ChronoUnit.DAYS);
|
||||
List<Map> list = epsNodeBandwidthService.graphicalAnalysis(epsNodeBandwidth, "1", ChronoUnit.DAYS);
|
||||
return success(list);
|
||||
}
|
||||
/**
|
||||
@@ -256,7 +256,7 @@ public class EpsNodeBandwidthController extends BaseController
|
||||
{
|
||||
// 设置时间
|
||||
DateUtil.setTimeMonth(epsNodeBandwidth);
|
||||
Map list = epsNodeBandwidthService.graphicalAnalysis(epsNodeBandwidth, "2", ChronoUnit.MONTHS);
|
||||
List<Map> list = epsNodeBandwidthService.graphicalAnalysis(epsNodeBandwidth, "2", ChronoUnit.MONTHS);
|
||||
return success(list);
|
||||
}
|
||||
/**
|
||||
@@ -268,7 +268,7 @@ public class EpsNodeBandwidthController extends BaseController
|
||||
{
|
||||
// 设置时间
|
||||
DateUtil.setTimeDay(epsNodeBandwidth);
|
||||
Map list = epsNodeBandwidthService.graphicalAnalysis(epsNodeBandwidth, "3", ChronoUnit.DAYS);
|
||||
List<Map> list = epsNodeBandwidthService.graphicalAnalysis(epsNodeBandwidth, "3", ChronoUnit.DAYS);
|
||||
return success(list);
|
||||
}
|
||||
/**
|
||||
@@ -280,7 +280,7 @@ public class EpsNodeBandwidthController extends BaseController
|
||||
{
|
||||
// 设置时间
|
||||
DateUtil.setTimeMonth(epsNodeBandwidth);
|
||||
Map list = epsNodeBandwidthService.graphicalAnalysis(epsNodeBandwidth, "4", ChronoUnit.MONTHS);
|
||||
List<Map> list = epsNodeBandwidthService.graphicalAnalysis(epsNodeBandwidth, "4", ChronoUnit.MONTHS);
|
||||
return success(list);
|
||||
}
|
||||
/**
|
||||
@@ -292,7 +292,7 @@ public class EpsNodeBandwidthController extends BaseController
|
||||
{
|
||||
// 设置时间
|
||||
DateUtil.setTimeDay(epsNodeBandwidth);
|
||||
Map list = epsNodeBandwidthService.graphicalAnalysis(epsNodeBandwidth, "5", ChronoUnit.DAYS);
|
||||
List<Map> list = epsNodeBandwidthService.graphicalAnalysis(epsNodeBandwidth, "5", ChronoUnit.DAYS);
|
||||
return success(list);
|
||||
}
|
||||
/**
|
||||
@@ -304,7 +304,7 @@ public class EpsNodeBandwidthController extends BaseController
|
||||
{
|
||||
// 设置时间
|
||||
DateUtil.setTimeMonth(epsNodeBandwidth);
|
||||
Map list = epsNodeBandwidthService.graphicalAnalysis(epsNodeBandwidth, "6", ChronoUnit.MONTHS);
|
||||
List<Map> list = epsNodeBandwidthService.graphicalAnalysis(epsNodeBandwidth, "6", ChronoUnit.MONTHS);
|
||||
return success(list);
|
||||
}
|
||||
/**
|
||||
@@ -316,7 +316,7 @@ public class EpsNodeBandwidthController extends BaseController
|
||||
{
|
||||
// 设置时间
|
||||
DateUtil.setTimeMonth(epsNodeBandwidth);
|
||||
Map list = epsNodeBandwidthService.graphicalAnalysis(epsNodeBandwidth, "7", ChronoUnit.MONTHS);
|
||||
List<Map> list = epsNodeBandwidthService.graphicalAnalysis(epsNodeBandwidth, "7", ChronoUnit.MONTHS);
|
||||
return success(list);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.ruoyi.system.controller;
|
||||
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.web.controller.BaseController;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
@@ -7,6 +8,7 @@ import com.ruoyi.common.core.web.page.PageDomain;
|
||||
import com.ruoyi.common.core.web.page.TableDataInfo;
|
||||
import com.ruoyi.common.log.annotation.Log;
|
||||
import com.ruoyi.common.log.enums.BusinessType;
|
||||
import com.ruoyi.common.security.annotation.InnerAuth;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.ruoyi.system.domain.RmResourceGroup;
|
||||
import com.ruoyi.system.service.IRmResourceGroupService;
|
||||
@@ -100,4 +102,14 @@ public class RmResourceGroupController extends BaseController
|
||||
{
|
||||
return toAjax(rmResourceGroupService.deleteRmResourceGroupByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取资源分组详细信息
|
||||
*/
|
||||
@InnerAuth
|
||||
@GetMapping(value = "/getResourceGroupMsgById")
|
||||
public R<RmResourceGroup> getResourceGroupMsgById(Long id)
|
||||
{
|
||||
return R.ok(rmResourceGroupService.selectRmResourceGroupById(id));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,5 +144,17 @@ public class RmResourceRegistrationController extends BaseController
|
||||
return rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询资源信息
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getRegistrationByIds")
|
||||
public R<List<RmResourceRegistration>> getRegistrationByIds(String[] ids)
|
||||
{
|
||||
List<RmResourceRegistration> list = rmResourceRegistrationService.getRegistrationByIds(ids);
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -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 RmResourceGroup extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
@@ -29,9 +29,11 @@ public class RmResourceGroup extends BaseEntity
|
||||
@Excel(name = "描述")
|
||||
private String description;
|
||||
|
||||
/** 包含设备 */
|
||||
/** 包含设备id */
|
||||
private String includedDevicesId;
|
||||
/** 包含设备名称 */
|
||||
@Excel(name = "包含设备")
|
||||
private String includedDevices;
|
||||
private String includedDevicesName;
|
||||
|
||||
/** 创建时间 */
|
||||
@Excel(name = "创建时间",dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
@@ -55,119 +57,4 @@ public class RmResourceGroup 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 setGroupName(String groupName)
|
||||
{
|
||||
this.groupName = groupName;
|
||||
}
|
||||
|
||||
public String getGroupName()
|
||||
{
|
||||
return groupName;
|
||||
}
|
||||
|
||||
public void setDescription(String description)
|
||||
{
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getDescription()
|
||||
{
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setIncludedDevices(String includedDevices)
|
||||
{
|
||||
this.includedDevices = includedDevices;
|
||||
}
|
||||
|
||||
public String getIncludedDevices()
|
||||
{
|
||||
return includedDevices;
|
||||
}
|
||||
|
||||
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("groupName", getGroupName())
|
||||
.append("description", getDescription())
|
||||
.append("includedDevices", getIncludedDevices())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("creatorId", getCreatorId())
|
||||
.append("creatorName", getCreatorName())
|
||||
.append("updaterId", getUpdaterId())
|
||||
.append("updaterName", getUpdaterName())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.ruoyi.system.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class MessageVo {
|
||||
|
||||
private String clientId;
|
||||
|
||||
private String dataType;
|
||||
|
||||
private String data;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.ruoyi.system.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.Instant;
|
||||
|
||||
@Data
|
||||
public class ResourceVo {
|
||||
|
||||
private String clientIp;
|
||||
|
||||
private Integer clientPort;
|
||||
|
||||
private String switchBoard;
|
||||
|
||||
private Long timestamp = Instant.now().getEpochSecond();
|
||||
}
|
||||
@@ -84,4 +84,6 @@ public interface RmResourceRegistrationMapper
|
||||
* @return
|
||||
*/
|
||||
Integer updateStatusByResource(RmResourceRegistration rmResourceRegistration);
|
||||
|
||||
List<RmResourceRegistration> getRegistrationByIds(String[] ids);
|
||||
}
|
||||
|
||||
@@ -86,5 +86,5 @@ public interface IEpsNodeBandwidthService
|
||||
* @param epsNodeBandwidth
|
||||
* @return
|
||||
*/
|
||||
Map graphicalAnalysis(EpsNodeBandwidth epsNodeBandwidth, String bandwidthType, ChronoUnit timeUnit);
|
||||
List<Map> graphicalAnalysis(EpsNodeBandwidth epsNodeBandwidth, String bandwidthType, ChronoUnit timeUnit);
|
||||
}
|
||||
|
||||
@@ -88,4 +88,6 @@ public interface IRmResourceRegistrationService
|
||||
R<String> updateStatusByResource(RmResourceRegistration rmResourceRegistration);
|
||||
|
||||
AjaxResult getServerOnlineRate();
|
||||
|
||||
List<RmResourceRegistration> getRegistrationByIds(String[] ids);
|
||||
}
|
||||
|
||||
@@ -296,8 +296,8 @@ public class EpsNodeBandwidthServiceImpl implements IEpsNodeBandwidthService
|
||||
return pageInfo;
|
||||
}
|
||||
@Override
|
||||
public Map graphicalAnalysis(EpsNodeBandwidth epsNodeBandwidth, String bandwidthType, ChronoUnit timeUnit){
|
||||
Map<String, Object> nodeData = new HashMap<>();
|
||||
public List<Map> graphicalAnalysis(EpsNodeBandwidth epsNodeBandwidth, String bandwidthType, ChronoUnit timeUnit){
|
||||
List<Map> mapList = new ArrayList<>();
|
||||
// 拿到列表
|
||||
List<EpsNodeBandwidth> nodeBandwidthList = epsNodeBandwidthMapper.selectEpsNodeBandwidthList(epsNodeBandwidth);
|
||||
Map<String, EpsNodeBandwidth> uniqueNodes = nodeBandwidthList.stream()
|
||||
@@ -310,6 +310,7 @@ public class EpsNodeBandwidthServiceImpl implements IEpsNodeBandwidthService
|
||||
(existing, replacement) -> existing
|
||||
));
|
||||
uniqueNodes.values().forEach(node -> {
|
||||
Map<String, Object> nodeData = new HashMap<>();
|
||||
|
||||
// 基础信息
|
||||
nodeData.put("nodeName", node.getNodeName());
|
||||
@@ -326,8 +327,9 @@ public class EpsNodeBandwidthServiceImpl implements IEpsNodeBandwidthService
|
||||
epsNodeBandwidth.getEndTime(),
|
||||
timeUnit
|
||||
));
|
||||
mapList.add(nodeData);
|
||||
});
|
||||
return nodeData;
|
||||
return mapList;
|
||||
}
|
||||
|
||||
// 动态生成复合键
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ruoyi.common.core.constant.SecurityConstants;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.utils.DateUtils;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.security.utils.SecurityUtils;
|
||||
import com.ruoyi.system.api.RemoteRocketMqService;
|
||||
import com.ruoyi.system.domain.EpsNodeBandwidth;
|
||||
import com.ruoyi.system.domain.EpsServerRevenueConfig;
|
||||
import com.ruoyi.system.domain.RmEpsTopologyManagement;
|
||||
import com.ruoyi.system.domain.RmResourceRegistration;
|
||||
import com.ruoyi.system.domain.vo.MessageVo;
|
||||
import com.ruoyi.system.domain.vo.ResourceVo;
|
||||
import com.ruoyi.system.mapper.EpsNodeBandwidthMapper;
|
||||
import com.ruoyi.system.mapper.EpsServerRevenueConfigMapper;
|
||||
import com.ruoyi.system.mapper.RmEpsTopologyManagementMapper;
|
||||
@@ -18,6 +23,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -38,6 +44,8 @@ public class RmResourceRegistrationServiceImpl implements IRmResourceRegistratio
|
||||
private RmEpsTopologyManagementMapper rmEpsTopologyManagementMapper;
|
||||
@Autowired
|
||||
private EpsNodeBandwidthMapper epsNodeBandwidthMapper;
|
||||
@Autowired
|
||||
private RemoteRocketMqService remoteRocketMqService;
|
||||
|
||||
/**
|
||||
* 查询资源注册
|
||||
@@ -169,35 +177,87 @@ public class RmResourceRegistrationServiceImpl implements IRmResourceRegistratio
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int register(RmResourceRegistration rmResourceRegistration)
|
||||
{
|
||||
public int register(RmResourceRegistration rmResourceRegistration) {
|
||||
// 设置更新信息
|
||||
rmResourceRegistration.setUpdateTime(DateUtils.getNowDate());
|
||||
rmResourceRegistration.setUpdaterId(SecurityUtils.getUserId());
|
||||
rmResourceRegistration.setUpdaterName(SecurityUtils.getUsername());
|
||||
if("1".equals(rmResourceRegistration.getResourceType())){
|
||||
// 注册服务器 添加到服务器收益配置表
|
||||
EpsServerRevenueConfig epsServerRevenueConfig = new EpsServerRevenueConfig();
|
||||
epsServerRevenueConfig.setHardwareSn(rmResourceRegistration.getHardwareSn());
|
||||
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){
|
||||
// 存在 修改
|
||||
epsServerRevenueConfig.setId(exits.getId());
|
||||
epsServerRevenueConfigMapper.updateEpsServerRevenueConfig(epsServerRevenueConfig);
|
||||
}else{
|
||||
// 不存在 新增
|
||||
epsServerRevenueConfigMapper.insertEpsServerRevenueConfig(epsServerRevenueConfig);
|
||||
}
|
||||
|
||||
// 处理服务器资源注册
|
||||
if ("1".equals(rmResourceRegistration.getResourceType())) {
|
||||
handleServerRegistration(rmResourceRegistration);
|
||||
}
|
||||
// 仅注册
|
||||
RmResourceRegistration resourceRegistration = new RmResourceRegistration();
|
||||
resourceRegistration.setId(rmResourceRegistration.getId());
|
||||
resourceRegistration.setRegistrationStatus(rmResourceRegistration.getRegistrationStatus());
|
||||
return rmResourceRegistrationMapper.updateRmResourceRegistration(resourceRegistration);
|
||||
|
||||
// 发送消息通知
|
||||
sendRegistrationMessage(rmResourceRegistration);
|
||||
|
||||
// 更新注册状态
|
||||
return updateRegistrationStatus(rmResourceRegistration);
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理服务器资源注册
|
||||
*/
|
||||
private void handleServerRegistration(RmResourceRegistration registration) {
|
||||
EpsServerRevenueConfig config = new EpsServerRevenueConfig();
|
||||
config.setHardwareSn(registration.getHardwareSn());
|
||||
config.setNodeName(registration.getResourceName());
|
||||
config.setCreateTime(DateUtils.getNowDate());
|
||||
config.setRegistrationStatus(registration.getRegistrationStatus());
|
||||
config.setServerIp(registration.getIpAddress());
|
||||
|
||||
EpsServerRevenueConfig existing = epsServerRevenueConfigMapper.countBySn(config.getHardwareSn());
|
||||
if (existing != null) {
|
||||
config.setId(existing.getId());
|
||||
epsServerRevenueConfigMapper.updateEpsServerRevenueConfig(config);
|
||||
} else {
|
||||
epsServerRevenueConfigMapper.insertEpsServerRevenueConfig(config);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送注册/断开连接消息
|
||||
*/
|
||||
private void sendRegistrationMessage(RmResourceRegistration registration) {
|
||||
String messageType = "1".equals(registration.getRegistrationStatus()) ? "REGISTER" : "DISCONNECT";
|
||||
ResourceVo resourceVo = createResourceVo(registration);
|
||||
|
||||
MessageVo messageVo = new MessageVo();
|
||||
messageVo.setClientId(registration.getHardwareSn());
|
||||
messageVo.setDataType(messageType);
|
||||
messageVo.setData(JSONObject.toJSONString(resourceVo));
|
||||
|
||||
remoteRocketMqService.sendAsyncProducerMessage(
|
||||
"tongran_agent_down", "", "", JSONObject.toJSONString(messageVo), SecurityConstants.INNER);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建资源VO对象
|
||||
*/
|
||||
private ResourceVo createResourceVo(RmResourceRegistration registration) {
|
||||
ResourceVo resourceVo = new ResourceVo();
|
||||
resourceVo.setClientIp(registration.getIpAddress());
|
||||
resourceVo.setClientPort(Integer.valueOf(registration.getResourcePort()));
|
||||
|
||||
if (!"1".equals(registration.getResourceType())) {
|
||||
Map<String, String> switchMap = new HashMap<>();
|
||||
switchMap.put("community", registration.getTeamName());
|
||||
switchMap.put("ip", registration.getIpAddress());
|
||||
switchMap.put("port", registration.getResourcePort());
|
||||
resourceVo.setSwitchBoard(JSONObject.toJSONString(switchMap));
|
||||
}
|
||||
|
||||
return resourceVo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新注册状态
|
||||
*/
|
||||
private int updateRegistrationStatus(RmResourceRegistration registration) {
|
||||
RmResourceRegistration updateParam = new RmResourceRegistration();
|
||||
updateParam.setId(registration.getId());
|
||||
updateParam.setRegistrationStatus(registration.getRegistrationStatus());
|
||||
return rmResourceRegistrationMapper.updateRmResourceRegistration(updateParam);
|
||||
}
|
||||
/**
|
||||
* 批量删除资源注册
|
||||
@@ -280,5 +340,15 @@ public class RmResourceRegistrationServiceImpl implements IRmResourceRegistratio
|
||||
.put("onlineRate", onlineRate);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询资源注册信息
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<RmResourceRegistration> getRegistrationByIds(String[] ids) {
|
||||
return rmResourceRegistrationMapper.getRegistrationByIds(ids);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
<?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">
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.system.mapper.RmResourceGroupMapper">
|
||||
|
||||
|
||||
<resultMap type="RmResourceGroup" id="RmResourceGroupResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="groupName" column="group_name" />
|
||||
<result property="description" column="description" />
|
||||
<result property="includedDevices" column="included_devices" />
|
||||
<result property="includedDevicesId" column="included_devices_id" />
|
||||
<result property="includedDevicesName" column="included_devices_name" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="creatorId" column="creator_id" />
|
||||
@@ -18,22 +19,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectRmResourceGroupVo">
|
||||
select id, group_name, description, included_devices, create_time, update_time, creator_id, creator_name, updater_id, updater_name from rm_resource_group
|
||||
select id, group_name, description, included_devices_id, included_devices_name, create_time, update_time, creator_id, creator_name, updater_id, updater_name from rm_resource_group
|
||||
</sql>
|
||||
|
||||
<select id="selectRmResourceGroupList" parameterType="RmResourceGroup" resultMap="RmResourceGroupResult">
|
||||
<include refid="selectRmResourceGroupVo"/>
|
||||
<where>
|
||||
<where>
|
||||
<if test="groupName != null and groupName != ''"> and group_name like concat('%', #{groupName}, '%')</if>
|
||||
<if test="description != null and description != ''"> and description = #{description}</if>
|
||||
<if test="includedDevices != null and includedDevices != ''"> and included_devices = #{includedDevices}</if>
|
||||
<if test="includedDevicesId != null and includedDevicesId != ''"> and included_devices_id = #{includedDevicesId}</if>
|
||||
<if test="includedDevicesName != null and includedDevicesName != ''"> and included_devices_name like concat('%', #{includedDevicesName}, '%')</if>
|
||||
<if test="creatorId != null "> and creator_id = #{creatorId}</if>
|
||||
<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>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectRmResourceGroupById" parameterType="Long" resultMap="RmResourceGroupResult">
|
||||
<include refid="selectRmResourceGroupVo"/>
|
||||
where id = #{id}
|
||||
@@ -44,25 +46,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="groupName != null">group_name,</if>
|
||||
<if test="description != null">description,</if>
|
||||
<if test="includedDevices != null">included_devices,</if>
|
||||
<if test="includedDevicesId != null">included_devices_id,</if>
|
||||
<if test="includedDevicesName != null">included_devices_name,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="creatorId != null">creator_id,</if>
|
||||
<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="groupName != null">#{groupName},</if>
|
||||
<if test="description != null">#{description},</if>
|
||||
<if test="includedDevices != null">#{includedDevices},</if>
|
||||
<if test="includedDevicesId != null">#{includedDevicesId},</if>
|
||||
<if test="includedDevicesName != null">#{includedDevicesName},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="creatorId != null">#{creatorId},</if>
|
||||
<if test="creatorName != null">#{creatorName},</if>
|
||||
<if test="updaterId != null">#{updaterId},</if>
|
||||
<if test="updaterName != null">#{updaterName},</if>
|
||||
</trim>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateRmResourceGroup" parameterType="RmResourceGroup">
|
||||
@@ -70,7 +74,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="groupName != null">group_name = #{groupName},</if>
|
||||
<if test="description != null">description = #{description},</if>
|
||||
<if test="includedDevices != null">included_devices = #{includedDevices},</if>
|
||||
<if test="includedDevicesId != null">included_devices_id = #{includedDevicesId},</if>
|
||||
<if test="includedDevicesName != null">included_devices_name = #{includedDevicesName},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="creatorId != null">creator_id = #{creatorId},</if>
|
||||
@@ -86,7 +91,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</delete>
|
||||
|
||||
<delete id="deleteRmResourceGroupByIds" parameterType="String">
|
||||
delete from rm_resource_group where id in
|
||||
delete from rm_resource_group where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
|
||||
@@ -193,11 +193,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</delete>
|
||||
<!-- 查询所有资源名称(包含设备使用)-->
|
||||
<select id="selectAllResourceName" resultType="java.util.Map">
|
||||
select resource_name resourceName from rm_resource_registration
|
||||
select id id,resource_name resourceName from rm_resource_registration
|
||||
<where>
|
||||
and registration_status = 1
|
||||
</where>
|
||||
group by resource_name
|
||||
group by id
|
||||
</select>
|
||||
<!-- 查询所有资源名称-->
|
||||
<select id="selectAllResourceNameByType" parameterType="RmResourceRegistration" resultType="java.util.Map">
|
||||
@@ -269,4 +269,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</trim>
|
||||
where ip_address = #{ipAddress}
|
||||
</update>
|
||||
<select id="getRegistrationByIds" parameterType="String" resultMap="RmResourceRegistrationResult">
|
||||
<include refid="selectRmResourceRegistrationVo"/>
|
||||
where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user