界面提交一点点

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
* @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<Switch> 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<Switch> list = switchService.selectSwitchList(switchTemplate);
public AjaxResult export(Switch switchTemplate)
{
List<Switch> list = switchService.selectSwitchList(switchTemplate);
ExcelUtil<Switch> util = new ExcelUtil<Switch>(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));
}
}

View File

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

View File

@ -9,13 +9,13 @@
<div class="form-group">
<label class="col-sm-3 control-label">交换机品牌:</label>
<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 class="form-group">
<label class="col-sm-3 control-label">交换机型号:</label>
<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 class="form-group">

View File

@ -6,17 +6,17 @@
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<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">
<label class="col-sm-3 control-label">交换机品牌:</label>
<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 class="form-group">
<label class="col-sm-3 control-label">交换机型号:</label>
<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 class="form-group">

View File

@ -11,11 +11,11 @@
<div class="select-list">
<ul>
<li>
交换机品牌:<input type="text" name="serverBrand"/>
交换机品牌:<input type="text" name="switchBrand"/>
</li>
<li>
交换机型号:<input type="text" name="serverType"/>
交换机型号:<input type="text" name="switchType"/>
</li>
<li>
@ -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('<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-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-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.switchId + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
}]

View File

@ -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();
}

View File

@ -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<Switch> selectSwitchList(Switch s);
public List<Switch> 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);
}

View File

@ -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<Switch> selectSwitchList(Switch switchTmpl);
public List<Switch> 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);
/**
* 删除交换机模板信息

View File

@ -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<Switch> selectSwitchList(Switch switchTempalte)
public List<Switch> 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);
}
/**

View File

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