BaseEntity添加ForeignKeyInfo参数供请求手动解析外键
This commit is contained in:
parent
46c36f2aaf
commit
acdf998880
|
|
@ -1,23 +1,20 @@
|
|||
package com.ruoyi.web.controller.template;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.template.domain.TmplSwitch;
|
||||
import com.ruoyi.template.service.ITmplSwitchService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.template.domain.TmplSwitch;
|
||||
import com.ruoyi.template.service.ITmplSwitchService;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 交换机模板 信息操作处理
|
||||
|
|
@ -27,101 +24,92 @@ import com.ruoyi.common.utils.poi.ExcelUtil;
|
|||
*/
|
||||
@Controller
|
||||
@RequestMapping("/template/tmplSwitch")
|
||||
public class TmplSwitchController extends BaseController
|
||||
{
|
||||
public class TmplSwitchController extends BaseController {
|
||||
private String prefix = "template/tmplSwitch";
|
||||
|
||||
@Autowired
|
||||
private ITmplSwitchService tmplSwitchService;
|
||||
@Autowired
|
||||
private ITmplSwitchService tmplSwitchService;
|
||||
|
||||
@RequiresPermissions("template:tmplSwitch:view")
|
||||
@GetMapping()
|
||||
public String tmplSwitch()
|
||||
{
|
||||
return prefix + "/tmplSwitch";
|
||||
}
|
||||
@RequiresPermissions("template:tmplSwitch:view")
|
||||
@GetMapping()
|
||||
public String tmplSwitch() {
|
||||
return prefix + "/tmplSwitch";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询交换机模板列表
|
||||
*/
|
||||
@RequiresPermissions("template:tmplSwitch:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(TmplSwitch tmplSwitch)
|
||||
{
|
||||
startPage();
|
||||
/**
|
||||
* 查询交换机模板列表
|
||||
*/
|
||||
@RequiresPermissions("template:tmplSwitch:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(TmplSwitch tmplSwitch) {
|
||||
startPage();
|
||||
List<TmplSwitch> list = tmplSwitchService.selectTmplSwitchList(tmplSwitch);
|
||||
return getDataTable(list);
|
||||
}
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出交换机模板列表
|
||||
*/
|
||||
@RequiresPermissions("template:tmplSwitch:export")
|
||||
/**
|
||||
* 导出交换机模板列表
|
||||
*/
|
||||
@RequiresPermissions("template:tmplSwitch:export")
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(TmplSwitch tmplSwitch)
|
||||
{
|
||||
List<TmplSwitch> list = tmplSwitchService.selectTmplSwitchList(tmplSwitch);
|
||||
public AjaxResult export(TmplSwitch tmplSwitch) {
|
||||
List<TmplSwitch> list = tmplSwitchService.selectTmplSwitchList(tmplSwitch);
|
||||
ExcelUtil<TmplSwitch> util = new ExcelUtil<TmplSwitch>(TmplSwitch.class);
|
||||
return util.exportExcel(list, "tmplSwitch");
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增交换机模板
|
||||
*/
|
||||
@GetMapping("/add")
|
||||
public String add()
|
||||
{
|
||||
return prefix + "/add";
|
||||
}
|
||||
/**
|
||||
* 新增交换机模板
|
||||
*/
|
||||
@GetMapping("/add")
|
||||
public String add() {
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存交换机模板
|
||||
*/
|
||||
@RequiresPermissions("template:tmplSwitch:add")
|
||||
@Log(title = "交换机模板", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(TmplSwitch tmplSwitch)
|
||||
{
|
||||
return toAjax(tmplSwitchService.insertTmplSwitch(tmplSwitch));
|
||||
}
|
||||
/**
|
||||
* 新增保存交换机模板
|
||||
*/
|
||||
@RequiresPermissions("template:tmplSwitch:add")
|
||||
@Log(title = "交换机模板", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(TmplSwitch tmplSwitch) {
|
||||
return toAjax(tmplSwitchService.insertTmplSwitch(tmplSwitch));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改交换机模板
|
||||
*/
|
||||
@GetMapping("/edit/{switchId}")
|
||||
public String edit(@PathVariable("switchId") Integer switchId, ModelMap mmap)
|
||||
{
|
||||
TmplSwitch tmplSwitch = tmplSwitchService.selectTmplSwitchById(switchId);
|
||||
mmap.put("tmplSwitch", tmplSwitch);
|
||||
return prefix + "/edit";
|
||||
}
|
||||
/**
|
||||
* 修改交换机模板
|
||||
*/
|
||||
@GetMapping("/edit/{switchId}")
|
||||
public String edit(@PathVariable("switchId") Integer switchId, ModelMap mmap) {
|
||||
TmplSwitch tmplSwitch = tmplSwitchService.selectTmplSwitchById(switchId);
|
||||
mmap.put("tmplSwitch", tmplSwitch);
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存交换机模板
|
||||
*/
|
||||
@RequiresPermissions("template:tmplSwitch:edit")
|
||||
@Log(title = "交换机模板", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(TmplSwitch tmplSwitch)
|
||||
{
|
||||
return toAjax(tmplSwitchService.updateTmplSwitch(tmplSwitch));
|
||||
}
|
||||
/**
|
||||
* 修改保存交换机模板
|
||||
*/
|
||||
@RequiresPermissions("template:tmplSwitch:edit")
|
||||
@Log(title = "交换机模板", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(TmplSwitch tmplSwitch) {
|
||||
return toAjax(tmplSwitchService.updateTmplSwitch(tmplSwitch));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除交换机模板
|
||||
*/
|
||||
@RequiresPermissions("template:tmplSwitch:remove")
|
||||
@Log(title = "交换机模板", businessType = BusinessType.DELETE)
|
||||
@PostMapping( "/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids)
|
||||
{
|
||||
return toAjax(tmplSwitchService.deleteTmplSwitchByIds(ids));
|
||||
}
|
||||
/**
|
||||
* 删除交换机模板
|
||||
*/
|
||||
@RequiresPermissions("template:tmplSwitch:remove")
|
||||
@Log(title = "交换机模板", businessType = BusinessType.DELETE)
|
||||
@PostMapping("/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids) {
|
||||
return toAjax(tmplSwitchService.deleteTmplSwitchByIds(ids));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,48 +1,72 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<th:block th:include="include :: header('新增交换机模板')" />
|
||||
<th:block th:include="include :: header('新增交换机模板')"/>
|
||||
</head>
|
||||
<body class="white-bg">
|
||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||
<form class="form-horizontal m" id="form-tmplSwitch-add">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">交换机品牌:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="switchBrand" name="switchBrand" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">交换机型号:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="switchType" name="switchType" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">交换机电源数量:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="powerNum" name="powerNum" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div th:include="include::footer"></div>
|
||||
<script type="text/javascript">
|
||||
var prefix = ctx + "template/tmplSwitch"
|
||||
$("#form-tmplSwitch-add").validate({
|
||||
rules:{
|
||||
xxxx:{
|
||||
required:true,
|
||||
},
|
||||
},
|
||||
focusCleanup: true
|
||||
});
|
||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||
<form class="form-horizontal m" id="form-tmplSwitch-add">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">交换机品牌:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="switchBrand" name="switchBrand" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">交换机型号:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="switchType" name="switchType" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">交换机电源数量:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="powerNum" name="powerNum" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
function submitHandler() {
|
||||
if ($.validate.form()) {
|
||||
$.operate.save(prefix + "/add", $('#form-tmplSwitch-add').serialize());
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<div class="form-group" th:with="type=${@dict.getType('dict_port_type')}">
|
||||
<div class="col-sm-6" th:each="dict : ${type}">
|
||||
<div class="col-md-12">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label" th:text="${dict.dictLabel}"></label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" value="" th:name="${dict.dictCode}" class="form-control switchPort"
|
||||
placeholder="单位(个)">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div th:include="include::footer"></div>
|
||||
<script type="text/javascript">
|
||||
var prefix = ctx + "template/tmplSwitch"
|
||||
$("#form-tmplSwitch-add").validate({
|
||||
rules: {
|
||||
xxxx: {
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
focusCleanup: true
|
||||
});
|
||||
|
||||
function submitHandler() {
|
||||
if ($.validate.form()) {
|
||||
var data = $('#form-tmplSwitch-add').serializeArray();
|
||||
var params = [];
|
||||
$(".switchPort").each(function () {
|
||||
params.push({"id": $(this).attr("name"), "value": $(this).val()});
|
||||
});
|
||||
var obj = {
|
||||
"name": "foreignKeyInfo",
|
||||
"value": JSON.stringify(params)
|
||||
};
|
||||
data.push(obj);
|
||||
$.operate.save(prefix + "/add", data);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -11,104 +11,100 @@ import com.fasterxml.jackson.annotation.JsonFormat;
|
|||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class BaseEntity implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
public class BaseEntity implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 搜索值 */
|
||||
private String searchValue;
|
||||
/** 搜索值 */
|
||||
private String searchValue;
|
||||
|
||||
/** 创建者 */
|
||||
private String createBy;
|
||||
/** 创建者 */
|
||||
private String createBy;
|
||||
|
||||
/** 创建时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
/** 创建时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
/** 更新者 */
|
||||
private String updateBy;
|
||||
/** 更新者 */
|
||||
private String updateBy;
|
||||
|
||||
/** 更新时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
/** 更新时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
|
||||
/** 请求参数 */
|
||||
private Map<String, Object> params;
|
||||
/** 请求参数 */
|
||||
private Map<String, Object> params;
|
||||
|
||||
public String getSearchValue()
|
||||
{
|
||||
return searchValue;
|
||||
}
|
||||
/** 外键关联额外信息 */
|
||||
private String foreignKeyInfo;
|
||||
|
||||
public void setSearchValue(String searchValue)
|
||||
{
|
||||
this.searchValue = searchValue;
|
||||
}
|
||||
public String getSearchValue() {
|
||||
return searchValue;
|
||||
}
|
||||
|
||||
public String getCreateBy()
|
||||
{
|
||||
return createBy;
|
||||
}
|
||||
public void setSearchValue(String searchValue) {
|
||||
this.searchValue = searchValue;
|
||||
}
|
||||
|
||||
public void setCreateBy(String createBy)
|
||||
{
|
||||
this.createBy = createBy;
|
||||
}
|
||||
public String getCreateBy() {
|
||||
return createBy;
|
||||
}
|
||||
|
||||
public Date getCreateTime()
|
||||
{
|
||||
return createTime;
|
||||
}
|
||||
public void setCreateBy(String createBy) {
|
||||
this.createBy = createBy;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime)
|
||||
{
|
||||
this.createTime = createTime;
|
||||
}
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public String getUpdateBy()
|
||||
{
|
||||
return updateBy;
|
||||
}
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public void setUpdateBy(String updateBy)
|
||||
{
|
||||
this.updateBy = updateBy;
|
||||
}
|
||||
public String getUpdateBy() {
|
||||
return updateBy;
|
||||
}
|
||||
|
||||
public Date getUpdateTime()
|
||||
{
|
||||
return updateTime;
|
||||
}
|
||||
public void setUpdateBy(String updateBy) {
|
||||
this.updateBy = updateBy;
|
||||
}
|
||||
|
||||
public void setUpdateTime(Date updateTime)
|
||||
{
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public String getRemark()
|
||||
{
|
||||
return remark;
|
||||
}
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public void setRemark(String remark)
|
||||
{
|
||||
this.remark = remark;
|
||||
}
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
public Map<String, Object> getParams()
|
||||
{
|
||||
if (params == null)
|
||||
{
|
||||
params = new HashMap<>();
|
||||
}
|
||||
return params;
|
||||
}
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
public Map<String, Object> getParams() {
|
||||
if (params == null) {
|
||||
params = new HashMap<>();
|
||||
}
|
||||
return params;
|
||||
}
|
||||
|
||||
public void setParams(Map<String, Object> params) {
|
||||
this.params = params;
|
||||
}
|
||||
|
||||
public String getForeignKeyInfo() {
|
||||
return foreignKeyInfo;
|
||||
}
|
||||
|
||||
public void setForeignKeyInfo(String foreignKeyInfo) {
|
||||
this.foreignKeyInfo = foreignKeyInfo;
|
||||
}
|
||||
|
||||
public void setParams(Map<String, Object> params)
|
||||
{
|
||||
this.params = params;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,72 +0,0 @@
|
|||
package com.ruoyi.template.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 交换机端口类型(不用代码生成工具)表 tmpl_switch_port
|
||||
*
|
||||
* @author TP
|
||||
* @date 2019-06-12
|
||||
*/
|
||||
public class SwitchPort extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 交换机端口编号 */
|
||||
private Integer switchPortId;
|
||||
/** 交换机模板编号 */
|
||||
private Integer switchId;
|
||||
/** 交换机端口类型 */
|
||||
private Integer switchPortType;
|
||||
/** 交换机端口数量 */
|
||||
private Integer switchPortNum;
|
||||
|
||||
public void setSwitchPortId(Integer switchPortId)
|
||||
{
|
||||
this.switchPortId = switchPortId;
|
||||
}
|
||||
|
||||
public Integer getSwitchPortId()
|
||||
{
|
||||
return switchPortId;
|
||||
}
|
||||
public void setSwitchId(Integer switchId)
|
||||
{
|
||||
this.switchId = switchId;
|
||||
}
|
||||
|
||||
public Integer getSwitchId()
|
||||
{
|
||||
return switchId;
|
||||
}
|
||||
public void setSwitchPortType(Integer switchPortType)
|
||||
{
|
||||
this.switchPortType = switchPortType;
|
||||
}
|
||||
|
||||
public Integer getSwitchPortType()
|
||||
{
|
||||
return switchPortType;
|
||||
}
|
||||
public void setSwitchPortNum(Integer switchPortNum)
|
||||
{
|
||||
this.switchPortNum = switchPortNum;
|
||||
}
|
||||
|
||||
public Integer getSwitchPortNum()
|
||||
{
|
||||
return switchPortNum;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("switchPortId", getSwitchPortId())
|
||||
.append("switchId", getSwitchId())
|
||||
.append("switchPortType", getSwitchPortType())
|
||||
.append("switchPortNum", getSwitchPortNum())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -10,110 +10,117 @@ import com.ruoyi.common.core.domain.BaseEntity;
|
|||
* @author TP
|
||||
* @date 2019-06-12
|
||||
*/
|
||||
public class TmplServer extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
public class TmplServer extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 服务器模板编号 */
|
||||
private Integer serverId;
|
||||
/** 服务器品牌 */
|
||||
private String serverBrand;
|
||||
/** 服务器型号 */
|
||||
private String serverType;
|
||||
/** CPU主频 */
|
||||
private String cpuFreq;
|
||||
/** CPU数量 */
|
||||
private Integer cpuNum;
|
||||
/** IPMI端口 */
|
||||
private Integer ipmiPort;
|
||||
/** 服务器电源数量 */
|
||||
private Integer powerNum;
|
||||
/** 服务器raid卡 */
|
||||
private String raidCard;
|
||||
/**
|
||||
* 服务器模板编号
|
||||
*/
|
||||
private Integer serverId;
|
||||
/**
|
||||
* 服务器品牌
|
||||
*/
|
||||
private String serverBrand;
|
||||
/**
|
||||
* 服务器型号
|
||||
*/
|
||||
private String serverType;
|
||||
/**
|
||||
* CPU主频
|
||||
*/
|
||||
private String cpuFreq;
|
||||
/**
|
||||
* CPU数量
|
||||
*/
|
||||
private Integer cpuNum;
|
||||
/**
|
||||
* IPMI端口
|
||||
*/
|
||||
private Integer ipmiPort;
|
||||
/**
|
||||
* 服务器电源数量
|
||||
*/
|
||||
private Integer powerNum;
|
||||
/**
|
||||
* 服务器raid卡
|
||||
*/
|
||||
private String raidCard;
|
||||
|
||||
public void setServerId(Integer serverId)
|
||||
{
|
||||
this.serverId = serverId;
|
||||
}
|
||||
public void setServerId(Integer serverId) {
|
||||
this.serverId = serverId;
|
||||
}
|
||||
|
||||
public Integer getServerId()
|
||||
{
|
||||
return serverId;
|
||||
}
|
||||
public void setServerBrand(String serverBrand)
|
||||
{
|
||||
this.serverBrand = serverBrand;
|
||||
}
|
||||
public Integer getServerId() {
|
||||
return serverId;
|
||||
}
|
||||
|
||||
public String getServerBrand()
|
||||
{
|
||||
return serverBrand;
|
||||
}
|
||||
public void setServerType(String serverType)
|
||||
{
|
||||
this.serverType = serverType;
|
||||
}
|
||||
public void setServerBrand(String serverBrand) {
|
||||
this.serverBrand = serverBrand;
|
||||
}
|
||||
|
||||
public String getServerType()
|
||||
{
|
||||
return serverType;
|
||||
}
|
||||
public void setCpuFreq(String cpuFreq)
|
||||
{
|
||||
this.cpuFreq = cpuFreq;
|
||||
}
|
||||
public String getServerBrand() {
|
||||
return serverBrand;
|
||||
}
|
||||
|
||||
public String getCpuFreq()
|
||||
{
|
||||
return cpuFreq;
|
||||
}
|
||||
public void setCpuNum(Integer cpuNum)
|
||||
{
|
||||
this.cpuNum = cpuNum;
|
||||
}
|
||||
public void setServerType(String serverType) {
|
||||
this.serverType = serverType;
|
||||
}
|
||||
|
||||
public Integer getCpuNum()
|
||||
{
|
||||
return cpuNum;
|
||||
}
|
||||
public void setIpmiPort(Integer ipmiPort)
|
||||
{
|
||||
this.ipmiPort = ipmiPort;
|
||||
}
|
||||
public String getServerType() {
|
||||
return serverType;
|
||||
}
|
||||
|
||||
public Integer getIpmiPort()
|
||||
{
|
||||
return ipmiPort;
|
||||
}
|
||||
public void setPowerNum(Integer powerNum)
|
||||
{
|
||||
this.powerNum = powerNum;
|
||||
}
|
||||
public void setCpuFreq(String cpuFreq) {
|
||||
this.cpuFreq = cpuFreq;
|
||||
}
|
||||
|
||||
public Integer getPowerNum()
|
||||
{
|
||||
return powerNum;
|
||||
}
|
||||
public void setRaidCard(String raidCard)
|
||||
{
|
||||
this.raidCard = raidCard;
|
||||
}
|
||||
public String getCpuFreq() {
|
||||
return cpuFreq;
|
||||
}
|
||||
|
||||
public String getRaidCard()
|
||||
{
|
||||
return raidCard;
|
||||
}
|
||||
public void setCpuNum(Integer cpuNum) {
|
||||
this.cpuNum = cpuNum;
|
||||
}
|
||||
|
||||
public Integer getCpuNum() {
|
||||
return cpuNum;
|
||||
}
|
||||
|
||||
public void setIpmiPort(Integer ipmiPort) {
|
||||
this.ipmiPort = ipmiPort;
|
||||
}
|
||||
|
||||
public Integer getIpmiPort() {
|
||||
return ipmiPort;
|
||||
}
|
||||
|
||||
public void setPowerNum(Integer powerNum) {
|
||||
this.powerNum = powerNum;
|
||||
}
|
||||
|
||||
public Integer getPowerNum() {
|
||||
return powerNum;
|
||||
}
|
||||
|
||||
public void setRaidCard(String raidCard) {
|
||||
this.raidCard = raidCard;
|
||||
}
|
||||
|
||||
public String getRaidCard() {
|
||||
return raidCard;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("serverId", getServerId())
|
||||
.append("serverBrand", getServerBrand())
|
||||
.append("serverType", getServerType())
|
||||
.append("cpuFreq", getCpuFreq())
|
||||
.append("cpuNum", getCpuNum())
|
||||
.append("ipmiPort", getIpmiPort())
|
||||
.append("powerNum", getPowerNum())
|
||||
.append("raidCard", getRaidCard())
|
||||
.toString();
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("serverId", getServerId())
|
||||
.append("serverBrand", getServerBrand())
|
||||
.append("serverType", getServerType())
|
||||
.append("cpuFreq", getCpuFreq())
|
||||
.append("cpuNum", getCpuNum())
|
||||
.append("ipmiPort", getIpmiPort())
|
||||
.append("powerNum", getPowerNum())
|
||||
.append("raidCard", getRaidCard())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
package com.ruoyi.template.domain;
|
||||
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 交换机模板表 tmpl_switch
|
||||
|
|
@ -10,62 +12,78 @@ import com.ruoyi.common.core.domain.BaseEntity;
|
|||
* @author TP
|
||||
* @date 2019-06-12
|
||||
*/
|
||||
public class TmplSwitch extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
public class TmplSwitch extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 交换机模板编号 */
|
||||
private Integer switchId;
|
||||
/** 交换机品牌 */
|
||||
private String switchBrand;
|
||||
/** 交换机型号 */
|
||||
private String switchType;
|
||||
/** 交换机电源数量 */
|
||||
private Integer powerNum;
|
||||
/**
|
||||
* 交换机模板编号
|
||||
*/
|
||||
private Integer switchId;
|
||||
/**
|
||||
* 交换机品牌
|
||||
*/
|
||||
private String switchBrand;
|
||||
/**
|
||||
* 交换机型号
|
||||
*/
|
||||
private String switchType;
|
||||
/**
|
||||
* 交换机电源数量
|
||||
*/
|
||||
private Integer powerNum;
|
||||
/**
|
||||
* 交换机端口类型
|
||||
*/
|
||||
private List<TmplSwitchPort> switchPorts;
|
||||
|
||||
public void setSwitchId(Integer switchId)
|
||||
{
|
||||
this.switchId = switchId;
|
||||
}
|
||||
public void setSwitchId(Integer switchId) {
|
||||
this.switchId = switchId;
|
||||
}
|
||||
|
||||
public Integer getSwitchId()
|
||||
{
|
||||
return switchId;
|
||||
}
|
||||
public void setSwitchBrand(String switchBrand)
|
||||
{
|
||||
this.switchBrand = switchBrand;
|
||||
}
|
||||
public Integer getSwitchId() {
|
||||
return switchId;
|
||||
}
|
||||
|
||||
public String getSwitchBrand()
|
||||
{
|
||||
return switchBrand;
|
||||
}
|
||||
public void setSwitchType(String switchType)
|
||||
{
|
||||
this.switchType = switchType;
|
||||
}
|
||||
public void setSwitchBrand(String switchBrand) {
|
||||
this.switchBrand = switchBrand;
|
||||
}
|
||||
|
||||
public String getSwitchType()
|
||||
{
|
||||
return switchType;
|
||||
}
|
||||
public void setPowerNum(Integer powerNum)
|
||||
{
|
||||
this.powerNum = powerNum;
|
||||
}
|
||||
public String getSwitchBrand() {
|
||||
return switchBrand;
|
||||
}
|
||||
|
||||
public Integer getPowerNum()
|
||||
{
|
||||
return powerNum;
|
||||
}
|
||||
public void setSwitchType(String switchType) {
|
||||
this.switchType = switchType;
|
||||
}
|
||||
|
||||
public String getSwitchType() {
|
||||
return switchType;
|
||||
}
|
||||
|
||||
public void setPowerNum(Integer powerNum) {
|
||||
this.powerNum = powerNum;
|
||||
}
|
||||
|
||||
public Integer getPowerNum() {
|
||||
return powerNum;
|
||||
}
|
||||
|
||||
public List<TmplSwitchPort> getSwitchPorts() {
|
||||
return switchPorts;
|
||||
}
|
||||
|
||||
public void setSwitchPorts(List<TmplSwitchPort> switchPorts) {
|
||||
this.switchPorts = switchPorts;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("switchId", getSwitchId())
|
||||
.append("switchBrand", getSwitchBrand())
|
||||
.append("switchType", getSwitchType())
|
||||
.append("powerNum", getPowerNum())
|
||||
.toString();
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("switchId", getSwitchId())
|
||||
.append("switchBrand", getSwitchBrand())
|
||||
.append("switchType", getSwitchType())
|
||||
.append("powerNum", getPowerNum())
|
||||
.append("switchPorts", getSwitchPorts())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,74 @@
|
|||
package com.ruoyi.template.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 交换机端口类型(不用代码生成工具)表 tmpl_switch_port
|
||||
*
|
||||
* @author TP
|
||||
* @date 2019-06-12
|
||||
*/
|
||||
public class TmplSwitchPort extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 交换机端口编号
|
||||
*/
|
||||
private Integer switchPortId;
|
||||
/**
|
||||
* 交换机模板编号
|
||||
*/
|
||||
private Integer switchId;
|
||||
/**
|
||||
* 交换机端口类型
|
||||
*/
|
||||
private Integer switchPortType;
|
||||
/**
|
||||
* 交换机端口数量
|
||||
*/
|
||||
private Integer switchPortNum;
|
||||
|
||||
public void setSwitchPortId(Integer switchPortId) {
|
||||
this.switchPortId = switchPortId;
|
||||
}
|
||||
|
||||
public Integer getSwitchPortId() {
|
||||
return switchPortId;
|
||||
}
|
||||
|
||||
public void setSwitchId(Integer switchId) {
|
||||
this.switchId = switchId;
|
||||
}
|
||||
|
||||
public Integer getSwitchId() {
|
||||
return switchId;
|
||||
}
|
||||
|
||||
public void setSwitchPortType(Integer switchPortType) {
|
||||
this.switchPortType = switchPortType;
|
||||
}
|
||||
|
||||
public Integer getSwitchPortType() {
|
||||
return switchPortType;
|
||||
}
|
||||
|
||||
public void setSwitchPortNum(Integer switchPortNum) {
|
||||
this.switchPortNum = switchPortNum;
|
||||
}
|
||||
|
||||
public Integer getSwitchPortNum() {
|
||||
return switchPortNum;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("switchPortId", getSwitchPortId())
|
||||
.append("switchId", getSwitchId())
|
||||
.append("switchPortType", getSwitchPortType())
|
||||
.append("switchPortNum", getSwitchPortNum())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,47 +1,69 @@
|
|||
<?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.template.mapper.TmplSwitchMapper">
|
||||
|
||||
<resultMap type="TmplSwitch" id="TmplSwitchResult">
|
||||
<result property="switchId" column="switch_id" />
|
||||
<result property="switchBrand" column="switch_brand" />
|
||||
<result property="switchType" column="switch_type" />
|
||||
<result property="powerNum" column="power_num" />
|
||||
<result property="switchId" column="switch_id"/>
|
||||
<result property="switchBrand" column="switch_brand"/>
|
||||
<result property="switchType" column="switch_type"/>
|
||||
<result property="powerNum" column="power_num"/>
|
||||
|
||||
<collection property="switchPorts" ofType="TmplSwitchPort" column="switch_id">
|
||||
<id column="pid" property="switchPortId"/><!-- 这里的column对应的是下面查询的别名,而不是表字段名 -->
|
||||
<result column="ptype" property="switchPortType"/><!-- property对应JavaBean中的属性名 -->
|
||||
<result column="pnum" property="switchPortNum"/>
|
||||
</collection>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectTmplSwitchVo">
|
||||
select switch_id, switch_brand, switch_type, power_num from tmpl_switch
|
||||
<!-- <sql id="selectTmplSwitchVo">-->
|
||||
<!-- select switch_id, switch_brand, switch_type, power_num from tmpl_switch-->
|
||||
<!-- </sql>-->
|
||||
<sql id="selectTmplSwitchVo">
|
||||
select
|
||||
s.switch_id,
|
||||
s.switch_brand,
|
||||
s.switch_type,
|
||||
s.power_num,
|
||||
p.switch_port_id as pid,
|
||||
p.switch_port_type as ptype,
|
||||
p.switch_port_num as pnum
|
||||
from
|
||||
tmpl_switch s
|
||||
left join
|
||||
tmpl_switch_port p
|
||||
on
|
||||
s.switch_id = p.switch_id
|
||||
</sql>
|
||||
|
||||
<select id="selectTmplSwitchList" parameterType="TmplSwitch" resultMap="TmplSwitchResult">
|
||||
<include refid="selectTmplSwitchVo"/>
|
||||
<where>
|
||||
<if test="switchId != null "> and switch_id = #{switchId}</if>
|
||||
<if test="switchBrand != null and switchBrand != '' "> and switch_brand = #{switchBrand}</if>
|
||||
<if test="switchType != null and switchType != '' "> and switch_type = #{switchType}</if>
|
||||
<if test="powerNum != null "> and power_num = #{powerNum}</if>
|
||||
</where>
|
||||
<if test="switchId != null ">and switch_id = #{switchId}</if>
|
||||
<if test="switchBrand != null and switchBrand != '' ">and switch_brand = #{switchBrand}</if>
|
||||
<if test="switchType != null and switchType != '' ">and switch_type = #{switchType}</if>
|
||||
<if test="powerNum != null ">and power_num = #{powerNum}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectTmplSwitchById" parameterType="Integer" resultMap="TmplSwitchResult">
|
||||
<include refid="selectTmplSwitchVo"/>
|
||||
where switch_id = #{switchId}
|
||||
where s.switch_id = #{switchId}
|
||||
</select>
|
||||
|
||||
<insert id="insertTmplSwitch" parameterType="TmplSwitch" useGeneratedKeys="true" keyProperty="switchId">
|
||||
insert into tmpl_switch
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="switchBrand != null and switchBrand != '' ">switch_brand,</if>
|
||||
<if test="switchType != null and switchType != '' ">switch_type,</if>
|
||||
<if test="powerNum != null ">power_num,</if>
|
||||
</trim>
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="switchBrand != null and switchBrand != '' ">switch_brand,</if>
|
||||
<if test="switchType != null and switchType != '' ">switch_type,</if>
|
||||
<if test="powerNum != null ">power_num,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="switchBrand != null and switchBrand != '' ">#{switchBrand},</if>
|
||||
<if test="switchType != null and switchType != '' ">#{switchType},</if>
|
||||
<if test="powerNum != null ">#{powerNum},</if>
|
||||
</trim>
|
||||
<if test="switchBrand != null and switchBrand != '' ">#{switchBrand},</if>
|
||||
<if test="switchType != null and switchType != '' ">#{switchType},</if>
|
||||
<if test="powerNum != null ">#{powerNum},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateTmplSwitch" parameterType="TmplSwitch">
|
||||
|
|
@ -54,7 +76,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where switch_id = #{switchId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteTmplSwitchById" parameterType="Integer">
|
||||
<delete id="deleteTmplSwitchById" parameterType="Integer">
|
||||
delete from tmpl_switch where switch_id = #{switchId}
|
||||
</delete>
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,70 @@
|
|||
<?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.ruoyi.template.mapper.TmplSwitchPortMapper">
|
||||
|
||||
<resultMap type="TmplSwitchPort" id="TmplSwitchPortResult">
|
||||
<result property="switchPortId" column="switch_port_id"/>
|
||||
<result property="switchId" column="switch_id"/>
|
||||
<result property="switchPortType" column="switch_port_type"/>
|
||||
<result property="switchPortNum" column="switch_port_num"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectTmplSwitchPortVo">
|
||||
select switch_port_id, switch_id, switch_port_type, switch_port_num from tmpl_switch_port
|
||||
</sql>
|
||||
|
||||
<select id="selectTmplSwitchPortList" parameterType="TmplSwitchPort" resultMap="TmplSwitchPortResult">
|
||||
<include refid="selectTmplSwitchPortVo"/>
|
||||
<where>
|
||||
<if test="switchPortId != null ">and switch_port_id = #{switchPortId}</if>
|
||||
<if test="switchId != null ">and switch_id = #{switchId}</if>
|
||||
<if test="switchPortType != null ">and switch_port_type = #{switchPortType}</if>
|
||||
<if test="switchPortNum != null ">and switch_port_num = #{switchPortNum}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectTmplSwitchPortById" parameterType="Integer" resultMap="TmplSwitchPortResult">
|
||||
<include refid="selectTmplSwitchPortVo"/>
|
||||
where switch_port_id = #{switchPortId}
|
||||
</select>
|
||||
|
||||
<insert id="insertTmplSwitchPort" parameterType="TmplSwitchPort">
|
||||
insert into tmpl_switch_port
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="switchPortId != null ">switch_port_id,</if>
|
||||
<if test="switchId != null ">switch_id,</if>
|
||||
<if test="switchPortType != null ">switch_port_type,</if>
|
||||
<if test="switchPortNum != null ">switch_port_num,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="switchPortId != null ">#{switchPortId},</if>
|
||||
<if test="switchId != null ">#{switchId},</if>
|
||||
<if test="switchPortType != null ">#{switchPortType},</if>
|
||||
<if test="switchPortNum != null ">#{switchPortNum},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateTmplSwitchPort" parameterType="TmplSwitchPort">
|
||||
update tmpl_switch_port
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="switchId != null ">switch_id = #{switchId},</if>
|
||||
<if test="switchPortType != null ">switch_port_type = #{switchPortType},</if>
|
||||
<if test="switchPortNum != null ">switch_port_num = #{switchPortNum},</if>
|
||||
</trim>
|
||||
where switch_port_id = #{switchPortId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteTmplSwitchPortById" parameterType="Integer">
|
||||
delete from tmpl_switch_port where switch_port_id = #{switchPortId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteTmplSwitchPortByIds" parameterType="String">
|
||||
delete from tmpl_switch_port where switch_port_id in
|
||||
<foreach item="switchPortId" collection="array" open="(" separator="," close=")">
|
||||
#{switchPortId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue