diff --git a/boot-service/src/main/java/com/xwbing/entity/SysUser.java b/boot-service/src/main/java/com/xwbing/entity/SysUser.java index 79ab709..386578c 100644 --- a/boot-service/src/main/java/com/xwbing/entity/SysUser.java +++ b/boot-service/src/main/java/com/xwbing/entity/SysUser.java @@ -65,5 +65,5 @@ public class SysUser extends BaseEntity { private transient String modified; private transient String sexName; private transient List menuArray; - private transient List otherArray; + private transient List buttonArray; } diff --git a/boot-service/src/main/java/com/xwbing/service/SysAuthorityService.java b/boot-service/src/main/java/com/xwbing/service/SysAuthorityService.java index d9c3709..0117331 100644 --- a/boot-service/src/main/java/com/xwbing/service/SysAuthorityService.java +++ b/boot-service/src/main/java/com/xwbing/service/SysAuthorityService.java @@ -137,8 +137,6 @@ public class SysAuthorityService { * @return */ public List listByParentEnable(String parentId, String enable) { - if (StringUtils.isEmpty(parentId)) - parentId = CommonConstant.ROOT; if (StringUtils.isNotEmpty(enable)) return sysAuthorityRepository.getByParentIdAndEnable(parentId, enable); else @@ -155,7 +153,7 @@ public class SysAuthorityService { public List listByRoleIdEnable(String roleId, String enable) { List list = new ArrayList<>(); List roleAuthorities = sysRoleAuthorityService.listByRoleId(roleId); - if (CollectionUtils.isNotEmpty(roleAuthorities)) + if (CollectionUtils.isEmpty(roleAuthorities)) return list; List authorityIds = roleAuthorities.stream().map(SysRoleAuthority::getAuthorityId).collect(Collectors.toList()); if (CollectionUtils.isNotEmpty(authorityIds)) diff --git a/boot-service/src/main/java/com/xwbing/service/SysUserService.java b/boot-service/src/main/java/com/xwbing/service/SysUserService.java index 6c0c2bc..fab7e79 100644 --- a/boot-service/src/main/java/com/xwbing/service/SysUserService.java +++ b/boot-service/src/main/java/com/xwbing/service/SysUserService.java @@ -51,7 +51,8 @@ public class SysUserService { if (old != null) { throw new BusinessException("已经存在此用户名"); } - sysUser.setId(PassWordUtil.createId()); + String id=PassWordUtil.createId(); + sysUser.setId(id); sysUser.setCreateTime(new Date()); // 获取初始密码 String[] res = PassWordUtil.getUserSecret(null, null); @@ -70,6 +71,7 @@ public class SysUserService { throw new BusinessException("发送密码邮件错误"); } result.setSuccess(true); + result.setId(id); return result; } @@ -131,6 +133,7 @@ public class SysUserService { SysUser one = sysUserRepository.save(old); if (one != null) { result.setMessage("更新成功"); + result.setId(sysUser.getId()); result.setSuccess(true); } else { result.setMessage("更新失败"); diff --git a/boot-web/src/main/java/com/xwbing/controller/SysAuthorityControl.java b/boot-web/src/main/java/com/xwbing/controller/SysAuthorityControl.java index 37a2d6b..cf12ece 100644 --- a/boot-web/src/main/java/com/xwbing/controller/SysAuthorityControl.java +++ b/boot-web/src/main/java/com/xwbing/controller/SysAuthorityControl.java @@ -10,6 +10,7 @@ import com.xwbing.service.SysAuthorityService; import com.xwbing.util.JSONObjResult; import com.xwbing.util.RestMessage; import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; import org.apache.commons.lang3.StringUtils; import org.springframework.web.bind.annotation.*; @@ -71,6 +72,7 @@ public class SysAuthorityControl { @LogInfo("根据父节点查询子节点(非递归)") @GetMapping("listByParentId") + @ApiImplicitParam(name = "parentId", value = "父id,可为空", paramType = "query", dataType = "string") public JSONObject listByParentId(String parentId) { if (StringUtils.isEmpty(parentId)) parentId = CommonConstant.ROOT; @@ -81,16 +83,16 @@ public class SysAuthorityControl { } @LogInfo("根据是否启用查询所有权限") - @GetMapping("listAuthorityByEnable") - public JSONObject listAuthorityByEnable(String enable) { -// if (StringUtils.isEmpty(enable)) -// return JSONObjResult.toJSONObj("是否启用不能为空"); + @GetMapping("listByEnable") + @ApiImplicitParam(name = "enable", value = "是否启用,格式Y|N", paramType = "query", dataType = "string") + public JSONObject listByEnable(String enable) { List authoritys = sysAuthorityService.listByEnable(enable); return JSONObjResult.toJSONObj(authoritys, true, ""); } @LogInfo("递归查询所有权限") @GetMapping("queryTree") + @ApiImplicitParam(name = "enable", value = "是否启用,格式Y|N", paramType = "query", dataType = "string") public JSONObject queryTree(String enable) { List authoritys = sysAuthorityService.queryAllChildren(CommonConstant.ROOT, enable); return JSONObjResult.toJSONObj(authoritys, true, ""); diff --git a/boot-web/src/main/java/com/xwbing/controller/SysRoleControl.java b/boot-web/src/main/java/com/xwbing/controller/SysRoleControl.java index 26c9ab2..3286971 100644 --- a/boot-web/src/main/java/com/xwbing/controller/SysRoleControl.java +++ b/boot-web/src/main/java/com/xwbing/controller/SysRoleControl.java @@ -11,6 +11,7 @@ import com.xwbing.service.SysRoleService; import com.xwbing.util.JSONObjResult; import com.xwbing.util.RestMessage; import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; import org.apache.commons.lang3.StringUtils; import org.springframework.web.bind.annotation.*; @@ -73,6 +74,7 @@ public class SysRoleControl { @LogInfo("根据角色主键查找权限") @PostMapping("listAuthorityByRoleId") + @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,10 +108,9 @@ public class SysRoleControl { } @LogInfo("根据是否启用查询所有角色") - @GetMapping("listAllByEnable") - public JSONObject listAllByEnable(String enable) { -// if (StringUtils.isEmpty(enable)) -// return JSONObjResult.toJSONObj("是否启用不能为空"); + @GetMapping("listByEnable") + @ApiImplicitParam(name = "enable", value = "是否启用,格式Y|N", paramType = "query",dataType = "string") + public JSONObject listByEnable(String enable) { List sysRoles = sysRoleService.listAllByEnable(enable); return JSONObjResult.toJSONObj(sysRoles, true, ""); } diff --git a/boot-web/src/main/java/com/xwbing/controller/SysUserControl.java b/boot-web/src/main/java/com/xwbing/controller/SysUserControl.java index cf46c60..cc1f459 100644 --- a/boot-web/src/main/java/com/xwbing/controller/SysUserControl.java +++ b/boot-web/src/main/java/com/xwbing/controller/SysUserControl.java @@ -16,6 +16,7 @@ import com.xwbing.util.CommonDataUtil; import com.xwbing.util.JSONObjResult; import com.xwbing.util.RestMessage; import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.web.bind.annotation.*; @@ -136,7 +137,7 @@ public class SysUserControl { SysUser sysUser = sysUserService.getOne((String) CommonDataUtil.getToken(CommonConstant.CURRENT_USER_ID)); if (sysUser == null) return JSONObjResult.toJSONObj("未获取到当前登录用户信息"); - List other = new ArrayList<>(); + List button = new ArrayList<>(); List menu = new ArrayList<>(); List list; if (CommonEnum.YesOrNoEnum.YES.getCode().equalsIgnoreCase(sysUser.getAdmin())) @@ -148,11 +149,11 @@ public class SysUserControl { if (sysAuthority.getType() == CommonEnum.MenuOrButtonEnum.MENU.getCode()) menu.add(sysAuthority); else - other.add(sysAuthority); + button.add(sysAuthority); } } sysUser.setMenuArray(menu); - sysUser.setOtherArray(other); + sysUser.setButtonArray(button); return JSONObjResult.toJSONObj(sysUser, true, ""); } @@ -184,17 +185,17 @@ public class SysUserControl { @LogInfo("根据用户主键查找所拥有的角色") @PostMapping("listRoleByUserId") - public JSONObject listRoleByUserId(@RequestParam String userId,String enable) { + @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("用户主键不能为空"); -// if (StringUtils.isEmpty(enable)) -// return JSONObjResult.toJSONObj("是否启用不能为空"); List list = sysRoleService.listByUserIdEnable(userId, enable); return JSONObjResult.toJSONObj(list, true, ""); } @LogInfo("根据用户主键查找所拥有的权限") @PostMapping("listAuthorityByUserId") + @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("用户主键不能为空");