diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/network/NetIpAddressController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/network/NetIpAddressController.java index db747d198..1e8f0dfe8 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/network/NetIpAddressController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/network/NetIpAddressController.java @@ -18,107 +18,98 @@ import java.util.List; /** * 网络IP 信息操作处理 - * + * * @author TP * @date 2019-06-15 */ @Controller @RequestMapping("/network/netIpAddress") -public class NetIpAddressController extends BaseController -{ +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(); + + @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 list = netIpAddressService.selectNetIpAddressList(netIpAddress); - return getDataTable(list); - } - - - /** - * 导出网络IP列表 - */ - @RequiresPermissions("network:netIpAddress:export") + return getDataTable(list); + } + + + /** + * 导出网络IP列表 + */ + @RequiresPermissions("network:netIpAddress:export") @PostMapping("/export") @ResponseBody - public AjaxResult export(NetIpAddress netIpAddress) - { - List list = netIpAddressService.selectNetIpAddressList(netIpAddress); + public AjaxResult export(NetIpAddress netIpAddress) { + List list = netIpAddressService.selectNetIpAddressList(netIpAddress); ExcelUtil util = new ExcelUtil(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)); - } - + /** + * 新增网络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)); + } + } diff --git a/ruoyi-admin/src/main/resources/templates/assets/assetsMachineRoom/assetsMachineRoom.html b/ruoyi-admin/src/main/resources/templates/assets/assetsMachineRoom/assetsMachineRoom.html index 96eac2f86..b3faaf884 100755 --- a/ruoyi-admin/src/main/resources/templates/assets/assetsMachineRoom/assetsMachineRoom.html +++ b/ruoyi-admin/src/main/resources/templates/assets/assetsMachineRoom/assetsMachineRoom.html @@ -122,29 +122,14 @@ }, { field: 'bandwidthSize', - title: '带宽大小', + title: '带宽(M)', sortable: true }, { field: 'country', - title: '所在国家', + title: '国家', sortable: true }, - // { - // field: 'province', - // title: '所在省', - // sortable: true - // }, - // { - // field: 'city', - // title: '所在市', - // sortable: true - // }, - // { - // field: 'area', - // title: '所在区', - // sortable: true - // }, { title: '省市区', formatter: function (value, row, index) { @@ -173,18 +158,41 @@ field: 'email', title: '邮箱', sortable: true - }, - { - title: '操作', - align: 'center', - formatter: function (value, row, index) { - var actions = []; - actions.push('编辑 '); - actions.push('删除'); - return actions.join(''); - } }] }; + $.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 = "新增"; + return value; + } + }); + }); + options.columns.push({ + title: '操作', + align: 'center', + formatter: function (value, row, index) { + var actions = []; + actions.push('编辑 '); + actions.push('删除'); + return actions.join(''); + } + }); $.table.init(options); }); diff --git a/ruoyi-admin/src/main/resources/templates/assets/assetsMachineRoom/edit.html b/ruoyi-admin/src/main/resources/templates/assets/assetsMachineRoom/edit.html index 615cbf974..b574a39ed 100755 --- a/ruoyi-admin/src/main/resources/templates/assets/assetsMachineRoom/edit.html +++ b/ruoyi-admin/src/main/resources/templates/assets/assetsMachineRoom/edit.html @@ -28,7 +28,7 @@
- +
diff --git a/ruoyi-admin/src/main/resources/templates/network/netIpAddress/add.html b/ruoyi-admin/src/main/resources/templates/network/netIpAddress/add.html index 0d813d217..580e705a2 100644 --- a/ruoyi-admin/src/main/resources/templates/network/netIpAddress/add.html +++ b/ruoyi-admin/src/main/resources/templates/network/netIpAddress/add.html @@ -9,7 +9,13 @@
- +
@@ -21,7 +27,7 @@
- +
@@ -44,7 +50,12 @@ $("#form-netIpAddress-add").validate({ onkeyup: false, rules: { - ipAddressType: { + machineRoomId: { + required: true, + minlength: 1, + maxlength: 2 + }, + "ipAddressType.dictCode": { required: true, minlength: 1, maxlength: 20 @@ -53,12 +64,7 @@ required: true, minlength: 1, maxlength: 20 - }, - machingRoomId: { - required: true, - minlength: 1, - maxlength: 2 - }, + } }, focusCleanup: true }); diff --git a/ruoyi-admin/src/main/resources/templates/network/netIpAddress/edit.html b/ruoyi-admin/src/main/resources/templates/network/netIpAddress/edit.html index 84b6a9b36..76c4c873d 100644 --- a/ruoyi-admin/src/main/resources/templates/network/netIpAddress/edit.html +++ b/ruoyi-admin/src/main/resources/templates/network/netIpAddress/edit.html @@ -1,61 +1,82 @@ - + - + -
-
- -
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
-
-
- +
+
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+ diff --git a/ruoyi-admin/src/main/resources/templates/network/netIpAddress/netIpAddress.html b/ruoyi-admin/src/main/resources/templates/network/netIpAddress/netIpAddress.html index 1b66f844c..c31e413c6 100644 --- a/ruoyi-admin/src/main/resources/templates/network/netIpAddress/netIpAddress.html +++ b/ruoyi-admin/src/main/resources/templates/network/netIpAddress/netIpAddress.html @@ -1,124 +1,129 @@ - + -
-
-
-
-
-
    -
  • - IP地址类型: -
  • +
    +
    +
    + +
    +
      +
    • + IP地址类型: +
    • -
    • - IP地址段: -
    • +
    • + IP地址段: +
    • -
    • - 所属机房编号: -
    • +
    • + 所属机房编号: +
    • -
    • - IP使用规则: -
    • +
    • + IP使用规则: +
    • -
    • - IP地址分配规则: -
    • +
    • + IP地址分配规则: +
    • -
    • -  搜索 -  重置 -
    • -
    -
    - -
    - - -
    -
    -
    -
    -
    -
    - + return actions.join(''); + } + }] + }; + $.table.init(options); + }); + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/template/tmplSwitch/tmplSwitch.html b/ruoyi-admin/src/main/resources/templates/template/tmplSwitch/tmplSwitch.html index 0c90c4275..c9e8b8959 100644 --- a/ruoyi-admin/src/main/resources/templates/template/tmplSwitch/tmplSwitch.html +++ b/ruoyi-admin/src/main/resources/templates/template/tmplSwitch/tmplSwitch.html @@ -123,7 +123,7 @@ actions.push('删除'); return actions.join(''); } - }) + }); $.table.init(options); }); diff --git a/ruoyi-system/src/main/java/com/ruoyi/network/domain/NetIpAddress.java b/ruoyi-system/src/main/java/com/ruoyi/network/domain/NetIpAddress.java index 6e063a50c..1f3dde7fe 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/network/domain/NetIpAddress.java +++ b/ruoyi-system/src/main/java/com/ruoyi/network/domain/NetIpAddress.java @@ -1,6 +1,7 @@ package com.ruoyi.network.domain; 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.ToStringStyle; @@ -11,86 +12,98 @@ import org.apache.commons.lang3.builder.ToStringStyle; * @date 2019-06-15 */ public class NetIpAddress extends BaseEntity { - private static final long serialVersionUID = 1L; + 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; + /** + * IP地址编号 + */ + private Integer ipAddressId; + /** + * IP地址类型 + */ + private Integer dictCode; + /** + * IP地址类型 实体关联 + */ + private SysDictData ipAddressType; + /** + * IP地址段 + */ + private String ipAddressSection; + /** + * 所属机房编号 + */ + private Integer machineRoomId; + /** + * IP使用规则 + */ + private String ipUseRule; + /** + * IP地址分配规则 + */ + private String ipAllocRule; - public Integer getIpAddressId() { - return ipAddressId; - } + public Integer getIpAddressId() { + return ipAddressId; + } - public void setIpAddressId(Integer ipAddressId) { - this.ipAddressId = ipAddressId; - } + public void setIpAddressId(Integer ipAddressId) { + this.ipAddressId = ipAddressId; + } - public String getIpAddressType() { - return ipAddressType; - } + public Integer getDictCode() { + return dictCode; + } - public void setIpAddressType(String ipAddressType) { - this.ipAddressType = ipAddressType; - } + public void setDictCode(Integer dictCode) { + this.dictCode = dictCode; + } - public String getIpAddressSection() { - return ipAddressSection; - } + public SysDictData getIpAddressType() { + return ipAddressType; + } - public void setIpAddressSection(String ipAddressSection) { - this.ipAddressSection = ipAddressSection; - } + public void setIpAddressType(SysDictData ipAddressType) { + this.ipAddressType = ipAddressType; + } - public String getMachingRoomId() { - return machingRoomId; - } + public String getIpAddressSection() { + return ipAddressSection; + } - public void setMachingRoomId(String machingRoomId) { - this.machingRoomId = machingRoomId; - } + public void setIpAddressSection(String ipAddressSection) { + this.ipAddressSection = ipAddressSection; + } - public String getIpUseRule() { - return ipUseRule; - } + public Integer getMachineRoomId() { + return machineRoomId; + } - public void setIpUseRule(String ipUseRule) { - this.ipUseRule = ipUseRule; - } + public void setMachineRoomId(Integer machineRoomId) { + this.machineRoomId = machineRoomId; + } - public String getIpAllocRule() { - return ipAllocRule; - } + public String getIpUseRule() { + return ipUseRule; + } - public void setIpAllocRule(String ipAllocRule) { - this.ipAllocRule = ipAllocRule; - } + public void setIpUseRule(String ipUseRule) { + this.ipUseRule = ipUseRule; + } - @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(); - } + 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("machineRoomId", getMachineRoomId()).append("ipUseRule", getIpUseRule()) + .append("ipAllocRule", getIpAllocRule()).toString(); + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictDataMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictDataMapper.java index ad251fdea..c55d820f9 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictDataMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictDataMapper.java @@ -1,19 +1,19 @@ package com.ruoyi.system.mapper; -import java.util.List; -import org.apache.ibatis.annotations.Param; import com.ruoyi.system.domain.SysDictData; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 字典表 数据层 - * + * * @author ruoyi */ -public interface SysDictDataMapper -{ +public interface SysDictDataMapper { /** * 根据条件分页查询字典数据 - * + * * @param dictData 字典数据信息 * @return 字典数据集合信息 */ @@ -21,7 +21,7 @@ public interface SysDictDataMapper /** * 根据字典类型查询字典数据 - * + * * @param dictType 字典类型 * @return 字典数据集合信息 */ @@ -29,8 +29,8 @@ public interface SysDictDataMapper /** * 根据字典类型和字典键值查询字典数据信息 - * - * @param dictType 字典类型 + * + * @param dictType 字典类型 * @param dictValue 字典键值 * @return 字典标签 */ @@ -38,7 +38,7 @@ public interface SysDictDataMapper /** * 根据字典数据ID查询信息 - * + * * @param dictCode 字典数据ID * @return 字典数据 */ @@ -46,7 +46,7 @@ public interface SysDictDataMapper /** * 查询字典数据 - * + * * @param dictType 字典类型 * @return 字典数据 */ @@ -54,7 +54,7 @@ public interface SysDictDataMapper /** * 通过字典ID删除字典数据信息 - * + * * @param dictCode 字典数据ID * @return 结果 */ @@ -62,7 +62,7 @@ public interface SysDictDataMapper /** * 批量删除字典数据 - * + * * @param ids 需要删除的数据 * @return 结果 */ @@ -70,7 +70,7 @@ public interface SysDictDataMapper /** * 新增字典数据信息 - * + * * @param dictData 字典数据信息 * @return 结果 */ @@ -78,7 +78,7 @@ public interface SysDictDataMapper /** * 修改字典数据信息 - * + * * @param dictData 字典数据信息 * @return 结果 */ @@ -86,7 +86,7 @@ public interface SysDictDataMapper /** * 同步修改字典类型 - * + * * @param oldDictType 旧字典类型 * @param newDictType 新旧字典类型 * @return 结果 diff --git a/ruoyi-system/src/main/resources/mapper/network/NetIpAddressMapper.xml b/ruoyi-system/src/main/resources/mapper/network/NetIpAddressMapper.xml index e937cae00..6729a6691 100644 --- a/ruoyi-system/src/main/resources/mapper/network/NetIpAddressMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/network/NetIpAddressMapper.xml @@ -6,62 +6,71 @@ - + - + + + - 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 + - and ip_address_id = #{ipAddressId} - and ip_address_type = #{ipAddressType} + and ip_address_type = #{dictCode} and ip_address_section = #{ipAddressSection} - and maching_room_id = #{machingRoomId} + and machine_room_id = #{machineRoomId} and ip_use_rule = #{ipUseRule} and ip_alloc_rule = #{ipAllocRule} - where ip_address_id = #{ipAddressId} - + insert into net_ip_address - ip_address_type, + ip_address_type, ip_address_section, - maching_room_id, + machine_room_id, ip_use_rule, ip_alloc_rule, - #{ipAddressType}, + #{ipAddressType.dictCode}, #{ipAddressSection}, - #{machingRoomId}, + #{machineRoomId}, #{ipUseRule}, - #{ipAllocRule}, + #{ipAllocRule}, update net_ip_address - ip_address_type = #{ipAddressType}, + ip_address_type = #{ipAddressType.dictCode}, ip_address_section = #{ipAddressSection}, - maching_room_id = #{machingRoomId}, + machine_room_id = #{machineRoomId}, ip_use_rule = #{ipUseRule}, ip_alloc_rule = #{ipAllocRule}, @@ -69,12 +78,14 @@ - delete from net_ip_address where ip_address_id = #{ipAddressId} - + delete from + net_ip_address where ip_address_id = #{ipAddressId} + delete from net_ip_address where ip_address_id in - + #{ipAddressId}