界面提交一点点

This commit is contained in:
tangpeng 2019-06-12 00:39:23 +08:00
parent 62205847ec
commit e866cf9e7b
10 changed files with 186 additions and 180 deletions

View File

@ -18,98 +18,107 @@ import java.util.List;
/** /**
* 交换机模板 信息操作处理 * 交换机模板 信息操作处理
* *
* @author TP * @author TP
* @date 2019-06-11 * @date 2019-06-12
*/ */
@Controller @Controller
@RequestMapping("/template/switch") @RequestMapping("/template/switch")
public class SwitchController extends BaseController { public class SwitchController extends BaseController
private String prefix = "template/switch" ; {
private String prefix = "template/switch";
@Autowired
private ISwitchService switchService; @Autowired
private ISwitchService switchService;
@RequiresPermissions("template:switch:view")
@GetMapping() @RequiresPermissions("template:switch:view")
public String switchTemplate() { @GetMapping()
return prefix + "/switch" ; public String switchTemplate()
} {
return prefix + "/switch";
/** }
* 查询交换机模板列表
*/ /**
@RequiresPermissions("template:switch:list") * 查询交换机模板列表
@PostMapping("/list") */
@ResponseBody @RequiresPermissions("template:switch:list")
public TableDataInfo list(Switch switchTemplate) { @PostMapping("/list")
startPage(); @ResponseBody
public TableDataInfo list(Switch switchTemplate)
{
startPage();
List<Switch> list = switchService.selectSwitchList(switchTemplate); List<Switch> list = switchService.selectSwitchList(switchTemplate);
return getDataTable(list); return getDataTable(list);
} }
/** /**
* 导出交换机模板列表 * 导出交换机模板列表
*/ */
@RequiresPermissions("template:switch:export") @RequiresPermissions("template:switch:export")
@PostMapping("/export") @PostMapping("/export")
@ResponseBody @ResponseBody
public AjaxResult export(Switch switchTemplate) { public AjaxResult export(Switch switchTemplate)
List<Switch> list = switchService.selectSwitchList(switchTemplate); {
List<Switch> list = switchService.selectSwitchList(switchTemplate);
ExcelUtil<Switch> util = new ExcelUtil<Switch>(Switch.class); ExcelUtil<Switch> util = new ExcelUtil<Switch>(Switch.class);
return util.exportExcel(list, "switch"); 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") @GetMapping("/edit/{switchId}")
public String add() { public String edit(@PathVariable("switchId") Integer switchId, ModelMap mmap)
return prefix + "/add" ; {
} Switch switchTemplate = switchService.selectSwitchById(switchId);
mmap.put("switch", switchTemplate);
/** return prefix + "/edit";
* 新增保存交换机模板 }
*/
@RequiresPermissions("template:switch:add") /**
@Log(title = "交换机模板", businessType = BusinessType.INSERT) * 修改保存交换机模板
@PostMapping("/add") */
@ResponseBody @RequiresPermissions("template:switch:edit")
public AjaxResult addSave(Switch switchTemplate) { @Log(title = "交换机模板", businessType = BusinessType.UPDATE)
return toAjax(switchService.insertSwitch(switchTemplate)); @PostMapping("/edit")
} @ResponseBody
public AjaxResult editSave(Switch switchTemplate)
/** {
* 修改交换机模板 return toAjax(switchService.updateSwitch(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:remove")
} @Log(title = "交换机模板", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
/** @ResponseBody
* 修改保存交换机模板 public AjaxResult remove(String ids)
*/ {
@RequiresPermissions("template:switch:edit") return toAjax(switchService.deleteSwitchByIds(ids));
@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));
}
} }

View File

@ -76,7 +76,8 @@
}, },
{ {
field: 'dictCode', field: 'dictCode',
title: '字典编码' title: '字典编码',
visible: false
}, },
{ {
field: 'dictLabel', field: 'dictLabel',
@ -88,7 +89,8 @@
}, },
{ {
field: 'dictSort', field: 'dictSort',
title: '字典排序' title: '字典排序',
sortable: true
}, },
{ {
field: 'status', field: 'status',

View File

@ -9,13 +9,13 @@
<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="serverBrand" name="serverBrand" class="form-control" type="text"> <input id="switchBrand" name="switchBrand" 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="serverType" name="serverType" class="form-control" type="text"> <input id="switchType" name="switchType" class="form-control" type="text">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">

View File

@ -6,17 +6,17 @@
<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-switch-edit" th:object="${switch}"> <form class="form-horizontal m" id="form-switch-edit" th:object="${switch}">
<input id="serverId" name="serverId" th:field="*{serverId}" type="hidden"> <input id="switchId" name="switchId" th:field="*{switchId}" type="hidden">
<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="serverBrand" name="serverBrand" th:field="*{serverBrand}" class="form-control" type="text"> <input id="switchBrand" name="switchBrand" th:field="*{switchBrand}" 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="serverType" name="serverType" th:field="*{serverType}" class="form-control" type="text"> <input id="switchType" name="switchType" th:field="*{switchType}" class="form-control" type="text">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">

View File

@ -11,11 +11,11 @@
<div class="select-list"> <div class="select-list">
<ul> <ul>
<li> <li>
交换机品牌:<input type="text" name="serverBrand"/> 交换机品牌:<input type="text" name="switchBrand"/>
</li> </li>
<li> <li>
交换机型号:<input type="text" name="serverType"/> 交换机型号:<input type="text" name="switchType"/>
</li> </li>
<li> <li>
@ -69,17 +69,17 @@
checkbox: true checkbox: true
}, },
{ {
field : 'serverId', field : 'switchId',
title : '交换机模板编号', title : '交换机模板编号',
visible: false visible: false
}, },
{ {
field : 'serverBrand', field : 'switchBrand',
title : '交换机品牌', title : '交换机品牌',
sortable: true sortable: true
}, },
{ {
field : 'serverType', field : 'switchType',
title : '交换机型号', title : '交换机型号',
sortable: true sortable: true
}, },
@ -93,8 +93,8 @@
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.serverId + '\')"><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.switchId + '\')"><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.serverId + '\')"><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('');
} }
}] }]

View File

@ -8,47 +8,47 @@ import com.ruoyi.common.core.domain.BaseEntity;
* 交换机模板表 tmpl_switch * 交换机模板表 tmpl_switch
* *
* @author TP * @author TP
* @date 2019-06-11 * @date 2019-06-12
*/ */
public class Switch extends BaseEntity public class Switch extends BaseEntity
{ {
private static final long serialVersionUID = 1L; 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; 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) public void setPowerNum(Integer powerNum)
{ {
@ -60,12 +60,11 @@ public class Switch extends BaseEntity
return powerNum; return powerNum;
} }
@Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("serverId", getServerId()) .append("switchId", getSwitchId())
.append("serverBrand", getServerBrand()) .append("switchBrand", getSwitchBrand())
.append("serverType", getServerType()) .append("switchType", getSwitchType())
.append("powerNum", getPowerNum()) .append("powerNum", getPowerNum())
.toString(); .toString();
} }

View File

@ -1,63 +1,62 @@
package com.ruoyi.template.mapper; package com.ruoyi.template.mapper;
import java.util.List;
import com.ruoyi.template.domain.Switch; import com.ruoyi.template.domain.Switch;
import java.util.List;
/** /**
* 交换机模板 数据层 * 交换机模板 数据层
* *
* @author TP * @author TP
* @date 2019-06-11 * @date 2019-06-12
*/ */
public interface SwitchMapper public interface SwitchMapper
{ {
/** /**
* 查询交换机模板信息 * 查询交换机模板信息
* *
* @param serverId 交换机模板ID * @param switchId 交换机模板ID
* @return 交换机模板信息 * @return 交换机模板信息
*/ */
public Switch selectSwitchById(Integer serverId); public Switch selectSwitchById(Integer switchId);
/** /**
* 查询交换机模板列表 * 查询交换机模板列表
* *
* @param switchTmpl 交换机模板信息 * @param switchTemplate 交换机模板信息
* @return 交换机模板集合 * @return 交换机模板集合
*/ */
public List<Switch> selectSwitchList(Switch s); public List<Switch> selectSwitchList(Switch switchTemplate);
/** /**
* 新增交换机模板 * 新增交换机模板
* *
* @param switchTmpl 交换机模板信息 * @param switchTemplate 交换机模板信息
* @return 结果 * @return 结果
*/ */
public int insertSwitch(Switch switchTmpl); public int insertSwitch(Switch switchTemplate);
/** /**
* 修改交换机模板 * 修改交换机模板
* *
* @param switchTmpl 交换机模板信息 * @param switchTemplate 交换机模板信息
* @return 结果 * @return 结果
*/ */
public int updateSwitch(Switch switchTmpl); public int updateSwitch(Switch switchTemplate);
/** /**
* 删除交换机模板 * 删除交换机模板
* *
* @param serverId 交换机模板ID * @param switchId 交换机模板ID
* @return 结果 * @return 结果
*/ */
public int deleteSwitchById(Integer serverId); public int deleteSwitchById(Integer switchId);
/** /**
* 批量删除交换机模板 * 批量删除交换机模板
* *
* @param serverIds 需要删除的数据ID * @param switchIds 需要删除的数据ID
* @return 结果 * @return 结果
*/ */
public int deleteSwitchByIds(String[] serverIds); public int deleteSwitchByIds(String[] switchIds);
} }

View File

@ -1,48 +1,47 @@
package com.ruoyi.template.service; package com.ruoyi.template.service;
import java.util.List;
import com.ruoyi.template.domain.Switch; import com.ruoyi.template.domain.Switch;
import java.util.List;
/** /**
* 交换机模板 服务层 * 交换机模板 服务层
* *
* @author TP * @author TP
* @date 2019-06-11 * @date 2019-06-12
*/ */
public interface ISwitchService public interface ISwitchService
{ {
/** /**
* 查询交换机模板信息 * 查询交换机模板信息
* *
* @param serverId 交换机模板ID * @param switchId 交换机模板ID
* @return 交换机模板信息 * @return 交换机模板信息
*/ */
public Switch selectSwitchById(Integer serverId); public Switch selectSwitchById(Integer switchId);
/** /**
* 查询交换机模板列表 * 查询交换机模板列表
* *
* @param switchTmpl 交换机模板信息 * @param switchTemplate 交换机模板信息
* @return 交换机模板集合 * @return 交换机模板集合
*/ */
public List<Switch> selectSwitchList(Switch switchTmpl); public List<Switch> selectSwitchList(Switch switchTemplate);
/** /**
* 新增交换机模板 * 新增交换机模板
* *
* @param switchTmpl 交换机模板信息 * @param switchTemplate 交换机模板信息
* @return 结果 * @return 结果
*/ */
public int insertSwitch(Switch switchTmpl); public int insertSwitch(Switch switchTemplate);
/** /**
* 修改交换机模板 * 修改交换机模板
* *
* @param switchTmpl 交换机模板信息 * @param switchTemplate 交换机模板信息
* @return 结果 * @return 结果
*/ */
public int updateSwitch(Switch switchTmpl); public int updateSwitch(Switch switchTemplate);
/** /**
* 删除交换机模板信息 * 删除交换机模板信息

View File

@ -1,20 +1,18 @@
package com.ruoyi.template.service.impl; package com.ruoyi.template.service.impl;
import java.util.List; import java.util.List;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; 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.mapper.SwitchMapper;
import com.ruoyi.template.domain.Switch;
import com.ruoyi.template.service.ISwitchService; import com.ruoyi.template.service.ISwitchService;
import com.ruoyi.common.core.text.Convert;
/** /**
* 交换机模板 服务层实现 * 交换机模板 服务层实现
* *
* @author TP * @author TP
* @date 2019-06-11 * @date 2019-06-12
*/ */
@Service @Service
public class SwitchServiceImpl implements ISwitchService public class SwitchServiceImpl implements ISwitchService
@ -25,49 +23,49 @@ public class SwitchServiceImpl implements ISwitchService
/** /**
* 查询交换机模板信息 * 查询交换机模板信息
* *
* @param serverId 交换机模板ID * @param switchId 交换机模板ID
* @return 交换机模板信息 * @return 交换机模板信息
*/ */
@Override @Override
public Switch selectSwitchById(Integer serverId) public Switch selectSwitchById(Integer switchId)
{ {
return switchMapper.selectSwitchById(serverId); return switchMapper.selectSwitchById(switchId);
} }
/** /**
* 查询交换机模板列表 * 查询交换机模板列表
* *
* @param switchTempalte 交换机模板信息 * @param switchTemplate 交换机模板信息
* @return 交换机模板集合 * @return 交换机模板集合
*/ */
@Override @Override
public List<Switch> selectSwitchList(Switch switchTempalte) public List<Switch> selectSwitchList(Switch switchTemplate)
{ {
return switchMapper.selectSwitchList(switchTempalte); return switchMapper.selectSwitchList(switchTemplate);
} }
/** /**
* 新增交换机模板 * 新增交换机模板
* *
* @param switchTempalte 交换机模板信息 * @param switchTemplate 交换机模板信息
* @return 结果 * @return 结果
*/ */
@Override @Override
public int insertSwitch(Switch switchTempalte) public int insertSwitch(Switch switchTemplate)
{ {
return switchMapper.insertSwitch(switchTempalte); return switchMapper.insertSwitch(switchTemplate);
} }
/** /**
* 修改交换机模板 * 修改交换机模板
* *
* @param switchTempalte 交换机模板信息 * @param switchTemplate 交换机模板信息
* @return 结果 * @return 结果
*/ */
@Override @Override
public int updateSwitch(Switch switchTempalte) public int updateSwitch(Switch switchTemplate)
{ {
return switchMapper.updateSwitch(switchTempalte); return switchMapper.updateSwitch(switchTemplate);
} }
/** /**

View File

@ -5,41 +5,41 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<mapper namespace="com.ruoyi.template.mapper.SwitchMapper"> <mapper namespace="com.ruoyi.template.mapper.SwitchMapper">
<resultMap type="Switch" id="SwitchResult"> <resultMap type="Switch" id="SwitchResult">
<result property="serverId" column="server_id" /> <result property="switchId" column="switch_id" />
<result property="serverBrand" column="server_brand" /> <result property="switchBrand" column="switch_brand" />
<result property="serverType" column="server_type" /> <result property="switchType" column="switch_type" />
<result property="powerNum" column="power_num" /> <result property="powerNum" column="power_num" />
</resultMap> </resultMap>
<sql id="selectSwitchVo"> <sql id="selectSwitchVo">
select server_id, server_brand, server_type, power_num from tmpl_switch select switch_id, switch_brand, switch_type, power_num from tmpl_switch
</sql> </sql>
<select id="selectSwitchList" parameterType="Switch" resultMap="SwitchResult"> <select id="selectSwitchList" parameterType="Switch" resultMap="SwitchResult">
<include refid="selectSwitchVo"/> <include refid="selectSwitchVo"/>
<where> <where>
<if test="serverId != null "> and server_id = #{serverId}</if> <if test="switchId != null "> and switch_id = #{switchId}</if>
<if test="serverBrand != null and serverBrand != '' "> and server_brand = #{serverBrand}</if> <if test="switchBrand != null and switchBrand != '' "> and switch_brand = #{switchBrand}</if>
<if test="serverType != null and serverType != '' "> and server_type = #{serverType}</if> <if test="switchType != null and switchType != '' "> and switch_type = #{switchType}</if>
<if test="powerNum != null "> and power_num = #{powerNum}</if> <if test="powerNum != null "> and power_num = #{powerNum}</if>
</where> </where>
</select> </select>
<select id="selectSwitchById" parameterType="Integer" resultMap="SwitchResult"> <select id="selectSwitchById" parameterType="Integer" resultMap="SwitchResult">
<include refid="selectSwitchVo"/> <include refid="selectSwitchVo"/>
where server_id = #{serverId} where switch_id = #{switchId}
</select> </select>
<insert id="insertSwitch" parameterType="Switch" useGeneratedKeys="true" keyProperty="serverId"> <insert id="insertSwitch" parameterType="Switch" useGeneratedKeys="true" keyProperty="switchId">
insert into tmpl_switch insert into tmpl_switch
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="serverBrand != null and serverBrand != '' ">server_brand,</if> <if test="switchBrand != null and switchBrand != '' ">switch_brand,</if>
<if test="serverType != null and serverType != '' ">server_type,</if> <if test="switchType != null and switchType != '' ">switch_type,</if>
<if test="powerNum != null ">power_num,</if> <if test="powerNum != null ">power_num,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="serverBrand != null and serverBrand != '' ">#{serverBrand},</if> <if test="switchBrand != null and switchBrand != '' ">#{switchBrand},</if>
<if test="serverType != null and serverType != '' ">#{serverType},</if> <if test="switchType != null and switchType != '' ">#{switchType},</if>
<if test="powerNum != null ">#{powerNum},</if> <if test="powerNum != null ">#{powerNum},</if>
</trim> </trim>
</insert> </insert>
@ -47,21 +47,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="updateSwitch" parameterType="Switch"> <update id="updateSwitch" parameterType="Switch">
update tmpl_switch update tmpl_switch
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="serverBrand != null and serverBrand != '' ">server_brand = #{serverBrand},</if> <if test="switchBrand != null and switchBrand != '' ">switch_brand = #{switchBrand},</if>
<if test="serverType != null and serverType != '' ">server_type = #{serverType},</if> <if test="switchType != null and switchType != '' ">switch_type = #{switchType},</if>
<if test="powerNum != null ">power_num = #{powerNum},</if> <if test="powerNum != null ">power_num = #{powerNum},</if>
</trim> </trim>
where server_id = #{serverId} where switch_id = #{switchId}
</update> </update>
<delete id="deleteSwitchById" parameterType="Integer"> <delete id="deleteSwitchById" parameterType="Integer">
delete from tmpl_switch where server_id = #{serverId} delete from tmpl_switch where switch_id = #{switchId}
</delete> </delete>
<delete id="deleteSwitchByIds" parameterType="String"> <delete id="deleteSwitchByIds" parameterType="String">
delete from tmpl_switch where server_id in delete from tmpl_switch where switch_id in
<foreach item="serverId" collection="array" open="(" separator="," close=")"> <foreach item="switchId" collection="array" open="(" separator="," close=")">
#{serverId} #{switchId}
</foreach> </foreach>
</delete> </delete>