资源注册模块java代码
This commit is contained in:
+104
@@ -0,0 +1,104 @@
|
||||
package com.ruoyi.system.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.log.annotation.Log;
|
||||
import com.ruoyi.common.log.enums.BusinessType;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.ruoyi.system.domain.RmResourceRegistration;
|
||||
import com.ruoyi.system.service.IRmResourceRegistrationService;
|
||||
import com.ruoyi.common.core.web.controller.BaseController;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.web.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 资源注册Controller
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-08-12
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/registration")
|
||||
public class RmResourceRegistrationController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IRmResourceRegistrationService rmResourceRegistrationService;
|
||||
|
||||
/**
|
||||
* 查询资源注册列表
|
||||
*/
|
||||
@RequiresPermissions("system:registration:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(RmResourceRegistration rmResourceRegistration)
|
||||
{
|
||||
startPage();
|
||||
List<RmResourceRegistration> list = rmResourceRegistrationService.selectRmResourceRegistrationList(rmResourceRegistration);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出资源注册列表
|
||||
*/
|
||||
@RequiresPermissions("system:registration:export")
|
||||
@Log(title = "资源注册", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, RmResourceRegistration rmResourceRegistration)
|
||||
{
|
||||
List<RmResourceRegistration> list = rmResourceRegistrationService.selectRmResourceRegistrationList(rmResourceRegistration);
|
||||
ExcelUtil<RmResourceRegistration> util = new ExcelUtil<RmResourceRegistration>(RmResourceRegistration.class);
|
||||
util.exportExcel(response, list, "资源注册数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取资源注册详细信息
|
||||
*/
|
||||
@RequiresPermissions("system:registration:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(rmResourceRegistrationService.selectRmResourceRegistrationById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增资源注册
|
||||
*/
|
||||
@RequiresPermissions("system:registration:add")
|
||||
@Log(title = "资源注册", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody RmResourceRegistration rmResourceRegistration)
|
||||
{
|
||||
return toAjax(rmResourceRegistrationService.insertRmResourceRegistration(rmResourceRegistration));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改资源注册
|
||||
*/
|
||||
@RequiresPermissions("system:registration:edit")
|
||||
@Log(title = "资源注册", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody RmResourceRegistration rmResourceRegistration)
|
||||
{
|
||||
return toAjax(rmResourceRegistrationService.updateRmResourceRegistration(rmResourceRegistration));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除资源注册
|
||||
*/
|
||||
@RequiresPermissions("system:registration:remove")
|
||||
@Log(title = "资源注册", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(rmResourceRegistrationService.deleteRmResourceRegistrationByIds(ids));
|
||||
}
|
||||
}
|
||||
+354
@@ -0,0 +1,354 @@
|
||||
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;
|
||||
|
||||
/**
|
||||
* 资源注册对象 rm_resource_registration
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-08-12
|
||||
*/
|
||||
public class RmResourceRegistration extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** id */
|
||||
private Long id;
|
||||
|
||||
/** 硬件SN */
|
||||
@Excel(name = "硬件SN")
|
||||
private String hardwareSn;
|
||||
|
||||
/** 资源类型
|
||||
* 1 服务器,2 交换机*/
|
||||
@Excel(name = "资源类型")
|
||||
private String resourceType;
|
||||
|
||||
/** 资源名称 */
|
||||
@Excel(name = "资源名称")
|
||||
private String resourceName;
|
||||
|
||||
/** IP地址 */
|
||||
@Excel(name = "IP地址")
|
||||
private String ipAddress;
|
||||
|
||||
/** 端口1.162(SNMP),2.其他 */
|
||||
@Excel(name = "端口")
|
||||
private String resourcePort;
|
||||
|
||||
|
||||
/** 协议 1.TCP,2.UDP */
|
||||
@Excel(name = "协议")
|
||||
private String protocol;
|
||||
|
||||
|
||||
/** 版本(1.SNMPv2,2.SNMPv3) */
|
||||
@Excel(name = "版本")
|
||||
private String resourceVersion;
|
||||
|
||||
/** 读写权限(1.RW,2.ReadOnly) */
|
||||
@Excel(name = "读写权限")
|
||||
private String rwPermission;
|
||||
|
||||
/** 安全级别(1.authPriv、2.authNoPriv,3.noAuthNoPriv) */
|
||||
@Excel(name = "安全级别")
|
||||
private String securityLevel;
|
||||
|
||||
/** 加密方式 1.md5,2.SHA */
|
||||
@Excel(name = "加密方式")
|
||||
private String encryption;
|
||||
|
||||
/** 密码 */
|
||||
@Excel(name = "密码")
|
||||
private String resourcePwd;
|
||||
|
||||
/** 注册状态 0-未注册,1-未注册 */
|
||||
@Excel(name = "注册状态")
|
||||
private String registrationStatus;
|
||||
|
||||
/** 在线状态 0-离线,1-在线 */
|
||||
@Excel(name = "在线状态")
|
||||
private String onlineStatus;
|
||||
|
||||
/** 描述 */
|
||||
@Excel(name = "描述")
|
||||
private String description;
|
||||
|
||||
/** 设备业务客户id */
|
||||
private Long customerId;
|
||||
|
||||
/** 设备业务客户名称 */
|
||||
@Excel(name = "设备业务客户")
|
||||
private String customerName;
|
||||
|
||||
/** 业务号 */
|
||||
@Excel(name = "业务号")
|
||||
private String serviceNumber;
|
||||
|
||||
/** 创建人id */
|
||||
private Long creatorId;
|
||||
|
||||
/** 创建人名称 */
|
||||
private String creatorName;
|
||||
|
||||
/** 修改人id */
|
||||
private Long updaterId;
|
||||
|
||||
/** 修改人名称 */
|
||||
private String updaterName;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@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("protocol", getProtocol())
|
||||
.append("resourceVersion", getResourceVersion())
|
||||
.append("rwPermission", getRwPermission())
|
||||
.append("securityLevel", getSecurityLevel())
|
||||
.append("encryption", getEncryption())
|
||||
.append("resourcePwd", getResourcePwd())
|
||||
.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();
|
||||
}
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.RmResourceRegistration;
|
||||
|
||||
/**
|
||||
* 资源注册Mapper接口
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-08-12
|
||||
*/
|
||||
public interface RmResourceRegistrationMapper
|
||||
{
|
||||
/**
|
||||
* 查询资源注册
|
||||
*
|
||||
* @param id 资源注册主键
|
||||
* @return 资源注册
|
||||
*/
|
||||
public RmResourceRegistration selectRmResourceRegistrationById(Long id);
|
||||
|
||||
/**
|
||||
* 查询资源注册列表
|
||||
*
|
||||
* @param rmResourceRegistration 资源注册
|
||||
* @return 资源注册集合
|
||||
*/
|
||||
public List<RmResourceRegistration> selectRmResourceRegistrationList(RmResourceRegistration rmResourceRegistration);
|
||||
|
||||
/**
|
||||
* 新增资源注册
|
||||
*
|
||||
* @param rmResourceRegistration 资源注册
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRmResourceRegistration(RmResourceRegistration rmResourceRegistration);
|
||||
|
||||
/**
|
||||
* 修改资源注册
|
||||
*
|
||||
* @param rmResourceRegistration 资源注册
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRmResourceRegistration(RmResourceRegistration rmResourceRegistration);
|
||||
|
||||
/**
|
||||
* 删除资源注册
|
||||
*
|
||||
* @param id 资源注册主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmResourceRegistrationById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除资源注册
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmResourceRegistrationByIds(Long[] ids);
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.RmResourceRegistration;
|
||||
|
||||
/**
|
||||
* 资源注册Service接口
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-08-12
|
||||
*/
|
||||
public interface IRmResourceRegistrationService
|
||||
{
|
||||
/**
|
||||
* 查询资源注册
|
||||
*
|
||||
* @param id 资源注册主键
|
||||
* @return 资源注册
|
||||
*/
|
||||
public RmResourceRegistration selectRmResourceRegistrationById(Long id);
|
||||
|
||||
/**
|
||||
* 查询资源注册列表
|
||||
*
|
||||
* @param rmResourceRegistration 资源注册
|
||||
* @return 资源注册集合
|
||||
*/
|
||||
public List<RmResourceRegistration> selectRmResourceRegistrationList(RmResourceRegistration rmResourceRegistration);
|
||||
|
||||
/**
|
||||
* 新增资源注册
|
||||
*
|
||||
* @param rmResourceRegistration 资源注册
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRmResourceRegistration(RmResourceRegistration rmResourceRegistration);
|
||||
|
||||
/**
|
||||
* 修改资源注册
|
||||
*
|
||||
* @param rmResourceRegistration 资源注册
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRmResourceRegistration(RmResourceRegistration rmResourceRegistration);
|
||||
|
||||
/**
|
||||
* 批量删除资源注册
|
||||
*
|
||||
* @param ids 需要删除的资源注册主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmResourceRegistrationByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除资源注册信息
|
||||
*
|
||||
* @param id 资源注册主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmResourceRegistrationById(Long id);
|
||||
}
|
||||
+105
@@ -0,0 +1,105 @@
|
||||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.common.core.utils.DateUtils;
|
||||
import com.ruoyi.common.security.utils.SecurityUtils;
|
||||
import com.ruoyi.system.mapper.SysDictDataMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.system.mapper.RmResourceRegistrationMapper;
|
||||
import com.ruoyi.system.domain.RmResourceRegistration;
|
||||
import com.ruoyi.system.service.IRmResourceRegistrationService;
|
||||
|
||||
/**
|
||||
* 资源注册Service业务层处理
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-08-12
|
||||
*/
|
||||
@Service
|
||||
public class RmResourceRegistrationServiceImpl implements IRmResourceRegistrationService
|
||||
{
|
||||
@Autowired
|
||||
private RmResourceRegistrationMapper rmResourceRegistrationMapper;
|
||||
@Autowired
|
||||
private SysDictDataMapper sysDictDataMapper;
|
||||
|
||||
/**
|
||||
* 查询资源注册
|
||||
*
|
||||
* @param id 资源注册主键
|
||||
* @return 资源注册
|
||||
*/
|
||||
@Override
|
||||
public RmResourceRegistration selectRmResourceRegistrationById(Long id)
|
||||
{
|
||||
return rmResourceRegistrationMapper.selectRmResourceRegistrationById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询资源注册列表
|
||||
*
|
||||
* @param rmResourceRegistration 资源注册
|
||||
* @return 资源注册
|
||||
*/
|
||||
@Override
|
||||
public List<RmResourceRegistration> selectRmResourceRegistrationList(RmResourceRegistration rmResourceRegistration)
|
||||
{
|
||||
List<RmResourceRegistration> rmResourceRegistrationList = rmResourceRegistrationMapper.selectRmResourceRegistrationList(rmResourceRegistration);
|
||||
return rmResourceRegistrationList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增资源注册
|
||||
*
|
||||
* @param rmResourceRegistration 资源注册
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertRmResourceRegistration(RmResourceRegistration rmResourceRegistration)
|
||||
{
|
||||
rmResourceRegistration.setCreatorId(SecurityUtils.getUserId());
|
||||
rmResourceRegistration.setCreatorName(SecurityUtils.getUsername());
|
||||
rmResourceRegistration.setCreateTime(DateUtils.getNowDate());
|
||||
return rmResourceRegistrationMapper.insertRmResourceRegistration(rmResourceRegistration);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改资源注册
|
||||
*
|
||||
* @param rmResourceRegistration 资源注册
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateRmResourceRegistration(RmResourceRegistration rmResourceRegistration)
|
||||
{
|
||||
rmResourceRegistration.setUpdateTime(DateUtils.getNowDate());
|
||||
rmResourceRegistration.setUpdaterId(SecurityUtils.getUserId());
|
||||
rmResourceRegistration.setUpdaterName(SecurityUtils.getUsername());
|
||||
return rmResourceRegistrationMapper.updateRmResourceRegistration(rmResourceRegistration);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除资源注册
|
||||
*
|
||||
* @param ids 需要删除的资源注册主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRmResourceRegistrationByIds(Long[] ids)
|
||||
{
|
||||
return rmResourceRegistrationMapper.deleteRmResourceRegistrationByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除资源注册信息
|
||||
*
|
||||
* @param id 资源注册主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRmResourceRegistrationById(Long id)
|
||||
{
|
||||
return rmResourceRegistrationMapper.deleteRmResourceRegistrationById(id);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user