权限管理——by SmallQian(不得用于商业用途)
data : jsonStr, dataType :\,
success :function(data) {
if(data.returnMap==\){ alert(\职务创建成功\); }else{
alert(\职务已存在,该职务已更新\); } },
error :function() {
alert(\出错,请联系管理员!\); }
});//JQuery.ajax结束 }
//将json序列化对象转换为json序列化字符串 functiongetFormJson(form) { varo = {};
vara = $(form).serializeArray(); $.each(a, function() {
if(o[this.name] !== undefined) { if(!o[this.name].push) {
o[this.name] = [ o[this.name] ]; }
o[this.name].push(this.value || ''); } else {
o[this.name] = this.value || ''; } });
returno; }
2)在控制层(controller)新建WebMenuRoleContoller.java类
实现createRoleByForm请求
在WebMenuRoleContoller.java类中
@RequestMapping(value = \) @ResponseBody
public Map
版权所属——QQW.NULL
权限管理——by SmallQian(不得用于商业用途)
}
Map
3)在RoleAndMenuBiz中添加createRole抽象方法
4)在RoleAndMenuBizImpl中实现createRole抽象方法
@Transactional
public Map
Map
List
returnMap.put(\,\); }else {
userRoleDao.edit(userRole);
returnMap.put(\, \); }
returnreturnMap; }
版权所属——QQW.NULL
权限管理——by SmallQian(不得用于商业用途)
5)在数据层UserRoleDao添加getUserRoleList方法
6)在数据层UserRoleDaoImpl实现getUserRoleList方法
@Override
public List
(2)员工职务分配功能实现 1)roleSetView.jsp职务表请求后台数据
varpageSize;
varpageNumber; //表格数据填充方法
functionroleTabelInit(page){ pageNumber = page; pageSize =
$(\).find(\).text();
版权所属——QQW.NULL
权限管理——by SmallQian(不得用于商业用途)
$(\).find(\).remove(); jQuery.ajax({ type :\,
contentType :\, async :false, cache :false,
url :\, data :\,
dataType :\,
success :function(data) { console.log(data); if(data != null) {
$.each(data, function(index,item) { //遍历返回的json
if(index>=(page-1)*pageSize&&index<=(pageSize*page-1)){ varroleDiv = \btn-xs red-stripe ajaxify'
href='userPersonView/'+item.userId+'>\+item.roleName+\; varroleUserDiv =\;
varroleUsers = item.roleUser;
console.log(roleUsers!=\未分配改权限给员工\);
if(roleUsers!=\未分配改权限给员工\){ $.each(roleUsers,function(i,name) {
roleUserDiv +=\default btn-xs red-stripe ajaxify'
href='userPersonView/'+item.userId+'>\+name.userName+\; }); }else{
roleUserDiv = item.roleUser; }
$(\).append(''+roleDiv+''+roleUserDiv+''); } }); };
},
error :function() {
alert(\出错,请联系管理员!\); }
版权所属——QQW.NULL
权限管理——by SmallQian(不得用于商业用途)
});//JQuery.ajax结束 }
2)WebMenuRoleControllerr接受请求
// 获取职务列表
@RequestMapping(value = \) @ResponseBody
@SuppressWarnings({ \, \ }) public List getUserRoleList(){
System.out.println(\);
List returnList = roleAndMenuBiz.getUserRoleList(); return returnList; }
版权所属——QQW.NULL