merge
This commit is contained in:
@@ -70,7 +70,15 @@ public class SysAuthorityControl {
|
||||
return JSONObjResult.toJSONObj(result);
|
||||
}
|
||||
|
||||
@LogInfo("根据父节点查询子节点(非递归)")
|
||||
@LogInfo("根据是否启用查询所有权限")
|
||||
@GetMapping("listByEnable")
|
||||
@ApiImplicitParam(name = "enable", value = "是否启用,格式Y|N", paramType = "query", dataType = "string")
|
||||
public JSONObject listByEnable(String enable) {
|
||||
List<SysAuthority> authoritys = sysAuthorityService.listByEnable(enable);
|
||||
return JSONObjResult.toJSONObj(authoritys, true, "");
|
||||
}
|
||||
|
||||
@LogInfo("根据父节点查询子节点")
|
||||
@GetMapping("listByParentId")
|
||||
@ApiImplicitParam(name = "parentId", value = "父id,可为空", paramType = "query", dataType = "string")
|
||||
public JSONObject listByParentId(String parentId) {
|
||||
@@ -82,19 +90,11 @@ public class SysAuthorityControl {
|
||||
return JSONObjResult.toJSONObj(queryByParentId, true, "");
|
||||
}
|
||||
|
||||
@LogInfo("根据是否启用查询所有权限")
|
||||
@GetMapping("listByEnable")
|
||||
@ApiImplicitParam(name = "enable", value = "是否启用,格式Y|N", paramType = "query", dataType = "string")
|
||||
public JSONObject listByEnable(String enable) {
|
||||
List<SysAuthority> authoritys = sysAuthorityService.listByEnable(enable);
|
||||
return JSONObjResult.toJSONObj(authoritys, true, "");
|
||||
}
|
||||
|
||||
@LogInfo("递归查询所有权限")
|
||||
@GetMapping("queryTree")
|
||||
@GetMapping("listTree")
|
||||
@ApiImplicitParam(name = "enable", value = "是否启用,格式Y|N", paramType = "query", dataType = "string")
|
||||
public JSONObject queryTree(String enable) {
|
||||
List<SysAuthVo> authoritys = sysAuthorityService.queryAllChildren(CommonConstant.ROOT, enable);
|
||||
public JSONObject listTree(String enable) {
|
||||
List<SysAuthVo> authoritys = sysAuthorityService.listChildren(CommonConstant.ROOT, enable);
|
||||
return JSONObjResult.toJSONObj(authoritys, true, "");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,9 +72,17 @@ public class SysRoleControl {
|
||||
return JSONObjResult.toJSONObj(sysRole, true, "");
|
||||
}
|
||||
|
||||
@LogInfo("根据是否启用查询所有角色")
|
||||
@GetMapping("listByEnable")
|
||||
@ApiImplicitParam(name = "enable", value = "是否启用,格式Y|N", paramType = "query", dataType = "string")
|
||||
public JSONObject listByEnable(String enable) {
|
||||
List<SysRole> sysRoles = sysRoleService.listAllByEnable(enable);
|
||||
return JSONObjResult.toJSONObj(sysRoles, true, "");
|
||||
}
|
||||
|
||||
@LogInfo("根据角色主键查找权限")
|
||||
@PostMapping("listAuthorityByRoleId")
|
||||
@ApiImplicitParam(name = "enable", value = "是否启用,格式Y|N", paramType = "query",dataType = "string")
|
||||
@ApiImplicitParam(name = "enable", value = "是否启用,格式Y|N", paramType = "query", dataType = "string")
|
||||
public JSONObject listAuthorityByRoleId(@RequestParam String roleId, String enable) {
|
||||
if (StringUtils.isEmpty(roleId))
|
||||
return JSONObjResult.toJSONObj("角色主键不能为空");
|
||||
@@ -106,12 +114,4 @@ public class SysRoleControl {
|
||||
RestMessage restMessage = sysRoleAuthorityService.saveBatch(list, roleId);
|
||||
return JSONObjResult.toJSONObj(restMessage);
|
||||
}
|
||||
|
||||
@LogInfo("根据是否启用查询所有角色")
|
||||
@GetMapping("listByEnable")
|
||||
@ApiImplicitParam(name = "enable", value = "是否启用,格式Y|N", paramType = "query",dataType = "string")
|
||||
public JSONObject listByEnable(String enable) {
|
||||
List<SysRole> sysRoles = sysRoleService.listAllByEnable(enable);
|
||||
return JSONObjResult.toJSONObj(sysRoles, true, "");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,9 +56,8 @@ public class SysUserControl {
|
||||
@LogInfo("删除用户")
|
||||
@GetMapping("removeById")
|
||||
public JSONObject removeById(@RequestParam String id) {
|
||||
if (StringUtils.isEmpty(id)) {
|
||||
if (StringUtils.isEmpty(id))
|
||||
return JSONObjResult.toJSONObj("主键不能为空");
|
||||
}
|
||||
RestMessage result = sysUserService.removeById(id);
|
||||
return JSONObjResult.toJSONObj(result);
|
||||
}
|
||||
@@ -66,9 +65,8 @@ public class SysUserControl {
|
||||
@LogInfo("修改用户信息")
|
||||
@PostMapping("update")
|
||||
public JSONObject update(@RequestBody @Valid SysUser sysUser) {
|
||||
if (StringUtils.isEmpty(sysUser.getId())) {
|
||||
if (StringUtils.isEmpty(sysUser.getId()))
|
||||
return JSONObjResult.toJSONObj("主键不能为空");
|
||||
}
|
||||
RestMessage result = sysUserService.update(sysUser);
|
||||
return JSONObjResult.toJSONObj(result);
|
||||
}
|
||||
@@ -76,13 +74,11 @@ public class SysUserControl {
|
||||
@LogInfo("获取用户详情")
|
||||
@GetMapping("getById")
|
||||
public JSONObject getById(@RequestParam String id) {
|
||||
if (StringUtils.isEmpty(id)) {
|
||||
if (StringUtils.isEmpty(id))
|
||||
return JSONObjResult.toJSONObj("主键不能为空");
|
||||
}
|
||||
SysUser sysUser = sysUserService.getOne(id);
|
||||
if (sysUser == null) {
|
||||
if (sysUser == null)
|
||||
return JSONObjResult.toJSONObj("未查到该对象");
|
||||
}
|
||||
return JSONObjResult.toJSONObj(sysUser, true, "");
|
||||
}
|
||||
|
||||
@@ -114,10 +110,10 @@ public class SysUserControl {
|
||||
@LogInfo("修改密码")
|
||||
@PostMapping("updatePassWord")
|
||||
public JSONObject updatePassWord(@RequestParam String newPassWord, @RequestParam String oldPassWord, @RequestParam String id) {
|
||||
if (StringUtils.isEmpty(newPassWord) || StringUtils.isEmpty(oldPassWord))
|
||||
return JSONObjResult.toJSONObj("原密码或新密码不能为空");
|
||||
if (StringUtils.isEmpty(id))
|
||||
return JSONObjResult.toJSONObj("主键不能为空");
|
||||
if (StringUtils.isEmpty(newPassWord) || StringUtils.isEmpty(oldPassWord))
|
||||
return JSONObjResult.toJSONObj("原密码或新密码不能为空");
|
||||
RestMessage restMessage = sysUserService.updatePassWord(newPassWord, oldPassWord, id);
|
||||
return JSONObjResult.toJSONObj(restMessage);
|
||||
}
|
||||
@@ -165,12 +161,10 @@ public class SysUserControl {
|
||||
if (StringUtils.isEmpty(userId))
|
||||
return JSONObjResult.toJSONObj("用户主键不能为空");
|
||||
SysUser old = sysUserService.getOne(userId);
|
||||
if (old == null) {
|
||||
if (old == null)
|
||||
return JSONObjResult.toJSONObj("该用户不存在");
|
||||
}
|
||||
if (CommonEnum.YesOrNoEnum.YES.getCode().equalsIgnoreCase(old.getAdmin())) {
|
||||
if (CommonEnum.YesOrNoEnum.YES.getCode().equalsIgnoreCase(old.getAdmin()))
|
||||
return JSONObjResult.toJSONObj("不能对管理员进行操作");
|
||||
}
|
||||
String ids[] = roleIds.split(",");
|
||||
List<SysUserRole> list = new ArrayList<>();
|
||||
for (String id : ids) {
|
||||
@@ -185,7 +179,7 @@ public class SysUserControl {
|
||||
|
||||
@LogInfo("根据用户主键查找所拥有的角色")
|
||||
@PostMapping("listRoleByUserId")
|
||||
@ApiImplicitParam(name = "enable", value = "是否启用,格式Y|N", paramType = "query",dataType = "string")
|
||||
@ApiImplicitParam(name = "enable", value = "是否启用,格式Y|N", paramType = "query", dataType = "string")
|
||||
public JSONObject listRoleByUserId(@RequestParam String userId, String enable) {
|
||||
if (StringUtils.isEmpty(userId))
|
||||
return JSONObjResult.toJSONObj("用户主键不能为空");
|
||||
@@ -195,8 +189,8 @@ public class SysUserControl {
|
||||
|
||||
@LogInfo("根据用户主键查找所拥有的权限")
|
||||
@PostMapping("listAuthorityByUserId")
|
||||
@ApiImplicitParam(name = "enable", value = "是否启用,格式Y|N", paramType = "query",dataType = "string")
|
||||
public JSONObject listAuthorityByUserId(@RequestParam String userId,String enable) {
|
||||
@ApiImplicitParam(name = "enable", value = "是否启用,格式Y|N", paramType = "query", dataType = "string")
|
||||
public JSONObject listAuthorityByUserId(@RequestParam String userId, String enable) {
|
||||
if (StringUtils.isEmpty(userId))
|
||||
return JSONObjResult.toJSONObj("用户主键不能为空");
|
||||
List<SysAuthority> list = sysUserService.queryAuthority(userId, enable);
|
||||
|
||||
Reference in New Issue
Block a user