Commit f15bf0b7 by fengshuonan

角色管理修改页面

parent ede7696b
......@@ -28,6 +28,7 @@ import cn.stylefeng.guns.core.log.LogObjectHolder;
import cn.stylefeng.guns.core.util.CacheUtil;
import cn.stylefeng.guns.modular.system.entity.Role;
import cn.stylefeng.guns.modular.system.entity.User;
import cn.stylefeng.guns.modular.system.model.RoleDto;
import cn.stylefeng.guns.modular.system.service.RoleService;
import cn.stylefeng.guns.modular.system.service.UserService;
import cn.stylefeng.guns.modular.system.warpper.RoleWarpper;
......@@ -38,13 +39,11 @@ import cn.stylefeng.roses.kernel.model.exception.ServiceException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.validation.Valid;
import java.util.List;
import java.util.Map;
......@@ -130,11 +129,10 @@ public class RoleController extends BaseController {
@BussinessLog(value = "添加角色", key = "name", dict = RoleDict.class)
@Permission(Const.ADMIN_NAME)
@ResponseBody
public ResponseData add(@Valid Role role, BindingResult result) {
if (result.hasErrors()) {
throw new ServiceException(BizExceptionEnum.REQUEST_NULL);
}
public ResponseData add(Role role) {
role.setRoleId(null);
this.roleService.insert(role);
return SUCCESS_TIP;
}
......@@ -146,14 +144,15 @@ public class RoleController extends BaseController {
@BussinessLog(value = "修改角色", key = "name", dict = RoleDict.class)
@Permission(Const.ADMIN_NAME)
@ResponseBody
public ResponseData edit(@Valid Role role, BindingResult result) {
if (result.hasErrors()) {
throw new ServiceException(BizExceptionEnum.REQUEST_NULL);
}
this.roleService.updateById(role);
public ResponseData edit(RoleDto roleDto) {
Role old = this.roleService.selectById(roleDto.getRoleId());
BeanUtil.copyProperties(roleDto, old);
this.roleService.updateById(old);
//删除缓存
CacheUtil.removeAll(Cache.CONSTANT);
return SUCCESS_TIP;
}
......
......@@ -30,8 +30,8 @@ import cn.stylefeng.guns.core.shiro.ShiroKit;
import cn.stylefeng.guns.core.shiro.ShiroUser;
import cn.stylefeng.guns.modular.system.entity.User;
import cn.stylefeng.guns.modular.system.factory.UserFactory;
import cn.stylefeng.guns.modular.system.model.UserDto;
import cn.stylefeng.guns.modular.system.service.UserService;
import cn.stylefeng.guns.modular.system.transfer.UserDto;
import cn.stylefeng.guns.modular.system.warpper.UserWarpper;
import cn.stylefeng.roses.core.base.controller.BaseController;
import cn.stylefeng.roses.core.datascope.DataScope;
......
......@@ -19,7 +19,7 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUtil;
import cn.stylefeng.guns.core.common.constant.state.ManagerStatus;
import cn.stylefeng.guns.modular.system.entity.User;
import cn.stylefeng.guns.modular.system.transfer.UserDto;
import cn.stylefeng.guns.modular.system.model.UserDto;
import cn.stylefeng.roses.core.util.ToolUtil;
import org.springframework.beans.BeanUtils;
......
package cn.stylefeng.guns.modular.system.model;
import lombok.Data;
import java.io.Serializable;
/**
* 角色信息
*
* @author fengshuonan
* @Date 2018/12/8 18:16
*/
@Data
public class RoleDto implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
private Long roleId;
/**
* 父角色id
*/
private Long pid;
/**
* 角色名称
*/
private String name;
/**
* 提示
*/
private String description;
/**
* 序号
*/
private Integer sort;
}
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.stylefeng.guns.modular.system.transfer;
package cn.stylefeng.guns.modular.system.model;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
......
......@@ -28,8 +28,8 @@
<form class="form-horizontal form-material" id="loginform" action="${ctxPath}/login" method="post">
<h3 class="box-title m-b-30">Guns管理系统</h3>
@if(isNotEmpty(description)){
<h5 class="box-title m-b-30" style="color: red;">${description}</h5>
@if(isNotEmpty(tips)){
<h5 class="box-title m-b-30" style="color: red;">${tips}</h5>
@}
<div class="form-group ">
......
......@@ -25,16 +25,9 @@
</div>
<div class="col-6">
<div class="form-group">
<h5>部门名称 <span class="text-danger">*</span></h5>
<div class="controls">
<input v-model="deptName" id="detpName" \@click="showDeptSelectTree" type="text" class="form-control" autocomplete="off">
<input v-model="deptId" type="hidden" class="form-control">
</div>
</div>
<div class="form-group">
<h5>排序</h5>
<div class="controls">
<input v-model="num" type="text" class="form-control">
<input v-model="sort" type="text" class="form-control">
</div>
</div>
</div>
......
......@@ -25,16 +25,9 @@
</div>
<div class="col-6">
<div class="form-group">
<h5>部门名称 <span class="text-danger">*</span></h5>
<div class="controls">
<input v-model="deptName" id="detpName" \@click="showDeptSelectTree" type="text" class="form-control" autocomplete="off">
<input v-model="deptId" type="hidden" class="form-control">
</div>
</div>
<div class="form-group">
<h5>排序</h5>
<div class="controls">
<input v-model="num" type="text" class="form-control">
<input v-model="sort" type="text" class="form-control">
</div>
</div>
</div>
......
......@@ -7,9 +7,7 @@ var RoleAddDlg = {
pName: "",
pid: "",
description: "",
deptName: "",
deptId: "",
num: ""
sort: ""
}
};
......@@ -33,9 +31,6 @@ RoleAddDlg.validateForm = function () {
if (!(data.pName)) {
return "请输入上级名称";
}
if (!data.deptName) {
return "请输入部门名称";
}
if (!data.description) {
return "请输入别名";
}
......@@ -67,18 +62,6 @@ $(function () {
submitForm: function (e) {
e.preventDefault();
},
showDeptSelectTree: function () {
var formName = encodeURIComponent("parent.RoleAddDlg.app.deptName");
var formId = encodeURIComponent("parent.RoleAddDlg.app.deptId");
var treeUrl = encodeURIComponent(Feng.ctxPath + "/dept/tree");
layer.open({
type: 2,
title: '部门选择',
area: ['300px', '350px'],
content: Feng.ctxPath + '/system/commonTree?formName=' + formName + "&formId=" + formId + "&treeUrl=" + treeUrl
});
},
showParentSelectTree: function () {
var formName = encodeURIComponent("parent.RoleAddDlg.app.pName");
var formId = encodeURIComponent("parent.RoleAddDlg.app.pid");
......
......@@ -8,9 +8,7 @@ var RoleEditDlg = {
pName: "",
pid: "",
description: "",
deptName: "",
deptId: "",
num: ""
sort: ""
}
};
......@@ -34,9 +32,6 @@ RoleEditDlg.validateForm = function () {
if (!(data.pName)) {
return "请输入上级名称";
}
if (!data.deptName) {
return "请输入部门名称";
}
if (!data.description) {
return "请输入别名";
}
......@@ -73,18 +68,6 @@ $(function () {
submitForm: function (e) {
e.preventDefault();
},
showDeptSelectTree: function () {
var formName = encodeURIComponent("parent.RoleEditDlg.app.deptName");
var formId = encodeURIComponent("parent.RoleEditDlg.app.deptId");
var treeUrl = encodeURIComponent(Feng.ctxPath + "/dept/tree");
layer.open({
type: 2,
title: '部门选择',
area: ['300px', '350px'],
content: Feng.ctxPath + '/system/commonTree?formName=' + formName + "&formId=" + formId + "&treeUrl=" + treeUrl
});
},
showParentSelectTree: function () {
var formName = encodeURIComponent("parent.RoleEditDlg.app.pName");
var formId = encodeURIComponent("parent.RoleEditDlg.app.pid");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment