网络IP代码生成

This commit is contained in:
tangpeng 2019-06-15 01:33:38 +08:00
parent d76e7fdc95
commit 190f626ba6
19 changed files with 861 additions and 81 deletions

View File

@ -0,0 +1,124 @@
package com.ruoyi.web.controller.network;
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.network.domain.NetIpAddress;
import com.ruoyi.network.service.INetIpAddressService;
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.*;
import java.util.List;
/**
* 网络IP 信息操作处理
*
* @author TP
* @date 2019-06-15
*/
@Controller
@RequestMapping("/network/netIpAddress")
public class NetIpAddressController extends BaseController
{
private String prefix = "network/netIpAddress";
@Autowired
private INetIpAddressService netIpAddressService;
@RequiresPermissions("network:netIpAddress:view")
@GetMapping()
public String netIpAddress()
{
return prefix + "/netIpAddress";
}
/**
* 查询网络IP列表
*/
@RequiresPermissions("network:netIpAddress:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(NetIpAddress netIpAddress)
{
startPage();
List<NetIpAddress> list = netIpAddressService.selectNetIpAddressList(netIpAddress);
return getDataTable(list);
}
/**
* 导出网络IP列表
*/
@RequiresPermissions("network:netIpAddress:export")
@PostMapping("/export")
@ResponseBody
public AjaxResult export(NetIpAddress netIpAddress)
{
List<NetIpAddress> list = netIpAddressService.selectNetIpAddressList(netIpAddress);
ExcelUtil<NetIpAddress> util = new ExcelUtil<NetIpAddress>(NetIpAddress.class);
return util.exportExcel(list, "netIpAddress");
}
/**
* 新增网络IP
*/
@GetMapping("/add")
public String add()
{
return prefix + "/add";
}
/**
* 新增保存网络IP
*/
@RequiresPermissions("network:netIpAddress:add")
@Log(title = "网络IP", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(NetIpAddress netIpAddress)
{
return toAjax(netIpAddressService.insertNetIpAddress(netIpAddress));
}
/**
* 修改网络IP
*/
@GetMapping("/edit/{ipAddressId}")
public String edit(@PathVariable("ipAddressId") Integer ipAddressId, ModelMap mmap)
{
NetIpAddress netIpAddress = netIpAddressService.selectNetIpAddressById(ipAddressId);
mmap.put("netIpAddress", netIpAddress);
return prefix + "/edit";
}
/**
* 修改保存网络IP
*/
@RequiresPermissions("network:netIpAddress:edit")
@Log(title = "网络IP", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(NetIpAddress netIpAddress)
{
return toAjax(netIpAddressService.updateNetIpAddress(netIpAddress));
}
/**
* 删除网络IP
*/
@RequiresPermissions("network:netIpAddress:remove")
@Log(title = "网络IP", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
return toAjax(netIpAddressService.deleteNetIpAddressByIds(ids));
}
}

View File

@ -0,0 +1,73 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
<th:block th:include="include :: header('新增网络IP')"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-netIpAddress-add">
<div class="form-group">
<label class="col-sm-3 control-label">IP地址类型</label>
<div class="col-sm-8">
<input id="ipAddressType" name="ipAddressType" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">IP地址段</label>
<div class="col-sm-8">
<input id="ipAddressSection" name="ipAddressSection" 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="machingRoomId" name="machingRoomId" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">IP使用规则</label>
<div class="col-sm-8">
<input id="ipUseRule" name="ipUseRule" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">IP地址分配规则</label>
<div class="col-sm-8">
<input id="ipAllocRule" name="ipAllocRule" class="form-control" type="text">
</div>
</div>
</form>
</div>
<div th:include="include::footer"></div>
<script type="text/javascript">
var prefix = ctx + "network/netIpAddress"
$("#form-netIpAddress-add").validate({
onkeyup: false,
rules: {
ipAddressType: {
required: true,
minlength: 1,
maxlength: 20
},
ipAddressSection: {
required: true,
minlength: 1,
maxlength: 20
},
machingRoomId: {
required: true,
minlength: 1,
maxlength: 2
},
},
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-netIpAddress-add').serialize());
}
}
</script>
</body>
</html>

View File

@ -0,0 +1,61 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('修改网络IP')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-netIpAddress-edit" th:object="${netIpAddress}">
<input id="ipAddressId" name="ipAddressId" th:field="*{ipAddressId}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label">IP地址类型</label>
<div class="col-sm-8">
<input id="ipAddressType" name="ipAddressType" th:field="*{ipAddressType}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">IP地址段</label>
<div class="col-sm-8">
<input id="ipAddressSection" name="ipAddressSection" th:field="*{ipAddressSection}" 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="machingRoomId" name="machingRoomId" th:field="*{machingRoomId}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">IP使用规则</label>
<div class="col-sm-8">
<input id="ipUseRule" name="ipUseRule" th:field="*{ipUseRule}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">IP地址分配规则</label>
<div class="col-sm-8">
<input id="ipAllocRule" name="ipAllocRule" th:field="*{ipAllocRule}" class="form-control" type="text">
</div>
</div>
</form>
</div>
<div th:include="include::footer"></div>
<script type="text/javascript" th:inline="javascript">
var prefix = ctx + "network/netIpAddress";
$("#form-netIpAddress-edit").validate({
rules:{
xxxx:{
required:true,
},
},
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-netIpAddress-edit').serialize());
}
}
</script>
</body>
</html>

View File

@ -0,0 +1,124 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('网络IP列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="formId">
<div class="select-list">
<ul>
<li>
IP地址类型<input type="text" name="ipAddressType"/>
</li>
<li>
IP地址段<input type="text" name="ipAddressSection"/>
</li>
<li>
所属机房编号:<input type="text" name="machingRoomId"/>
</li>
<li>
IP使用规则<input type="text" name="ipUseRule"/>
</li>
<li>
IP地址分配规则<input type="text" name="ipAllocRule"/>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="network:netIpAddress:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary btn-edit disabled" onclick="$.operate.edit()" shiro:hasPermission="network:netIpAddress:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger btn-del btn-del disabled" onclick="$.operate.removeAll()" shiro:hasPermission="network:netIpAddress:remove">
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="network:netIpAddress:export">
<i class="fa fa-download"></i> 导出
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table" data-mobile-responsive="true"></table>
</div>
</div>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('network:netIpAddress:edit')}]];
var removeFlag = [[${@permission.hasPermi('network:netIpAddress:remove')}]];
var prefix = ctx + "network/netIpAddress";
$(function() {
var options = {
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
modalName: "网络IP",
showExport: true,
columns: [{
checkbox: true
},
{
field : 'ipAddressId',
title : 'IP地址编号',
visible: false
},
{
field : 'ipAddressType',
title : 'IP地址类型',
sortable: true
},
{
field : 'ipAddressSection',
title : 'IP地址段',
sortable: true
},
{
field : 'machingRoomId',
title : '所属机房',
sortable: true
},
{
field : 'ipUseRule',
title : 'IP使用规则',
sortable: true
},
{
field : 'ipAllocRule',
title : 'IP地址分配规则',
sortable: true
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.ipAddressId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.ipAddressId + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
}]
};
$.table.init(options);
});
</script>
</body>
</html>

View File

@ -86,7 +86,7 @@
<script type="text/javascript">
var prefix = ctx + "template/tmplServer";
$("#form-tmplServer-add").validate({
onkeyup: true,
onkeyup: false,
rules: {
serverBrand: {
required: true,

View File

@ -71,7 +71,7 @@
<script type="text/javascript" th:inline="javascript">
var prefix = ctx + "template/tmplServer";
$("#form-tmplServer-add").validate({
onkeyup: true,
onkeyup: false,
rules: {
serverBrand: {
required: true,

View File

@ -46,7 +46,7 @@
<script type="text/javascript">
var prefix = ctx + "template/tmplSwitch"
$("#form-tmplSwitch-add").validate({
onkeyup: true,
onkeyup: false,
rules: {
switchBrand: {
required: true,

View File

@ -47,7 +47,7 @@
<script type="text/javascript" th:inline="javascript">
var prefix = ctx + "template/tmplSwitch";
$("#form-tmplSwitch-edit").validate({
onkeyup: true,
onkeyup: false,
rules: {
switchBrand: {
required: true,

View File

@ -4,7 +4,7 @@ gen:
# 作者
author: TP
# 默认生成包路径 system 需改成自己的模块名称 如 system monitor tool
packageName: com.ruoyi.template
packageName: com.ruoyi.network
# 自动去除表前缀默认是true
autoRemovePre: fasle
# 表前缀(类名不会包含表前缀)

View File

@ -0,0 +1,96 @@
package com.ruoyi.network.domain;
import com.ruoyi.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 网络IP表 net_ip_address
*
* @author TP
* @date 2019-06-15
*/
public class NetIpAddress extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* IP地址编号
*/
private Integer ipAddressId;
/**
* IP地址类型
*/
private String ipAddressType;
/**
* IP地址段
*/
private String ipAddressSection;
/**
* 所属机房编号
*/
private String machingRoomId;
/**
* IP使用规则
*/
private String ipUseRule;
/**
* IP地址分配规则
*/
private String ipAllocRule;
public Integer getIpAddressId() {
return ipAddressId;
}
public void setIpAddressId(Integer ipAddressId) {
this.ipAddressId = ipAddressId;
}
public String getIpAddressType() {
return ipAddressType;
}
public void setIpAddressType(String ipAddressType) {
this.ipAddressType = ipAddressType;
}
public String getIpAddressSection() {
return ipAddressSection;
}
public void setIpAddressSection(String ipAddressSection) {
this.ipAddressSection = ipAddressSection;
}
public String getMachingRoomId() {
return machingRoomId;
}
public void setMachingRoomId(String machingRoomId) {
this.machingRoomId = machingRoomId;
}
public String getIpUseRule() {
return ipUseRule;
}
public void setIpUseRule(String ipUseRule) {
this.ipUseRule = ipUseRule;
}
public String getIpAllocRule() {
return ipAllocRule;
}
public void setIpAllocRule(String ipAllocRule) {
this.ipAllocRule = ipAllocRule;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("ipAddressId", getIpAddressId())
.append("ipAddressType", getIpAddressType()).append("ipAddressSection", getIpAddressSection())
.append("machingRoomId", getMachingRoomId()).append("ipUseRule", getIpUseRule())
.append("ipAllocRule", getIpAllocRule()).toString();
}
}

View File

@ -0,0 +1,62 @@
package com.ruoyi.network.mapper;
import com.ruoyi.network.domain.NetIpAddress;
import java.util.List;
/**
* 网络IP 数据层
*
* @author TP
* @date 2019-06-15
*/
public interface NetIpAddressMapper
{
/**
* 查询网络IP信息
*
* @param ipAddressId 网络IPID
* @return 网络IP信息
*/
public NetIpAddress selectNetIpAddressById(Integer ipAddressId);
/**
* 查询网络IP列表
*
* @param netIpAddress 网络IP信息
* @return 网络IP集合
*/
public List<NetIpAddress> selectNetIpAddressList(NetIpAddress netIpAddress);
/**
* 新增网络IP
*
* @param netIpAddress 网络IP信息
* @return 结果
*/
public int insertNetIpAddress(NetIpAddress netIpAddress);
/**
* 修改网络IP
*
* @param netIpAddress 网络IP信息
* @return 结果
*/
public int updateNetIpAddress(NetIpAddress netIpAddress);
/**
* 删除网络IP
*
* @param ipAddressId 网络IPID
* @return 结果
*/
public int deleteNetIpAddressById(Integer ipAddressId);
/**
* 批量删除网络IP
*
* @param ipAddressIds 需要删除的数据ID
* @return 结果
*/
public int deleteNetIpAddressByIds(String[] ipAddressIds);
}

View File

@ -0,0 +1,54 @@
package com.ruoyi.network.service;
import com.ruoyi.network.domain.NetIpAddress;
import java.util.List;
/**
* 网络IP 服务层
*
* @author TP
* @date 2019-06-15
*/
public interface INetIpAddressService
{
/**
* 查询网络IP信息
*
* @param ipAddressId 网络IPID
* @return 网络IP信息
*/
public NetIpAddress selectNetIpAddressById(Integer ipAddressId);
/**
* 查询网络IP列表
*
* @param netIpAddress 网络IP信息
* @return 网络IP集合
*/
public List<NetIpAddress> selectNetIpAddressList(NetIpAddress netIpAddress);
/**
* 新增网络IP
*
* @param netIpAddress 网络IP信息
* @return 结果
*/
public int insertNetIpAddress(NetIpAddress netIpAddress);
/**
* 修改网络IP
*
* @param netIpAddress 网络IP信息
* @return 结果
*/
public int updateNetIpAddress(NetIpAddress netIpAddress);
/**
* 删除网络IP信息
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteNetIpAddressByIds(String ids);
}

View File

@ -0,0 +1,84 @@
package com.ruoyi.network.service.impl;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.network.domain.NetIpAddress;
import com.ruoyi.network.mapper.NetIpAddressMapper;
import com.ruoyi.network.service.INetIpAddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 网络IP 服务层实现
*
* @author TP
* @date 2019-06-15
*/
@Service
public class NetIpAddressServiceImpl implements INetIpAddressService
{
@Autowired
private NetIpAddressMapper netIpAddressMapper;
/**
* 查询网络IP信息
*
* @param ipAddressId 网络IPID
* @return 网络IP信息
*/
@Override
public NetIpAddress selectNetIpAddressById(Integer ipAddressId)
{
return netIpAddressMapper.selectNetIpAddressById(ipAddressId);
}
/**
* 查询网络IP列表
*
* @param netIpAddress 网络IP信息
* @return 网络IP集合
*/
@Override
public List<NetIpAddress> selectNetIpAddressList(NetIpAddress netIpAddress)
{
return netIpAddressMapper.selectNetIpAddressList(netIpAddress);
}
/**
* 新增网络IP
*
* @param netIpAddress 网络IP信息
* @return 结果
*/
@Override
public int insertNetIpAddress(NetIpAddress netIpAddress)
{
return netIpAddressMapper.insertNetIpAddress(netIpAddress);
}
/**
* 修改网络IP
*
* @param netIpAddress 网络IP信息
* @return 结果
*/
@Override
public int updateNetIpAddress(NetIpAddress netIpAddress)
{
return netIpAddressMapper.updateNetIpAddress(netIpAddress);
}
/**
* 删除网络IP对象
*
* @param ids 需要删除的数据ID
* @return 结果
*/
@Override
public int deleteNetIpAddressByIds(String ids)
{
return netIpAddressMapper.deleteNetIpAddressByIds(Convert.toStrArray(ids));
}
}

View File

@ -1,62 +1,69 @@
package com.ruoyi.template.mapper;
import com.ruoyi.template.domain.TmplServerDisk;
import java.util.List;
import java.util.List;
/**
* 服务器硬盘类型 数据层
*
*
* @author TP
* @date 2019-06-14
*/
public interface TmplServerDiskMapper
{
/**
public interface TmplServerDiskMapper {
/**
* 查询服务器硬盘类型信息
*
*
* @param serverDiskId 服务器硬盘类型ID
* @return 服务器硬盘类型信息
*/
public TmplServerDisk selectTmplServerDiskById(Integer serverDiskId);
/**
public TmplServerDisk selectTmplServerDiskById(Integer serverDiskId);
/**
* 查询服务器硬盘类型列表
*
*
* @param tmplServerDisk 服务器硬盘类型信息
* @return 服务器硬盘类型集合
*/
public List<TmplServerDisk> selectTmplServerDiskList(TmplServerDisk tmplServerDisk);
/**
public List<TmplServerDisk> selectTmplServerDiskList(TmplServerDisk tmplServerDisk);
/**
* 新增服务器硬盘类型
*
*
* @param tmplServerDisk 服务器硬盘类型信息
* @return 结果
*/
public int insertTmplServerDisk(TmplServerDisk tmplServerDisk);
/**
public int insertTmplServerDisk(TmplServerDisk tmplServerDisk);
/**
* 修改服务器硬盘类型
*
*
* @param tmplServerDisk 服务器硬盘类型信息
* @return 结果
*/
public int updateTmplServerDisk(TmplServerDisk tmplServerDisk);
/**
public int updateTmplServerDisk(TmplServerDisk tmplServerDisk);
/**
* 删除服务器硬盘类型
*
*
* @param serverDiskId 服务器硬盘类型ID
* @return 结果
*/
public int deleteTmplServerDiskById(Integer serverDiskId);
/**
public int deleteTmplServerDiskById(Integer serverDiskId);
/**
* 批量删除服务器硬盘类型
*
*
* @param serverDiskIds 需要删除的数据ID
* @return 结果
*/
public int deleteTmplServerDiskByIds(String[] serverDiskIds);
public int deleteTmplServerDiskByIds(String[] serverDiskIds);
/**
* 批量新增服务器硬盘类型信息
*
* @param tmplServerDiskList 服务器硬盘类型列表
* @return 结果
*/
public int batchTmplServerDisk(List<TmplServerDisk> tmplServerDiskList);
}

View File

@ -7,6 +7,7 @@ import com.ruoyi.common.exception.BusinessException;
import com.ruoyi.system.domain.SysDictData;
import com.ruoyi.system.mapper.SysDictDataMapper;
import com.ruoyi.template.domain.TmplServer;
import com.ruoyi.template.domain.TmplServerDisk;
import com.ruoyi.template.domain.TmplServerNetcard;
import com.ruoyi.template.mapper.TmplServerDiskMapper;
import com.ruoyi.template.mapper.TmplServerMapper;
@ -78,9 +79,14 @@ public class TmplServerServiceImpl implements ITmplServerService {
if (affectRow > 0) {
JSONObject jsonObject = JSONObject.parseObject(tmplServer.getForeignKeyInfo());
if (jsonObject != null) {
//保存网卡信息
if (jsonObject.containsKey("serverNetcards")) {
saveServerNetcard(tmplServer.getServerId(), jsonObject.getJSONArray("serverNetcards"));
}
//保存硬盘信息
if (jsonObject.containsKey("serverDisks")) {
saveServerDisk(tmplServer.getServerId(), jsonObject.getJSONArray("serverDisks"));
}
}
}
return affectRow;
@ -116,26 +122,26 @@ public class TmplServerServiceImpl implements ITmplServerService {
/**
* 新增硬盘
*
* @param tmplServer
* @param id
* @param jsonArray
*/
private void saveServerDisk(TmplServer tmplServer, JSONArray jsonArray) {
List<TmplServerNetcard> list = new ArrayList<>();
private void saveServerDisk(Integer id, JSONArray jsonArray) {
List<TmplServerDisk> list = new ArrayList<>();
jsonArray.forEach((i) -> {
JSONObject jsonObject = (JSONObject) i;
String valueStr = jsonObject.getString("value");
int num = 0;
if (StringUtils.isNotBlank(valueStr) && (num = Convert.toInt(valueStr)) > 0) {
SysDictData dictData = sysDictDataMapper.selectDictDataById(Convert.toLong(jsonObject.getString("id")));
TmplServerNetcard tmplServerNetcard = new TmplServerNetcard();
tmplServerNetcard.setServerId(tmplServer.getServerId());
tmplServerNetcard.setServerNetcardType(Convert.toLong(dictData.getDictCode()));
tmplServerNetcard.setServerNetcardNum(num);
list.add(tmplServerNetcard);
TmplServerDisk tmplServerDisk = new TmplServerDisk();
tmplServerDisk.setServerId(id);
tmplServerDisk.setServerDiskType(Convert.toLong(dictData.getDictCode()));
tmplServerDisk.setServerDiskNum(num);
list.add(tmplServerDisk);
}
});
int serverNetcardNums = list.size() > 0 ? tmplServerNetcardMapper.batchTmplServerNetcard(list) : 0;
if (serverNetcardNums == 0) {
int serverDiskNums = list.size() > 0 ? tmplServerDiskMapper.batchTmplServerDisk(list) : 0;
if (serverDiskNums == 0) {
throw new BusinessException("至少输入一个硬盘数量");
}
}

View File

@ -0,0 +1,82 @@
<?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.network.mapper.NetIpAddressMapper">
<resultMap type="NetIpAddress" id="NetIpAddressResult">
<result property="ipAddressId" column="ip_address_id"/>
<result property="ipAddressType" column="ip_address_type"/>
<result property="ipAddressSection" column="ip_address_section"/>
<result property="machingRoomId" column="maching_room_id"/>
<result property="ipUseRule" column="ip_use_rule"/>
<result property="ipAllocRule" column="ip_alloc_rule"/>
</resultMap>
<sql id="selectNetIpAddressVo">
select ip_address_id, ip_address_type, ip_address_section, maching_room_id, ip_use_rule, ip_alloc_rule from net_ip_address
</sql>
<select id="selectNetIpAddressList" parameterType="NetIpAddress" resultMap="NetIpAddressResult">
<include refid="selectNetIpAddressVo"/>
<where>
<if test="ipAddressId != null ">and ip_address_id = #{ipAddressId}</if>
<if test="ipAddressType != null and ipAddressType != '' ">and ip_address_type = #{ipAddressType}</if>
<if test="ipAddressSection != null and ipAddressSection != '' ">and ip_address_section =
#{ipAddressSection}
</if>
<if test="machingRoomId != null and machingRoomId != '' ">and maching_room_id = #{machingRoomId}</if>
<if test="ipUseRule != null and ipUseRule != '' ">and ip_use_rule = #{ipUseRule}</if>
<if test="ipAllocRule != null and ipAllocRule != '' ">and ip_alloc_rule = #{ipAllocRule}</if>
</where>
</select>
<select id="selectNetIpAddressById" parameterType="Integer" resultMap="NetIpAddressResult">
<include refid="selectNetIpAddressVo"/>
where ip_address_id = #{ipAddressId}
</select>
<insert id="insertNetIpAddress" parameterType="NetIpAddress" useGeneratedKeys="true" keyProperty="ipAddressId">
insert into net_ip_address
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="ipAddressType != null and ipAddressType != '' ">ip_address_type,</if>
<if test="ipAddressSection != null and ipAddressSection != '' ">ip_address_section,</if>
<if test="machingRoomId != null and machingRoomId != '' ">maching_room_id,</if>
<if test="ipUseRule != null and ipUseRule != '' ">ip_use_rule,</if>
<if test="ipAllocRule != null and ipAllocRule != '' ">ip_alloc_rule,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="ipAddressType != null and ipAddressType != '' ">#{ipAddressType},</if>
<if test="ipAddressSection != null and ipAddressSection != '' ">#{ipAddressSection},</if>
<if test="machingRoomId != null and machingRoomId != '' ">#{machingRoomId},</if>
<if test="ipUseRule != null and ipUseRule != '' ">#{ipUseRule},</if>
<if test="ipAllocRule != null and ip AllocRule != '' ">#{ipAllocRule},</if>
</trim>
</insert>
<update id="updateNetIpAddress" parameterType="NetIpAddress">
update net_ip_address
<trim prefix="SET" suffixOverrides=",">
<if test="ipAddressType != null and ipAddressType != '' ">ip_address_type = #{ipAddressType},</if>
<if test="ipAddressSection != null and ipAddressSection != '' ">ip_address_section =
#{ipAddressSection},
</if>
<if test="machingRoomId != null and machingRoomId != '' ">maching_room_id = #{machingRoomId},</if>
<if test="ipUseRule != null and ipUseRule != '' ">ip_use_rule = #{ipUseRule},</if>
<if test="ipAllocRule != null and ipAllocRule != '' ">ip_alloc_rule = #{ipAllocRule},</if>
</trim>
where ip_address_id = #{ipAddressId}
</update>
<delete id="deleteNetIpAddressById" parameterType="Integer">
delete from net_ip_address where ip_address_id = #{ipAddressId}
</delete>
<delete id="deleteNetIpAddressByIds" parameterType="String">
delete from net_ip_address where ip_address_id in
<foreach item="ipAddressId" collection="array" open="(" separator="," close=")">
#{ipAddressId}
</foreach>
</delete>
</mapper>

View File

@ -1,49 +1,56 @@
<?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.TmplServerDiskMapper">
<resultMap type="TmplServerDisk" id="TmplServerDiskResult">
<result property="serverDiskId" column="server_disk_id" />
<result property="serverId" column="server_id" />
<result property="serverDiskType" column="server_disk_type" />
<result property="serverDiskNum" column="server_disk_num" />
<result property="serverDiskId" column="server_disk_id"/>
<result property="serverId" column="server_id"/>
<result property="serverDiskType" column="server_disk_type"/>
<result property="serverDiskNum" column="server_disk_num"/>
</resultMap>
<sql id="selectTmplServerDiskVo">
<sql id="selectTmplServerDiskVo">
select server_disk_id, server_id, server_disk_type, server_disk_num from tmpl_server_disk
</sql>
<select id="selectTmplServerDiskList" parameterType="TmplServerDisk" resultMap="TmplServerDiskResult">
<include refid="selectTmplServerDiskVo"/>
<where>
<if test="serverDiskId != null "> and server_disk_id = #{serverDiskId}</if>
<if test="serverId != null "> and server_id = #{serverId}</if>
<if test="serverDiskType != null "> and server_disk_type = #{serverDiskType}</if>
<if test="serverDiskNum != null "> and server_disk_num = #{serverDiskNum}</if>
</where>
<where>
<if test="serverDiskId != null ">and server_disk_id = #{serverDiskId}</if>
<if test="serverId != null ">and server_id = #{serverId}</if>
<if test="serverDiskType != null ">and server_disk_type = #{serverDiskType}</if>
<if test="serverDiskNum != null ">and server_disk_num = #{serverDiskNum}</if>
</where>
</select>
<select id="selectTmplServerDiskById" parameterType="Integer" resultMap="TmplServerDiskResult">
<include refid="selectTmplServerDiskVo"/>
where server_disk_id = #{serverDiskId}
</select>
<insert id="insertTmplServerDisk" parameterType="TmplServerDisk" useGeneratedKeys="true" keyProperty="serverDiskId">
insert into tmpl_server_disk
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="serverId != null ">server_id,</if>
<if test="serverDiskType != null ">server_disk_type,</if>
<if test="serverDiskNum != null ">server_disk_num,</if>
</trim>
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="serverId != null ">server_id,</if>
<if test="serverDiskType != null ">server_disk_type,</if>
<if test="serverDiskNum != null ">server_disk_num,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="serverId != null ">#{serverId},</if>
<if test="serverDiskType != null ">#{serverDiskType},</if>
<if test="serverDiskNum != null ">#{serverDiskNum},</if>
</trim>
<if test="serverId != null ">#{serverId},</if>
<if test="serverDiskType != null ">#{serverDiskType},</if>
<if test="serverDiskNum != null ">#{serverDiskNum},</if>
</trim>
</insert>
<insert id="batchTmplServerDisk">
insert into tmpl_server_disk(server_id, server_disk_type,server_disk_num) values
<foreach item="item" index="index" collection="list" separator=",">
(#{item.serverId},#{item.serverDiskType},#{item.serverDiskNum})
</foreach>
</insert>
<update id="updateTmplServerDisk" parameterType="TmplServerDisk">
update tmpl_server_disk
<trim prefix="SET" suffixOverrides=",">
@ -54,15 +61,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where server_disk_id = #{serverDiskId}
</update>
<delete id="deleteTmplServerDiskById" parameterType="Integer">
<delete id="deleteTmplServerDiskById" parameterType="Integer">
delete from tmpl_server_disk where server_disk_id = #{serverDiskId}
</delete>
<delete id="deleteTmplServerDiskByIds" parameterType="String">
delete from tmpl_server_disk where server_disk_id in
delete from tmpl_server_disk where server_disk_id in
<foreach item="serverDiskId" collection="array" open="(" separator="," close=")">
#{serverDiskId}
</foreach>
</delete>
</mapper>

View File

@ -56,9 +56,9 @@
<if test="raidCard != null and raidCard != '' ">and raid_card = #{raidCard}</if>
</where>
</select>
<select id="selectTmplServerList_COUNT" resultType="Long">
select count(0) from tmpl_server
</select>
<!-- <select id="selectTmplServerList_COUNT" resultType="Long">-->
<!-- select count(0) from tmpl_server-->
<!-- </select>-->
<select id="selectTmplServerById" parameterType="Integer" resultMap="TmplServerResult">

View File

@ -46,9 +46,9 @@
<if test="powerNum != null ">and power_num = #{powerNum}</if>
</where>
</select>
<select id="selectTmplSwitchList_COUNT" resultType="Long">
select count(0) from tmpl_switch
</select>
<!-- <select id="selectTmplSwitchList_COUNT" resultType="Long">-->
<!-- select count(0) from tmpl_switch-->
<!-- </select>-->
<select id="selectTmplSwitchById" parameterType="Integer" resultMap="TmplSwitchResult">