网络IP地址类型外键

This commit is contained in:
tangpeng 2019-06-18 21:11:11 +08:00
parent ff080bc307
commit ffe45a27b6
10 changed files with 451 additions and 396 deletions

View File

@ -24,8 +24,7 @@ import java.util.List;
*/ */
@Controller @Controller
@RequestMapping("/network/netIpAddress") @RequestMapping("/network/netIpAddress")
public class NetIpAddressController extends BaseController public class NetIpAddressController extends BaseController {
{
private String prefix = "network/netIpAddress"; private String prefix = "network/netIpAddress";
@Autowired @Autowired
@ -33,8 +32,7 @@ public class NetIpAddressController extends BaseController
@RequiresPermissions("network:netIpAddress:view") @RequiresPermissions("network:netIpAddress:view")
@GetMapping() @GetMapping()
public String netIpAddress() public String netIpAddress() {
{
return prefix + "/netIpAddress"; return prefix + "/netIpAddress";
} }
@ -44,8 +42,7 @@ public class NetIpAddressController extends BaseController
@RequiresPermissions("network:netIpAddress:list") @RequiresPermissions("network:netIpAddress:list")
@PostMapping("/list") @PostMapping("/list")
@ResponseBody @ResponseBody
public TableDataInfo list(NetIpAddress netIpAddress) public TableDataInfo list(NetIpAddress netIpAddress) {
{
startPage(); startPage();
List<NetIpAddress> list = netIpAddressService.selectNetIpAddressList(netIpAddress); List<NetIpAddress> list = netIpAddressService.selectNetIpAddressList(netIpAddress);
return getDataTable(list); return getDataTable(list);
@ -58,8 +55,7 @@ public class NetIpAddressController extends BaseController
@RequiresPermissions("network:netIpAddress:export") @RequiresPermissions("network:netIpAddress:export")
@PostMapping("/export") @PostMapping("/export")
@ResponseBody @ResponseBody
public AjaxResult export(NetIpAddress netIpAddress) public AjaxResult export(NetIpAddress netIpAddress) {
{
List<NetIpAddress> list = netIpAddressService.selectNetIpAddressList(netIpAddress); List<NetIpAddress> list = netIpAddressService.selectNetIpAddressList(netIpAddress);
ExcelUtil<NetIpAddress> util = new ExcelUtil<NetIpAddress>(NetIpAddress.class); ExcelUtil<NetIpAddress> util = new ExcelUtil<NetIpAddress>(NetIpAddress.class);
return util.exportExcel(list, "netIpAddress"); return util.exportExcel(list, "netIpAddress");
@ -69,8 +65,7 @@ public class NetIpAddressController extends BaseController
* 新增网络IP * 新增网络IP
*/ */
@GetMapping("/add") @GetMapping("/add")
public String add() public String add() {
{
return prefix + "/add"; return prefix + "/add";
} }
@ -81,8 +76,7 @@ public class NetIpAddressController extends BaseController
@Log(title = "网络IP", businessType = BusinessType.INSERT) @Log(title = "网络IP", businessType = BusinessType.INSERT)
@PostMapping("/add") @PostMapping("/add")
@ResponseBody @ResponseBody
public AjaxResult addSave(NetIpAddress netIpAddress) public AjaxResult addSave(NetIpAddress netIpAddress) {
{
return toAjax(netIpAddressService.insertNetIpAddress(netIpAddress)); return toAjax(netIpAddressService.insertNetIpAddress(netIpAddress));
} }
@ -90,8 +84,7 @@ public class NetIpAddressController extends BaseController
* 修改网络IP * 修改网络IP
*/ */
@GetMapping("/edit/{ipAddressId}") @GetMapping("/edit/{ipAddressId}")
public String edit(@PathVariable("ipAddressId") Integer ipAddressId, ModelMap mmap) public String edit(@PathVariable("ipAddressId") Integer ipAddressId, ModelMap mmap) {
{
NetIpAddress netIpAddress = netIpAddressService.selectNetIpAddressById(ipAddressId); NetIpAddress netIpAddress = netIpAddressService.selectNetIpAddressById(ipAddressId);
mmap.put("netIpAddress", netIpAddress); mmap.put("netIpAddress", netIpAddress);
return prefix + "/edit"; return prefix + "/edit";
@ -104,8 +97,7 @@ public class NetIpAddressController extends BaseController
@Log(title = "网络IP", businessType = BusinessType.UPDATE) @Log(title = "网络IP", businessType = BusinessType.UPDATE)
@PostMapping("/edit") @PostMapping("/edit")
@ResponseBody @ResponseBody
public AjaxResult editSave(NetIpAddress netIpAddress) public AjaxResult editSave(NetIpAddress netIpAddress) {
{
return toAjax(netIpAddressService.updateNetIpAddress(netIpAddress)); return toAjax(netIpAddressService.updateNetIpAddress(netIpAddress));
} }
@ -114,10 +106,9 @@ public class NetIpAddressController extends BaseController
*/ */
@RequiresPermissions("network:netIpAddress:remove") @RequiresPermissions("network:netIpAddress:remove")
@Log(title = "网络IP", businessType = BusinessType.DELETE) @Log(title = "网络IP", businessType = BusinessType.DELETE)
@PostMapping( "/remove") @PostMapping("/remove")
@ResponseBody @ResponseBody
public AjaxResult remove(String ids) public AjaxResult remove(String ids) {
{
return toAjax(netIpAddressService.deleteNetIpAddressByIds(ids)); return toAjax(netIpAddressService.deleteNetIpAddressByIds(ids));
} }

View File

@ -122,29 +122,14 @@
}, },
{ {
field: 'bandwidthSize', field: 'bandwidthSize',
title: '带宽大小', title: '带宽(M)',
sortable: true sortable: true
}, },
{ {
field: 'country', field: 'country',
title: '所在国家', title: '国家',
sortable: true sortable: true
}, },
// {
// field: 'province',
// title: '所在省',
// sortable: true
// },
// {
// field: 'city',
// title: '所在市',
// sortable: true
// },
// {
// field: 'area',
// title: '所在区',
// sortable: true
// },
{ {
title: '省市区', title: '省市区',
formatter: function (value, row, index) { formatter: function (value, row, index) {
@ -173,8 +158,32 @@
field: 'email', field: 'email',
title: '邮箱', title: '邮箱',
sortable: true sortable: true
}, }]
{ };
$.each([[${@dict.getType('dict_net_ip_type')}]], function (index, dict) {
options.columns.push({
field: dict.dictCode,
title: dict.dictLabel,
align: 'center',
formatter: function (value, row, index) {
if (row.switchPorts) {
$.each(row.switchPorts, function (index, switchPort) {
if (switchPort.switchPortType == dict.dictCode) {
value = switchPort.switchPortNum;
} else {
}
});
}
var title = "'新增" + dict.dictLabel + "IP'";
var url = "/network/netIpAddress/add?";
value = "<a class=\"btn btn-primary btn-xs \" href=\"javascript:void(0)\" " +
"onclick=\"$.modal.open(" + title + ",'" + url + "');\"><i class=\"fa fa-create\"></i>新增</a>";
return value;
}
});
});
options.columns.push({
title: '操作', title: '操作',
align: 'center', align: 'center',
formatter: function (value, row, index) { formatter: function (value, row, index) {
@ -183,8 +192,7 @@
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.machineRoomId + '\')"><i class="fa fa-remove"></i>删除</a>'); actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.machineRoomId + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join(''); return actions.join('');
} }
}] });
};
$.table.init(options); $.table.init(options);
}); });
</script> </script>

View File

@ -28,7 +28,7 @@
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">带宽大小:</label> <label class="col-sm-3 control-label">带宽大小(M)</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input id="bandwidthSize" name="bandwidthSize" th:field="*{bandwidthSize}" class="form-control" <input id="bandwidthSize" name="bandwidthSize" th:field="*{bandwidthSize}" class="form-control"
type="text"> type="text">

View File

@ -9,7 +9,13 @@
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">IP地址类型</label> <label class="col-sm-3 control-label">IP地址类型</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input id="ipAddressType" name="ipAddressType" class="form-control" type="text"> <select id="ipAddressType" name="ipAddressType.dictCode"
th:with="type=${@dict.getType('dict_net_ip_type')}">
<option value="">请选择带宽类型</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}"
th:value="${dict.dictCode}">
</option>
</select>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
@ -21,7 +27,7 @@
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">所属机房:</label> <label class="col-sm-3 control-label">所属机房:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input id="machingRoomId" name="machingRoomId" class="form-control" type="text"> <input id="machineRoomId" name="machineRoomId" class="form-control" type="text">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
@ -44,7 +50,12 @@
$("#form-netIpAddress-add").validate({ $("#form-netIpAddress-add").validate({
onkeyup: false, onkeyup: false,
rules: { rules: {
ipAddressType: { machineRoomId: {
required: true,
minlength: 1,
maxlength: 2
},
"ipAddressType.dictCode": {
required: true, required: true,
minlength: 1, minlength: 1,
maxlength: 20 maxlength: 20
@ -53,12 +64,7 @@
required: true, required: true,
minlength: 1, minlength: 1,
maxlength: 20 maxlength: 20
}, }
machingRoomId: {
required: true,
minlength: 1,
maxlength: 2
},
}, },
focusCleanup: true focusCleanup: true
}); });

View File

@ -1,28 +1,37 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" > <html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head> <head>
<th:block th:include="include :: header('修改网络IP')" /> <th:block th:include="include :: header('修改网络IP')"/>
</head> </head>
<body class="white-bg"> <body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> <div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-netIpAddress-edit" th:object="${netIpAddress}"> <form class="form-horizontal m" id="form-netIpAddress-edit" th:object="${netIpAddress}">
<input id="ipAddressId" name="ipAddressId" th:field="*{ipAddressId}" type="hidden"> <input id="ipAddressId" name="ipAddressId" th:field="*{ipAddressId}" type="hidden">
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">IP地址类型</label> <label class="col-sm-3 control-label">IP地址类型</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input id="ipAddressType" name="ipAddressType" th:field="*{ipAddressType}" class="form-control" type="text"> <select id="ipAddressType" name="ipAddressType.dictCode"
th:with="type=${@dict.getType('dict_net_ip_type')}">
<option value="">请选择IP地址类型</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}"
th:value="${dict.dictCode}"
th:selected="*{ipAddressType.dictCode} == ${dict.dictCode} ? true :false">
</option>
</select>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">IP地址段</label> <label class="col-sm-3 control-label">IP地址段</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input id="ipAddressSection" name="ipAddressSection" th:field="*{ipAddressSection}" class="form-control" type="text"> <input id="ipAddressSection" name="ipAddressSection" th:field="*{ipAddressSection}" class="form-control"
type="text">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">所属机房编号:</label> <label class="col-sm-3 control-label">所属机房编号:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input id="machingRoomId" name="machingRoomId" th:field="*{machingRoomId}" class="form-control" type="text"> <input id="machineRoomId" name="machineRoomId" th:field="*{machineRoomId}" class="form-control"
type="text">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
@ -38,15 +47,27 @@
</div> </div>
</div> </div>
</form> </form>
</div> </div>
<div th:include="include::footer"></div> <div th:include="include::footer"></div>
<script type="text/javascript" th:inline="javascript"> <script type="text/javascript" th:inline="javascript">
var prefix = ctx + "network/netIpAddress"; var prefix = ctx + "network/netIpAddress";
$("#form-netIpAddress-edit").validate({ $("#form-netIpAddress-edit").validate({
rules:{ rules: {
xxxx:{ machineRoomId: {
required:true, required: true,
minlength: 1,
maxlength: 2
}, },
ipAddressType: {
required: true,
minlength: 1,
maxlength: 20
},
ipAddressSection: {
required: true,
minlength: 1,
maxlength: 20
}
}, },
focusCleanup: true focusCleanup: true
}); });
@ -56,6 +77,6 @@
$.operate.save(prefix + "/edit", $('#form-netIpAddress-edit').serialize()); $.operate.save(prefix + "/edit", $('#form-netIpAddress-edit').serialize());
} }
} }
</script> </script>
</body> </body>
</html> </html>

View File

@ -1,17 +1,17 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"> <html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head> <head>
<th:block th:include="include :: header('网络IP列表')" /> <th:block th:include="include :: header('网络IP列表')"/>
</head> </head>
<body class="gray-bg"> <body class="gray-bg">
<div class="container-div"> <div class="container-div">
<div class="row"> <div class="row">
<div class="col-sm-12 search-collapse"> <div class="col-sm-12 search-collapse">
<form id="formId"> <form id="formId">
<div class="select-list"> <div class="select-list">
<ul> <ul>
<li> <li>
IP地址类型<input type="text" name="ipAddressType"/> IP地址类型<input type="text" name="dictCode"/>
</li> </li>
<li> <li>
@ -19,7 +19,7 @@
</li> </li>
<li> <li>
所属机房编号:<input type="text" name="machingRoomId"/> 所属机房编号:<input type="text" name="machineRoomId"/>
</li> </li>
<li> <li>
@ -31,8 +31,10 @@
</li> </li>
<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-primary btn-rounded btn-sm" onclick="$.table.search()"><i
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a> 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> </li>
</ul> </ul>
</div> </div>
@ -43,13 +45,16 @@
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="network:netIpAddress:add"> <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="network:netIpAddress:add">
<i class="fa fa-plus"></i> 添加 <i class="fa fa-plus"></i> 添加
</a> </a>
<a class="btn btn-primary btn-edit disabled" onclick="$.operate.edit()" shiro:hasPermission="network:netIpAddress:edit"> <a class="btn btn-primary btn-edit disabled" onclick="$.operate.edit()"
shiro:hasPermission="network:netIpAddress:edit">
<i class="fa fa-edit"></i> 修改 <i class="fa fa-edit"></i> 修改
</a> </a>
<a class="btn btn-danger btn-del btn-del disabled" onclick="$.operate.removeAll()" shiro:hasPermission="network:netIpAddress:remove"> <a class="btn btn-danger btn-del btn-del disabled" onclick="$.operate.removeAll()"
shiro:hasPermission="network:netIpAddress:remove">
<i class="fa fa-remove"></i> 删除 <i class="fa fa-remove"></i> 删除
</a> </a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="network:netIpAddress:export"> <a class="btn btn-warning" onclick="$.table.exportExcel()"
shiro:hasPermission="network:netIpAddress:export">
<i class="fa fa-download"></i> 导出 <i class="fa fa-download"></i> 导出
</a> </a>
</div> </div>
@ -57,14 +62,14 @@
<table id="bootstrap-table" data-mobile-responsive="true"></table> <table id="bootstrap-table" data-mobile-responsive="true"></table>
</div> </div>
</div> </div>
</div> </div>
<div th:include="include :: footer"></div> <div th:include="include :: footer"></div>
<script th:inline="javascript"> <script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('network:netIpAddress:edit')}]]; var editFlag = [[${@permission.hasPermi('network:netIpAddress:edit')}]];
var removeFlag = [[${@permission.hasPermi('network:netIpAddress:remove')}]]; var removeFlag = [[${@permission.hasPermi('network:netIpAddress:remove')}]];
var prefix = ctx + "network/netIpAddress"; var prefix = ctx + "network/netIpAddress";
$(function() { $(function () {
var options = { var options = {
url: prefix + "/list", url: prefix + "/list",
createUrl: prefix + "/add", createUrl: prefix + "/add",
@ -77,39 +82,39 @@
checkbox: true checkbox: true
}, },
{ {
field : 'ipAddressId', field: 'ipAddressId',
title : 'IP地址编号', title: 'IP地址编号',
visible: false visible: false
}, },
{ {
field : 'ipAddressType', field: 'ipAddressType.dictLabel',
title : 'IP地址类型', title: 'IP地址类型',
sortable: true sortable: true
}, },
{ {
field : 'ipAddressSection', field: 'ipAddressSection',
title : 'IP地址段', title: 'IP地址段',
sortable: true sortable: true
}, },
{ {
field : 'machingRoomId', field: 'machineRoomId',
title : '所属机房', title: '所属机房',
sortable: true sortable: true
}, },
{ {
field : 'ipUseRule', field: 'ipUseRule',
title : 'IP使用规则', title: 'IP使用规则',
sortable: true sortable: true
}, },
{ {
field : 'ipAllocRule', field: 'ipAllocRule',
title : 'IP地址分配规则', title: 'IP地址分配规则',
sortable: true sortable: true
}, },
{ {
title: '操作', title: '操作',
align: 'center', align: 'center',
formatter: function(value, row, index) { formatter: function (value, row, index) {
var actions = []; 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-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>'); 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>');
@ -119,6 +124,6 @@
}; };
$.table.init(options); $.table.init(options);
}); });
</script> </script>
</body> </body>
</html> </html>

View File

@ -123,7 +123,7 @@
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.switchId + '\')"><i class="fa fa-remove"></i>删除</a>'); actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.switchId + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join(''); return actions.join('');
} }
}) });
$.table.init(options); $.table.init(options);
}); });
</script> </script>

View File

@ -1,6 +1,7 @@
package com.ruoyi.network.domain; package com.ruoyi.network.domain;
import com.ruoyi.common.core.domain.BaseEntity; import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.system.domain.SysDictData;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
@ -20,7 +21,11 @@ public class NetIpAddress extends BaseEntity {
/** /**
* IP地址类型 * IP地址类型
*/ */
private String ipAddressType; private Integer dictCode;
/**
* IP地址类型 实体关联
*/
private SysDictData ipAddressType;
/** /**
* IP地址段 * IP地址段
*/ */
@ -28,7 +33,7 @@ public class NetIpAddress extends BaseEntity {
/** /**
* 所属机房编号 * 所属机房编号
*/ */
private String machingRoomId; private Integer machineRoomId;
/** /**
* IP使用规则 * IP使用规则
*/ */
@ -46,11 +51,19 @@ public class NetIpAddress extends BaseEntity {
this.ipAddressId = ipAddressId; this.ipAddressId = ipAddressId;
} }
public String getIpAddressType() { public Integer getDictCode() {
return dictCode;
}
public void setDictCode(Integer dictCode) {
this.dictCode = dictCode;
}
public SysDictData getIpAddressType() {
return ipAddressType; return ipAddressType;
} }
public void setIpAddressType(String ipAddressType) { public void setIpAddressType(SysDictData ipAddressType) {
this.ipAddressType = ipAddressType; this.ipAddressType = ipAddressType;
} }
@ -62,12 +75,12 @@ public class NetIpAddress extends BaseEntity {
this.ipAddressSection = ipAddressSection; this.ipAddressSection = ipAddressSection;
} }
public String getMachingRoomId() { public Integer getMachineRoomId() {
return machingRoomId; return machineRoomId;
} }
public void setMachingRoomId(String machingRoomId) { public void setMachineRoomId(Integer machineRoomId) {
this.machingRoomId = machingRoomId; this.machineRoomId = machineRoomId;
} }
public String getIpUseRule() { public String getIpUseRule() {
@ -90,7 +103,7 @@ public class NetIpAddress extends BaseEntity {
public String toString() { public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("ipAddressId", getIpAddressId()) return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("ipAddressId", getIpAddressId())
.append("ipAddressType", getIpAddressType()).append("ipAddressSection", getIpAddressSection()) .append("ipAddressType", getIpAddressType()).append("ipAddressSection", getIpAddressSection())
.append("machingRoomId", getMachingRoomId()).append("ipUseRule", getIpUseRule()) .append("machineRoomId", getMachineRoomId()).append("ipUseRule", getIpUseRule())
.append("ipAllocRule", getIpAllocRule()).toString(); .append("ipAllocRule", getIpAllocRule()).toString();
} }
} }

View File

@ -1,16 +1,16 @@
package com.ruoyi.system.mapper; package com.ruoyi.system.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.ruoyi.system.domain.SysDictData; import com.ruoyi.system.domain.SysDictData;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* 字典表 数据层 * 字典表 数据层
* *
* @author ruoyi * @author ruoyi
*/ */
public interface SysDictDataMapper public interface SysDictDataMapper {
{
/** /**
* 根据条件分页查询字典数据 * 根据条件分页查询字典数据
* *

View File

@ -6,62 +6,71 @@
<resultMap type="NetIpAddress" id="NetIpAddressResult"> <resultMap type="NetIpAddress" id="NetIpAddressResult">
<result property="ipAddressId" column="ip_address_id"/> <result property="ipAddressId" column="ip_address_id"/>
<result property="ipAddressType" column="ip_address_type"/> <!-- <result property="ipAddressType" column="ip_address_type"/>-->
<result property="ipAddressSection" column="ip_address_section"/> <result property="ipAddressSection" column="ip_address_section"/>
<result property="machingRoomId" column="maching_room_id"/> <result property="machineRoomId" column="machine_room_id"/>
<result property="ipUseRule" column="ip_use_rule"/> <result property="ipUseRule" column="ip_use_rule"/>
<result property="ipAllocRule" column="ip_alloc_rule"/> <result property="ipAllocRule" column="ip_alloc_rule"/>
<association property="ipAddressType"
column="ip_address_type"
select="com.ruoyi.system.mapper.SysDictDataMapper.selectDictDataById">
</association>
</resultMap> </resultMap>
<sql id="selectNetIpAddressVo"> <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 select ip_address_id, ip_address_type, ip_address_section,
machine_room_id,
ip_use_rule, ip_alloc_rule from net_ip_address
</sql> </sql>
<select id="selectNetIpAddressList" parameterType="NetIpAddress" resultMap="NetIpAddressResult"> <select id="selectNetIpAddressList" parameterType="NetIpAddress"
resultMap="NetIpAddressResult">
<include refid="selectNetIpAddressVo"/> <include refid="selectNetIpAddressVo"/>
<where> <where>
<if test="ipAddressId != null ">and ip_address_id = #{ipAddressId}</if> <if test="ipAddressId != null ">and ip_address_id = #{ipAddressId}</if>
<if test="ipAddressType != null and ipAddressType != '' ">and ip_address_type = #{ipAddressType}</if> <if test="dictCode != null ">and ip_address_type = #{dictCode}</if>
<if test="ipAddressSection != null and ipAddressSection != '' ">and ip_address_section = <if test="ipAddressSection != null and ipAddressSection != '' ">and ip_address_section =
#{ipAddressSection} #{ipAddressSection}
</if> </if>
<if test="machingRoomId != null and machingRoomId != '' ">and maching_room_id = #{machingRoomId}</if> <if test="machineRoomId != null ">and machine_room_id = #{machineRoomId}</if>
<if test="ipUseRule != null and ipUseRule != '' ">and ip_use_rule = #{ipUseRule}</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> <if test="ipAllocRule != null and ipAllocRule != '' ">and ip_alloc_rule = #{ipAllocRule}</if>
</where> </where>
</select> </select>
<select id="selectNetIpAddressById" parameterType="Integer" resultMap="NetIpAddressResult"> <select id="selectNetIpAddressById" parameterType="Integer"
resultMap="NetIpAddressResult">
<include refid="selectNetIpAddressVo"/> <include refid="selectNetIpAddressVo"/>
where ip_address_id = #{ipAddressId} where ip_address_id = #{ipAddressId}
</select> </select>
<insert id="insertNetIpAddress" parameterType="NetIpAddress" useGeneratedKeys="true" keyProperty="ipAddressId"> <insert id="insertNetIpAddress" parameterType="NetIpAddress"
useGeneratedKeys="true" keyProperty="ipAddressId">
insert into net_ip_address insert into net_ip_address
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="ipAddressType != null and ipAddressType != '' ">ip_address_type,</if> <if test="ipAddressType != null ">ip_address_type,</if>
<if test="ipAddressSection != null and ipAddressSection != '' ">ip_address_section,</if> <if test="ipAddressSection != null and ipAddressSection != '' ">ip_address_section,</if>
<if test="machingRoomId != null and machingRoomId != '' ">maching_room_id,</if> <if test="machineRoomId != null ">machine_room_id,</if>
<if test="ipUseRule != null and ipUseRule != '' ">ip_use_rule,</if> <if test="ipUseRule != null and ipUseRule != '' ">ip_use_rule,</if>
<if test="ipAllocRule != null and ipAllocRule != '' ">ip_alloc_rule,</if> <if test="ipAllocRule != null and ipAllocRule != '' ">ip_alloc_rule,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="ipAddressType != null and ipAddressType != '' ">#{ipAddressType},</if> <if test="ipAddressType != null ">#{ipAddressType.dictCode},</if>
<if test="ipAddressSection != null and ipAddressSection != '' ">#{ipAddressSection},</if> <if test="ipAddressSection != null and ipAddressSection != '' ">#{ipAddressSection},</if>
<if test="machingRoomId != null and machingRoomId != '' ">#{machingRoomId},</if> <if test="machineRoomId != null ">#{machineRoomId},</if>
<if test="ipUseRule != null and ipUseRule != '' ">#{ipUseRule},</if> <if test="ipUseRule != null and ipUseRule != '' ">#{ipUseRule},</if>
<if test="ipAllocRule != null and ip AllocRule != '' ">#{ipAllocRule},</if> <if test="ipAllocRule != null and ipAllocRule != '' ">#{ipAllocRule},</if>
</trim> </trim>
</insert> </insert>
<update id="updateNetIpAddress" parameterType="NetIpAddress"> <update id="updateNetIpAddress" parameterType="NetIpAddress">
update net_ip_address update net_ip_address
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="ipAddressType != null and ipAddressType != '' ">ip_address_type = #{ipAddressType},</if> <if test="ipAddressType != null ">ip_address_type = #{ipAddressType.dictCode},</if>
<if test="ipAddressSection != null and ipAddressSection != '' ">ip_address_section = <if test="ipAddressSection != null and ipAddressSection != '' ">ip_address_section =
#{ipAddressSection}, #{ipAddressSection},
</if> </if>
<if test="machingRoomId != null and machingRoomId != '' ">maching_room_id = #{machingRoomId},</if> <if test="machineRoomId != null ">machine_room_id = #{machineRoomId},</if>
<if test="ipUseRule != null and ipUseRule != '' ">ip_use_rule = #{ipUseRule},</if> <if test="ipUseRule != null and ipUseRule != '' ">ip_use_rule = #{ipUseRule},</if>
<if test="ipAllocRule != null and ipAllocRule != '' ">ip_alloc_rule = #{ipAllocRule},</if> <if test="ipAllocRule != null and ipAllocRule != '' ">ip_alloc_rule = #{ipAllocRule},</if>
</trim> </trim>
@ -69,12 +78,14 @@
</update> </update>
<delete id="deleteNetIpAddressById" parameterType="Integer"> <delete id="deleteNetIpAddressById" parameterType="Integer">
delete from net_ip_address where ip_address_id = #{ipAddressId} delete from
net_ip_address where ip_address_id = #{ipAddressId}
</delete> </delete>
<delete id="deleteNetIpAddressByIds" parameterType="String"> <delete id="deleteNetIpAddressByIds" parameterType="String">
delete from net_ip_address where ip_address_id in delete from net_ip_address where ip_address_id in
<foreach item="ipAddressId" collection="array" open="(" separator="," close=")"> <foreach item="ipAddressId" collection="array" open="("
separator="," close=")">
#{ipAddressId} #{ipAddressId}
</foreach> </foreach>
</delete> </delete>