From e866cf9e7b67121e0bf5bec0d46736bc1c8599dc Mon Sep 17 00:00:00 2001 From: tangpeng Date: Wed, 12 Jun 2019 00:39:23 +0800 Subject: [PATCH] =?UTF-8?q?=E7=95=8C=E9=9D=A2=E6=8F=90=E4=BA=A4=E4=B8=80?= =?UTF-8?q?=E7=82=B9=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/template/SwitchController.java | 175 +++++++++--------- .../templates/system/dict/data/data.html | 6 +- .../templates/template/switch/add.html | 4 +- .../templates/template/switch/edit.html | 6 +- .../templates/template/switch/switch.html | 14 +- .../com/ruoyi/template/domain/Switch.java | 39 ++-- .../ruoyi/template/mapper/SwitchMapper.java | 29 ++- .../template/service/ISwitchService.java | 21 +-- .../service/impl/SwitchServiceImpl.java | 32 ++-- .../mapper/template/SwitchMapper.xml | 40 ++-- 10 files changed, 186 insertions(+), 180 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/template/SwitchController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/template/SwitchController.java index 166fbf9cd..c2a99936f 100755 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/template/SwitchController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/template/SwitchController.java @@ -18,98 +18,107 @@ import java.util.List; /** * 交换机模板 信息操作处理 - * + * * @author TP - * @date 2019-06-11 + * @date 2019-06-12 */ @Controller @RequestMapping("/template/switch") -public class SwitchController extends BaseController { - private String prefix = "template/switch" ; - - @Autowired - private ISwitchService switchService; - - @RequiresPermissions("template:switch:view") - @GetMapping() - public String switchTemplate() { - return prefix + "/switch" ; - } - - /** - * 查询交换机模板列表 - */ - @RequiresPermissions("template:switch:list") - @PostMapping("/list") - @ResponseBody - public TableDataInfo list(Switch switchTemplate) { - startPage(); +public class SwitchController extends BaseController +{ + private String prefix = "template/switch"; + + @Autowired + private ISwitchService switchService; + + @RequiresPermissions("template:switch:view") + @GetMapping() + public String switchTemplate() + { + return prefix + "/switch"; + } + + /** + * 查询交换机模板列表 + */ + @RequiresPermissions("template:switch:list") + @PostMapping("/list") + @ResponseBody + public TableDataInfo list(Switch switchTemplate) + { + startPage(); List list = switchService.selectSwitchList(switchTemplate); - return getDataTable(list); - } - - - /** - * 导出交换机模板列表 - */ - @RequiresPermissions("template:switch:export") + return getDataTable(list); + } + + + /** + * 导出交换机模板列表 + */ + @RequiresPermissions("template:switch:export") @PostMapping("/export") @ResponseBody - public AjaxResult export(Switch switchTemplate) { - List list = switchService.selectSwitchList(switchTemplate); + public AjaxResult export(Switch switchTemplate) + { + List list = switchService.selectSwitchList(switchTemplate); ExcelUtil util = new ExcelUtil(Switch.class); return util.exportExcel(list, "switch"); } + + /** + * 新增交换机模板 + */ + @GetMapping("/add") + public String add() + { + return prefix + "/add"; + } + + /** + * 新增保存交换机模板 + */ + @RequiresPermissions("template:switch:add") + @Log(title = "交换机模板", businessType = BusinessType.INSERT) + @PostMapping("/add") + @ResponseBody + public AjaxResult addSave(Switch switchTemplate) + { + return toAjax(switchService.insertSwitch(switchTemplate)); + } - /** - * 新增交换机模板 - */ - @GetMapping("/add") - public String add() { - return prefix + "/add" ; - } - - /** - * 新增保存交换机模板 - */ - @RequiresPermissions("template:switch:add") - @Log(title = "交换机模板", businessType = BusinessType.INSERT) - @PostMapping("/add") - @ResponseBody - public AjaxResult addSave(Switch switchTemplate) { - return toAjax(switchService.insertSwitch(switchTemplate)); - } - - /** - * 修改交换机模板 - */ - @GetMapping("/edit/{serverId}") - public String edit(@PathVariable("serverId") Integer serverId, ModelMap mmap) { - Switch switchTemplate = switchService.selectSwitchById(serverId); - mmap.put("switch", switchTemplate); - return prefix + "/edit" ; - } - - /** - * 修改保存交换机模板 - */ - @RequiresPermissions("template:switch:edit") - @Log(title = "交换机模板", businessType = BusinessType.UPDATE) - @PostMapping("/edit") - @ResponseBody - public AjaxResult editSave(Switch switchTemplate) { - return toAjax(switchService.updateSwitch(switchTemplate)); - } - - /** - * 删除交换机模板 - */ - @RequiresPermissions("template:switch:remove") - @Log(title = "交换机模板", businessType = BusinessType.DELETE) - @PostMapping("/remove") - @ResponseBody - public AjaxResult remove(String ids) { - return toAjax(switchService.deleteSwitchByIds(ids)); - } - + /** + * 修改交换机模板 + */ + @GetMapping("/edit/{switchId}") + public String edit(@PathVariable("switchId") Integer switchId, ModelMap mmap) + { + Switch switchTemplate = switchService.selectSwitchById(switchId); + mmap.put("switch", switchTemplate); + return prefix + "/edit"; + } + + /** + * 修改保存交换机模板 + */ + @RequiresPermissions("template:switch:edit") + @Log(title = "交换机模板", businessType = BusinessType.UPDATE) + @PostMapping("/edit") + @ResponseBody + public AjaxResult editSave(Switch switchTemplate) + { + return toAjax(switchService.updateSwitch(switchTemplate)); + } + + /** + * 删除交换机模板 + */ + @RequiresPermissions("template:switch:remove") + @Log(title = "交换机模板", businessType = BusinessType.DELETE) + @PostMapping( "/remove") + @ResponseBody + public AjaxResult remove(String ids) + { + return toAjax(switchService.deleteSwitchByIds(ids)); + } + } diff --git a/ruoyi-admin/src/main/resources/templates/system/dict/data/data.html b/ruoyi-admin/src/main/resources/templates/system/dict/data/data.html index 4c2a39e8b..f41871b28 100644 --- a/ruoyi-admin/src/main/resources/templates/system/dict/data/data.html +++ b/ruoyi-admin/src/main/resources/templates/system/dict/data/data.html @@ -76,7 +76,8 @@ }, { field: 'dictCode', - title: '字典编码' + title: '字典编码', + visible: false }, { field: 'dictLabel', @@ -88,7 +89,8 @@ }, { field: 'dictSort', - title: '字典排序' + title: '字典排序', + sortable: true }, { field: 'status', diff --git a/ruoyi-admin/src/main/resources/templates/template/switch/add.html b/ruoyi-admin/src/main/resources/templates/template/switch/add.html index 1f8a75d19..f6a55ddea 100755 --- a/ruoyi-admin/src/main/resources/templates/template/switch/add.html +++ b/ruoyi-admin/src/main/resources/templates/template/switch/add.html @@ -9,13 +9,13 @@
- +
- +
diff --git a/ruoyi-admin/src/main/resources/templates/template/switch/edit.html b/ruoyi-admin/src/main/resources/templates/template/switch/edit.html index 9609ee35c..238238c0e 100755 --- a/ruoyi-admin/src/main/resources/templates/template/switch/edit.html +++ b/ruoyi-admin/src/main/resources/templates/template/switch/edit.html @@ -6,17 +6,17 @@
- +
- +
- +
diff --git a/ruoyi-admin/src/main/resources/templates/template/switch/switch.html b/ruoyi-admin/src/main/resources/templates/template/switch/switch.html index bc534d1bf..bcb01c9a7 100755 --- a/ruoyi-admin/src/main/resources/templates/template/switch/switch.html +++ b/ruoyi-admin/src/main/resources/templates/template/switch/switch.html @@ -11,11 +11,11 @@
  • - 交换机品牌: + 交换机品牌:
  • - 交换机型号: + 交换机型号:
  • @@ -69,17 +69,17 @@ checkbox: true }, { - field : 'serverId', + field : 'switchId', title : '交换机模板编号', visible: false }, { - field : 'serverBrand', + field : 'switchBrand', title : '交换机品牌', sortable: true }, { - field : 'serverType', + field : 'switchType', title : '交换机型号', sortable: true }, @@ -93,8 +93,8 @@ align: 'center', formatter: function(value, row, index) { var actions = []; - actions.push('编辑 '); - actions.push('删除'); + actions.push('编辑 '); + actions.push('删除'); return actions.join(''); } }] diff --git a/ruoyi-system/src/main/java/com/ruoyi/template/domain/Switch.java b/ruoyi-system/src/main/java/com/ruoyi/template/domain/Switch.java index 8f68a1c7b..c7894fd70 100755 --- a/ruoyi-system/src/main/java/com/ruoyi/template/domain/Switch.java +++ b/ruoyi-system/src/main/java/com/ruoyi/template/domain/Switch.java @@ -8,47 +8,47 @@ import com.ruoyi.common.core.domain.BaseEntity; * 交换机模板表 tmpl_switch * * @author TP - * @date 2019-06-11 + * @date 2019-06-12 */ public class Switch extends BaseEntity { private static final long serialVersionUID = 1L; /** 交换机模板编号 */ - private Integer serverId; + private Integer switchId; /** 交换机品牌 */ - private String serverBrand; + private String switchBrand; /** 交换机型号 */ - private String serverType; + private String switchType; /** 交换机电源数量 */ private Integer powerNum; - public void setServerId(Integer serverId) + public void setSwitchId(Integer switchId) { - this.serverId = serverId; + this.switchId = switchId; } - public Integer getServerId() + public Integer getSwitchId() { - return serverId; + return switchId; } - public void setServerBrand(String serverBrand) + public void setSwitchBrand(String switchBrand) { - this.serverBrand = serverBrand; + this.switchBrand = switchBrand; } - public String getServerBrand() + public String getSwitchBrand() { - return serverBrand; + return switchBrand; } - public void setServerType(String serverType) + public void setSwitchType(String switchType) { - this.serverType = serverType; + this.switchType = switchType; } - public String getServerType() + public String getSwitchType() { - return serverType; + return switchType; } public void setPowerNum(Integer powerNum) { @@ -60,12 +60,11 @@ public class Switch extends BaseEntity return powerNum; } - @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("serverId", getServerId()) - .append("serverBrand", getServerBrand()) - .append("serverType", getServerType()) + .append("switchId", getSwitchId()) + .append("switchBrand", getSwitchBrand()) + .append("switchType", getSwitchType()) .append("powerNum", getPowerNum()) .toString(); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/template/mapper/SwitchMapper.java b/ruoyi-system/src/main/java/com/ruoyi/template/mapper/SwitchMapper.java index 398b66d6c..c02cfd13e 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/template/mapper/SwitchMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/template/mapper/SwitchMapper.java @@ -1,63 +1,62 @@ package com.ruoyi.template.mapper; -import java.util.List; - import com.ruoyi.template.domain.Switch; +import java.util.List; /** * 交换机模板 数据层 * * @author TP - * @date 2019-06-11 + * @date 2019-06-12 */ public interface SwitchMapper { /** * 查询交换机模板信息 * - * @param serverId 交换机模板ID + * @param switchId 交换机模板ID * @return 交换机模板信息 */ - public Switch selectSwitchById(Integer serverId); + public Switch selectSwitchById(Integer switchId); /** * 查询交换机模板列表 * - * @param switchTmpl 交换机模板信息 + * @param switchTemplate 交换机模板信息 * @return 交换机模板集合 */ - public List selectSwitchList(Switch s); + public List selectSwitchList(Switch switchTemplate); /** * 新增交换机模板 * - * @param switchTmpl 交换机模板信息 + * @param switchTemplate 交换机模板信息 * @return 结果 */ - public int insertSwitch(Switch switchTmpl); + public int insertSwitch(Switch switchTemplate); /** * 修改交换机模板 * - * @param switchTmpl 交换机模板信息 + * @param switchTemplate 交换机模板信息 * @return 结果 */ - public int updateSwitch(Switch switchTmpl); + public int updateSwitch(Switch switchTemplate); /** * 删除交换机模板 * - * @param serverId 交换机模板ID + * @param switchId 交换机模板ID * @return 结果 */ - public int deleteSwitchById(Integer serverId); + public int deleteSwitchById(Integer switchId); /** * 批量删除交换机模板 * - * @param serverIds 需要删除的数据ID + * @param switchIds 需要删除的数据ID * @return 结果 */ - public int deleteSwitchByIds(String[] serverIds); + public int deleteSwitchByIds(String[] switchIds); } \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/template/service/ISwitchService.java b/ruoyi-system/src/main/java/com/ruoyi/template/service/ISwitchService.java index fa5644365..7004a028b 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/template/service/ISwitchService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/template/service/ISwitchService.java @@ -1,48 +1,47 @@ package com.ruoyi.template.service; -import java.util.List; - import com.ruoyi.template.domain.Switch; +import java.util.List; /** * 交换机模板 服务层 * * @author TP - * @date 2019-06-11 + * @date 2019-06-12 */ public interface ISwitchService { /** * 查询交换机模板信息 * - * @param serverId 交换机模板ID + * @param switchId 交换机模板ID * @return 交换机模板信息 */ - public Switch selectSwitchById(Integer serverId); + public Switch selectSwitchById(Integer switchId); /** * 查询交换机模板列表 * - * @param switchTmpl 交换机模板信息 + * @param switchTemplate 交换机模板信息 * @return 交换机模板集合 */ - public List selectSwitchList(Switch switchTmpl); + public List selectSwitchList(Switch switchTemplate); /** * 新增交换机模板 * - * @param switchTmpl 交换机模板信息 + * @param switchTemplate 交换机模板信息 * @return 结果 */ - public int insertSwitch(Switch switchTmpl); + public int insertSwitch(Switch switchTemplate); /** * 修改交换机模板 * - * @param switchTmpl 交换机模板信息 + * @param switchTemplate 交换机模板信息 * @return 结果 */ - public int updateSwitch(Switch switchTmpl); + public int updateSwitch(Switch switchTemplate); /** * 删除交换机模板信息 diff --git a/ruoyi-system/src/main/java/com/ruoyi/template/service/impl/SwitchServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/template/service/impl/SwitchServiceImpl.java index a5bf93d3b..15195e9e2 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/template/service/impl/SwitchServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/template/service/impl/SwitchServiceImpl.java @@ -1,20 +1,18 @@ package com.ruoyi.template.service.impl; import java.util.List; - import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; - -import com.ruoyi.common.core.text.Convert; -import com.ruoyi.template.domain.Switch; import com.ruoyi.template.mapper.SwitchMapper; +import com.ruoyi.template.domain.Switch; import com.ruoyi.template.service.ISwitchService; +import com.ruoyi.common.core.text.Convert; /** * 交换机模板 服务层实现 * * @author TP - * @date 2019-06-11 + * @date 2019-06-12 */ @Service public class SwitchServiceImpl implements ISwitchService @@ -25,49 +23,49 @@ public class SwitchServiceImpl implements ISwitchService /** * 查询交换机模板信息 * - * @param serverId 交换机模板ID + * @param switchId 交换机模板ID * @return 交换机模板信息 */ @Override - public Switch selectSwitchById(Integer serverId) + public Switch selectSwitchById(Integer switchId) { - return switchMapper.selectSwitchById(serverId); + return switchMapper.selectSwitchById(switchId); } /** * 查询交换机模板列表 * - * @param switchTempalte 交换机模板信息 + * @param switchTemplate 交换机模板信息 * @return 交换机模板集合 */ @Override - public List selectSwitchList(Switch switchTempalte) + public List selectSwitchList(Switch switchTemplate) { - return switchMapper.selectSwitchList(switchTempalte); + return switchMapper.selectSwitchList(switchTemplate); } /** * 新增交换机模板 * - * @param switchTempalte 交换机模板信息 + * @param switchTemplate 交换机模板信息 * @return 结果 */ @Override - public int insertSwitch(Switch switchTempalte) + public int insertSwitch(Switch switchTemplate) { - return switchMapper.insertSwitch(switchTempalte); + return switchMapper.insertSwitch(switchTemplate); } /** * 修改交换机模板 * - * @param switchTempalte 交换机模板信息 + * @param switchTemplate 交换机模板信息 * @return 结果 */ @Override - public int updateSwitch(Switch switchTempalte) + public int updateSwitch(Switch switchTemplate) { - return switchMapper.updateSwitch(switchTempalte); + return switchMapper.updateSwitch(switchTemplate); } /** diff --git a/ruoyi-system/src/main/resources/mapper/template/SwitchMapper.xml b/ruoyi-system/src/main/resources/mapper/template/SwitchMapper.xml index d0b90a896..048757b58 100755 --- a/ruoyi-system/src/main/resources/mapper/template/SwitchMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/template/SwitchMapper.xml @@ -5,41 +5,41 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - - - + + + - select server_id, server_brand, server_type, power_num from tmpl_switch + select switch_id, switch_brand, switch_type, power_num from tmpl_switch - + insert into tmpl_switch - server_brand, - server_type, + switch_brand, + switch_type, power_num, - #{serverBrand}, - #{serverType}, + #{switchBrand}, + #{switchType}, #{powerNum}, @@ -47,21 +47,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update tmpl_switch - server_brand = #{serverBrand}, - server_type = #{serverType}, + switch_brand = #{switchBrand}, + switch_type = #{switchType}, power_num = #{powerNum}, - where server_id = #{serverId} + where switch_id = #{switchId} - delete from tmpl_switch where server_id = #{serverId} + delete from tmpl_switch where switch_id = #{switchId} - delete from tmpl_switch where server_id in - - #{serverId} + delete from tmpl_switch where switch_id in + + #{switchId}