This commit is contained in:
xiangwb
2017-11-15 14:06:09 +08:00
parent cbf6486631
commit 2e236d25b4
8 changed files with 41 additions and 103 deletions
@@ -70,7 +70,7 @@ public class SysAuthorityControl {
}
@LogInfo("根据父节点查询子节点(非递归)")
@PostMapping("listByParentId")
@GetMapping("listByParentId")
public JSONObject listByParentId(String parentId) {
if (StringUtils.isEmpty(parentId))
parentId = CommonConstant.ROOT;
@@ -81,16 +81,16 @@ public class SysAuthorityControl {
}
@LogInfo("根据是否启用查询所有权限")
@PostMapping("listAuthorityByEnable")
public JSONObject listAuthorityByEnable(@RequestParam String enable) {
if (StringUtils.isEmpty(enable))
return JSONObjResult.toJSONObj("是否启用不能为空");
@GetMapping("listAuthorityByEnable")
public JSONObject listAuthorityByEnable(String enable) {
// if (StringUtils.isEmpty(enable))
// return JSONObjResult.toJSONObj("是否启用不能为空");
List<SysAuthority> authoritys = sysAuthorityService.listByEnable(enable);
return JSONObjResult.toJSONObj(authoritys, true, "");
}
@LogInfo("递归查询所有权限")
@PostMapping("queryTree")
@GetMapping("queryTree")
public JSONObject queryTree(String enable) {
List<SysAuthVo> authoritys = sysAuthorityService.queryAllChildren(CommonConstant.ROOT, enable);
return JSONObjResult.toJSONObj(authoritys, true, "");
@@ -84,8 +84,8 @@ public class SysRoleControl {
}
@LogInfo("保存角色权限")
@PostMapping("saveAuthoritys")
public JSONObject saveAuthoritys(@RequestParam String authorityIds, @RequestParam String roleId) {
@PostMapping("saveAuthority")
public JSONObject saveAuthority(@RequestParam String authorityIds, @RequestParam String roleId) {
if (StringUtils.isEmpty(authorityIds))
return JSONObjResult.toJSONObj("权限主键集合不能为空");
if (StringUtils.isEmpty(roleId))
@@ -107,9 +107,9 @@ public class SysRoleControl {
@LogInfo("根据是否启用查询所有角色")
@GetMapping("listAllByEnable")
public JSONObject listAllByEnable(@RequestParam String enable) {
if (StringUtils.isEmpty(enable))
return JSONObjResult.toJSONObj("是否启用不能为空");
public JSONObject listAllByEnable(String enable) {
// if (StringUtils.isEmpty(enable))
// return JSONObjResult.toJSONObj("是否启用不能为空");
List<SysRole> sysRoles = sysRoleService.listAllByEnable(enable);
return JSONObjResult.toJSONObj(sysRoles, true, "");
}
@@ -183,23 +183,22 @@ public class SysUserControl {
}
@LogInfo("根据用户主键查找所拥有的角色")
@PostMapping("listRoles")
public JSONObject listRoles(@RequestParam String userId, @RequestParam String enable) {
@PostMapping("listRoleByUserId")
public JSONObject listRoleByUserId(@RequestParam String userId,String enable) {
if (StringUtils.isEmpty(userId))
return JSONObjResult.toJSONObj("用户主键不能为空");
if (StringUtils.isEmpty(enable))
return JSONObjResult.toJSONObj("是否启用不能为空");
// if (StringUtils.isEmpty(enable))
// return JSONObjResult.toJSONObj("是否启用不能为空");
List<SysRole> list = sysRoleService.listByUserIdEnable(userId, enable);
return JSONObjResult.toJSONObj(list, true, "");
}
@LogInfo("根据用户主键查找所拥有的权限")
@PostMapping("queryAuthority")
public JSONObject queryAuthority(@RequestParam String userId, @RequestParam String enable) {
@PostMapping("listAuthorityByUserId")
public JSONObject listAuthorityByUserId(@RequestParam String userId,String enable) {
if (StringUtils.isEmpty(userId))
return JSONObjResult.toJSONObj("用户主键不能为空");
List<SysAuthority> list = sysUserService.queryAuthority(userId,
enable);
List<SysAuthority> list = sysUserService.queryAuthority(userId, enable);
return JSONObjResult.toJSONObj(list, true, "");
}
}