完善基础代码(角色、权限),调整接口名称等
This commit is contained in:
parent
cabbd33c2c
commit
f00c289402
@ -0,0 +1,46 @@
|
||||
package ink.wgink.interfaces.role;
|
||||
|
||||
import ink.wgink.pojo.ListPage;
|
||||
import ink.wgink.pojo.dtos.role.RoleUserDTO;
|
||||
import ink.wgink.pojo.result.SuccessResultList;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: IRoleUserBaseService
|
||||
* @Description: 角色用户
|
||||
* @Author: WangGeng
|
||||
* @Date: 2021/2/18 11:36
|
||||
* @Version: 1.0
|
||||
**/
|
||||
public interface IRoleUserBaseService {
|
||||
|
||||
/**
|
||||
* 用户ID列表
|
||||
*
|
||||
* @param roleId 用户组ID
|
||||
* @return
|
||||
*/
|
||||
List<String> listUserId(String roleId);
|
||||
|
||||
/**
|
||||
* 用户ID列表
|
||||
*
|
||||
* @param roleIds 用户组ID列表
|
||||
* @return
|
||||
*/
|
||||
List<String> listUserId(List<String> roleIds);
|
||||
|
||||
/**
|
||||
* 分页用户组用户
|
||||
*
|
||||
* @param roleId
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
SuccessResultList<List<RoleUserDTO>> listPage(String roleId, ListPage page);
|
||||
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
package ink.wgink.interfaces.user;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: IRoleUserService
|
||||
* @Description: 角色用户
|
||||
* @Author: WangGeng
|
||||
* @Date: 2021/1/24 13:00
|
||||
* @Version: 1.0
|
||||
**/
|
||||
public interface IRoleUserService {
|
||||
}
|
@ -39,7 +39,7 @@ public class MenuDTO implements Serializable {
|
||||
private Integer menuType;
|
||||
@ApiModelProperty(name = "menuOrder", value = "菜单排序")
|
||||
private Integer menuOrder;
|
||||
@ApiModelProperty(name = "menuStatus", value = "菜单状态")
|
||||
@ApiModelProperty(name = "menuStatus", value = "菜 单状态")
|
||||
private Integer menuStatus;
|
||||
@ApiModelProperty(name = "openType", value = "打开方式")
|
||||
private Integer openType;
|
||||
|
@ -3,6 +3,8 @@ package ink.wgink.pojo.dtos.permission;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @ClassName: PermissionDTO
|
||||
* @Description: 权限
|
||||
@ -11,8 +13,9 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
* @Version: 1.0
|
||||
**/
|
||||
@ApiModel
|
||||
public class PermissionDTO {
|
||||
public class PermissionDTO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 8480319618037598206L;
|
||||
@ApiModelProperty(name = "permissionId", value = "主键")
|
||||
private String permissionId;
|
||||
@ApiModelProperty(name = "permissionTitle", value = "权限名称")
|
||||
@ -21,6 +24,8 @@ public class PermissionDTO {
|
||||
private String permissionType;
|
||||
@ApiModelProperty(name = "permissionUrl", value = "权限路径")
|
||||
private String permissionUrl;
|
||||
@ApiModelProperty(name = "apiTag", value = "api标识")
|
||||
private String apiTag;
|
||||
@ApiModelProperty(name = "systemTag", value = "系统标识")
|
||||
private String systemTag;
|
||||
@ApiModelProperty(name = "isPublic", value = "是否公共")
|
||||
@ -58,6 +63,14 @@ public class PermissionDTO {
|
||||
this.permissionUrl = permissionUrl;
|
||||
}
|
||||
|
||||
public String getApiTag() {
|
||||
return apiTag == null ? "" : apiTag.trim();
|
||||
}
|
||||
|
||||
public void setApiTag(String apiTag) {
|
||||
this.apiTag = apiTag;
|
||||
}
|
||||
|
||||
public String getSystemTag() {
|
||||
return systemTag == null ? "" : systemTag.trim();
|
||||
}
|
||||
@ -85,6 +98,8 @@ public class PermissionDTO {
|
||||
.append(permissionType).append('\"');
|
||||
sb.append(",\"permissionUrl\":\"")
|
||||
.append(permissionUrl).append('\"');
|
||||
sb.append(",\"apiTag\":\"")
|
||||
.append(apiTag).append('\"');
|
||||
sb.append(",\"systemTag\":\"")
|
||||
.append(systemTag).append('\"');
|
||||
sb.append(",\"isPublic\":")
|
||||
|
@ -0,0 +1,100 @@
|
||||
package ink.wgink.pojo.dtos.permission;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: PermissionGroupDTO
|
||||
* @Description: 权限分组
|
||||
* @Author: WangGeng
|
||||
* @Date: 2021/2/19 11:45
|
||||
* @Version: 1.0
|
||||
**/
|
||||
@ApiModel
|
||||
public class PermissionGroupDTO {
|
||||
|
||||
private String systemTag;
|
||||
private List<PermissionApiDTO> permissionApis;
|
||||
|
||||
public String getSystemTag() {
|
||||
return systemTag == null ? "" : systemTag.trim();
|
||||
}
|
||||
|
||||
public void setSystemTag(String systemTag) {
|
||||
this.systemTag = systemTag;
|
||||
}
|
||||
|
||||
public List<PermissionApiDTO> getPermissionApis() {
|
||||
if (permissionApis == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return permissionApis;
|
||||
}
|
||||
|
||||
public void setPermissionApis(List<PermissionApiDTO> permissionApis) {
|
||||
this.permissionApis = permissionApis;
|
||||
}
|
||||
|
||||
@ApiModel
|
||||
public static class PermissionApiDTO {
|
||||
private String systemTag;
|
||||
private String apiTag;
|
||||
private List<PermissionDTO> permissions;
|
||||
|
||||
public String getSystemTag() {
|
||||
return systemTag == null ? "" : systemTag.trim();
|
||||
}
|
||||
|
||||
public void setSystemTag(String systemTag) {
|
||||
this.systemTag = systemTag;
|
||||
}
|
||||
|
||||
public String getApiTag() {
|
||||
return apiTag == null ? "" : apiTag.trim();
|
||||
}
|
||||
|
||||
public void setApiTag(String apiTag) {
|
||||
this.apiTag = apiTag;
|
||||
}
|
||||
|
||||
public List<PermissionDTO> getPermissions() {
|
||||
if (permissions == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return permissions;
|
||||
}
|
||||
|
||||
public void setPermissions(List<PermissionDTO> permissions) {
|
||||
this.permissions = permissions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuilder sb = new StringBuilder("{");
|
||||
sb.append("\"systemTag\":\"")
|
||||
.append(systemTag).append('\"');
|
||||
sb.append(",\"apiTag\":\"")
|
||||
.append(apiTag).append('\"');
|
||||
sb.append(",\"permissions\":")
|
||||
.append(permissions);
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuilder sb = new StringBuilder("{");
|
||||
sb.append("\"systemTag\":\"")
|
||||
.append(systemTag).append('\"');
|
||||
sb.append(",\"permissionApis\":")
|
||||
.append(permissionApis);
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,100 @@
|
||||
package ink.wgink.pojo.dtos.permission;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: PermissionSystemApiDTO
|
||||
* @Description: 系统api
|
||||
* @Author: WangGeng
|
||||
* @Date: 2021/2/24 16:35
|
||||
* @Version: 1.0
|
||||
**/
|
||||
@ApiModel
|
||||
public class SystemApiDTO {
|
||||
|
||||
@ApiModelProperty(name = "systemTag", value = "系统标识")
|
||||
private String systemTag;
|
||||
@ApiModelProperty(name = "apis", value = "接口列表")
|
||||
private List<ApiDTO> apis;
|
||||
|
||||
public String getSystemTag() {
|
||||
return systemTag == null ? "" : systemTag.trim();
|
||||
}
|
||||
|
||||
public void setSystemTag(String systemTag) {
|
||||
this.systemTag = systemTag;
|
||||
}
|
||||
|
||||
public List<ApiDTO> getApis() {
|
||||
if (apis == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return apis;
|
||||
}
|
||||
|
||||
public void setApis(List<ApiDTO> apis) {
|
||||
this.apis = apis;
|
||||
}
|
||||
|
||||
@ApiModel
|
||||
public static class ApiDTO {
|
||||
@ApiModelProperty(name = "api", value = "接口")
|
||||
private String api;
|
||||
@ApiModelProperty(name = "apiName", value = "接口名称")
|
||||
private String apiName;
|
||||
@ApiModelProperty(name = "apiTag", value = "api标识")
|
||||
private String apiTag;
|
||||
|
||||
public ApiDTO(String api, String apiName, String apiTag) {
|
||||
this.api = api;
|
||||
this.apiName = apiName;
|
||||
this.apiTag = apiTag;
|
||||
}
|
||||
|
||||
public String getApi() {
|
||||
return api == null ? "" : api.trim();
|
||||
}
|
||||
|
||||
public void setApi(String api) {
|
||||
this.api = api;
|
||||
}
|
||||
|
||||
public String getApiName() {
|
||||
return apiName == null ? "" : apiName.trim();
|
||||
}
|
||||
|
||||
public void setApiName(String apiName) {
|
||||
this.apiName = apiName;
|
||||
}
|
||||
|
||||
public String getApiTag() {
|
||||
return apiTag == null ? "" : apiTag.trim();
|
||||
}
|
||||
|
||||
public void setApiTag(String apiTag) {
|
||||
this.apiTag = apiTag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuilder sb = new StringBuilder("{");
|
||||
sb.append("\"api\":\"")
|
||||
.append(api).append('\"');
|
||||
sb.append(",\"apiName\":\"")
|
||||
.append(apiName).append('\"');
|
||||
sb.append(",\"apiTag\":\"")
|
||||
.append(apiTag).append('\"');
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -31,8 +31,8 @@ public class RoleDTO implements Serializable {
|
||||
private String roleSummary;
|
||||
@ApiModelProperty(name = "roleCode", value = "角色编码")
|
||||
private String roleCode;
|
||||
@ApiModelProperty(name = "roleDataAuthority", value = "角色数据类型")
|
||||
private String roleDataAuthority;
|
||||
@ApiModelProperty(name = "roleDataRight", value = "角色数据类型")
|
||||
private String roleDataRight;
|
||||
@ApiModelProperty(name = "subRoles", value = "子角色列表")
|
||||
private List<RoleDTO> subRoles;
|
||||
|
||||
@ -92,12 +92,12 @@ public class RoleDTO implements Serializable {
|
||||
this.roleCode = roleCode;
|
||||
}
|
||||
|
||||
public String getRoleDataAuthority() {
|
||||
return roleDataAuthority == null ? "" : roleDataAuthority.trim();
|
||||
public String getRoleDataRight() {
|
||||
return roleDataRight == null ? "" : roleDataRight.trim();
|
||||
}
|
||||
|
||||
public void setRoleDataAuthority(String roleDataAuthority) {
|
||||
this.roleDataAuthority = roleDataAuthority;
|
||||
public void setRoleDataRight(String roleDataRight) {
|
||||
this.roleDataRight = roleDataRight;
|
||||
}
|
||||
|
||||
public List<RoleDTO> getSubRoles() {
|
||||
@ -126,7 +126,7 @@ public class RoleDTO implements Serializable {
|
||||
sb.append(",\"roleCode\":")
|
||||
.append("\"").append(roleCode).append("\"");
|
||||
sb.append(",\"roleDataAuthority\":")
|
||||
.append("\"").append(roleDataAuthority).append("\"");
|
||||
.append("\"").append(roleDataRight).append("\"");
|
||||
sb.append(",\"subRoles\":")
|
||||
.append(subRoles);
|
||||
sb.append('}');
|
||||
|
@ -1,50 +0,0 @@
|
||||
package ink.wgink.pojo.dtos.role;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: RoleDataAuthorityTypeDTO
|
||||
* @Description: 权限类型
|
||||
* @Author: WangGeng
|
||||
* @Date: 2019/11/25 6:02 下午
|
||||
* @Version: 1.0
|
||||
**/
|
||||
@ApiModel
|
||||
public class RoleDataAuthorityTypeDTO {
|
||||
|
||||
@ApiModelProperty(name = "roleDataAuthorityType", value = "数据权限类型")
|
||||
private String roleDataAuthorityType;
|
||||
@ApiModelProperty(name = "roleDataAuthority", value = "数据权限")
|
||||
private String roleDataAuthority;
|
||||
|
||||
public String getRoleDataAuthorityType() {
|
||||
return roleDataAuthorityType == null ? "" : roleDataAuthorityType.trim();
|
||||
}
|
||||
|
||||
public void setRoleDataAuthorityType(String roleDataAuthorityType) {
|
||||
this.roleDataAuthorityType = roleDataAuthorityType;
|
||||
}
|
||||
|
||||
public String getRoleDataAuthority() {
|
||||
return roleDataAuthority == null ? "" : roleDataAuthority.trim();
|
||||
}
|
||||
|
||||
public void setRoleDataAuthority(String roleDataAuthority) {
|
||||
this.roleDataAuthority = roleDataAuthority;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuilder sb = new StringBuilder("{");
|
||||
sb.append("\"roleDataAuthorityType\":")
|
||||
.append("\"").append(roleDataAuthorityType).append("\"");
|
||||
sb.append(",\"roleDataAuthority\":")
|
||||
.append("\"").append(roleDataAuthority).append("\"");
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
@ -16,13 +16,11 @@ import java.io.Serializable;
|
||||
* @Version: 1.0
|
||||
**/
|
||||
@ApiModel
|
||||
public class RoleDataAuthorityDTO implements Serializable {
|
||||
public class RoleDataRightDTO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -537349124664914120L;
|
||||
@ApiModelProperty(name = "roleId", value = "角色ID")
|
||||
private String roleId;
|
||||
@ApiModelProperty(name = "departmentId", value = "部门ID")
|
||||
private String departmentId;
|
||||
@ApiModelProperty(name = "userId", value = "人员ID")
|
||||
private String userId;
|
||||
|
||||
@ -34,14 +32,6 @@ public class RoleDataAuthorityDTO implements Serializable {
|
||||
this.roleId = roleId;
|
||||
}
|
||||
|
||||
public String getDepartmentId() {
|
||||
return departmentId == null ? "" : departmentId.trim();
|
||||
}
|
||||
|
||||
public void setDepartmentId(String departmentId) {
|
||||
this.departmentId = departmentId;
|
||||
}
|
||||
|
||||
public String getUserId() {
|
||||
return userId == null ? "" : userId.trim();
|
||||
}
|
||||
@ -55,8 +45,6 @@ public class RoleDataAuthorityDTO implements Serializable {
|
||||
final StringBuilder sb = new StringBuilder("{");
|
||||
sb.append("\"roleId\":")
|
||||
.append("\"").append(roleId).append("\"");
|
||||
sb.append(",\"departmentId\":")
|
||||
.append("\"").append(departmentId).append("\"");
|
||||
sb.append(",\"userId\":")
|
||||
.append("\"").append(userId).append("\"");
|
||||
sb.append('}');
|
@ -0,0 +1,56 @@
|
||||
package ink.wgink.pojo.dtos.role;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: RoleDataAuthorityTypeDTO
|
||||
* @Description: 权限类型
|
||||
* @Author: WangGeng
|
||||
* @Date: 2019/11/25 6:02 下午
|
||||
* @Version: 1.0
|
||||
**/
|
||||
@ApiModel
|
||||
public class RoleDataRightInfoDTO {
|
||||
|
||||
@ApiModelProperty(name = "roleDataRight", value = "数据权限")
|
||||
private String roleDataRight;
|
||||
@ApiModelProperty(name = "userIds", value = "数据权限")
|
||||
private List<String> userIds;
|
||||
|
||||
public String getRoleDataRight() {
|
||||
return roleDataRight == null ? "" : roleDataRight.trim();
|
||||
}
|
||||
|
||||
public void setRoleDataRight(String roleDataRight) {
|
||||
this.roleDataRight = roleDataRight;
|
||||
}
|
||||
|
||||
public List<String> getUserIds() {
|
||||
if (userIds == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return userIds;
|
||||
}
|
||||
|
||||
public void setUserIds(List<String> userIds) {
|
||||
this.userIds = userIds;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuilder sb = new StringBuilder("{");
|
||||
sb.append("\"roleDataRight\":\"")
|
||||
.append(roleDataRight).append('\"');
|
||||
sb.append(",\"userIds\":")
|
||||
.append(userIds);
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package ink.wgink.pojo.dtos.role;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: RoleMenuDTO
|
||||
* @Description: 角色菜单
|
||||
* @Author: WangGeng
|
||||
* @Date: 2021/2/24 8:31
|
||||
* @Version: 1.0
|
||||
**/
|
||||
@ApiModel
|
||||
public class RoleMenuDTO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 5517176078321727490L;
|
||||
|
||||
@ApiModelProperty(name = "roleId", value = "角色ID")
|
||||
private String roleId;
|
||||
@ApiModelProperty(name = "menuId", value = "菜单ID")
|
||||
private String menuId;
|
||||
|
||||
public String getRoleId() {
|
||||
return roleId == null ? "" : roleId.trim();
|
||||
}
|
||||
|
||||
public void setRoleId(String roleId) {
|
||||
this.roleId = roleId;
|
||||
}
|
||||
|
||||
public String getMenuId() {
|
||||
return menuId == null ? "" : menuId.trim();
|
||||
}
|
||||
|
||||
public void setMenuId(String menuId) {
|
||||
this.menuId = menuId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuilder sb = new StringBuilder("{");
|
||||
sb.append("\"roleId\":\"")
|
||||
.append(roleId).append('\"');
|
||||
sb.append(",\"menuId\":\"")
|
||||
.append(menuId).append('\"');
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
@ -4,6 +4,10 @@ import ink.wgink.pojo.dtos.permission.PermissionDTO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName: PermissionDTO
|
||||
* @Description: 权限
|
||||
@ -12,10 +16,17 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
* @Version: 1.0
|
||||
**/
|
||||
@ApiModel
|
||||
public class RolePermissionDTO extends PermissionDTO {
|
||||
public class RolePermissionDTO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 2694431497469393859L;
|
||||
@ApiModelProperty(name = "roleId", value = "角色ID")
|
||||
private String roleId;
|
||||
@ApiModelProperty(name = "apiTag", value = "系统标识")
|
||||
private String apiTag;
|
||||
@ApiModelProperty(name = "permissionId", value = "权限ID")
|
||||
private String permissionId;
|
||||
@ApiModelProperty(name = "permissionType", value = "权限类型")
|
||||
private String permissionType;
|
||||
|
||||
public String getRoleId() {
|
||||
return roleId == null ? "" : roleId.trim();
|
||||
@ -25,11 +36,41 @@ public class RolePermissionDTO extends PermissionDTO {
|
||||
this.roleId = roleId;
|
||||
}
|
||||
|
||||
public String getApiTag() {
|
||||
return apiTag == null ? "" : apiTag.trim();
|
||||
}
|
||||
|
||||
public void setApiTag(String apiTag) {
|
||||
this.apiTag = apiTag;
|
||||
}
|
||||
|
||||
public String getPermissionId() {
|
||||
return permissionId == null ? "" : permissionId.trim();
|
||||
}
|
||||
|
||||
public void setPermissionId(String permissionId) {
|
||||
this.permissionId = permissionId;
|
||||
}
|
||||
|
||||
public String getPermissionType() {
|
||||
return permissionType == null ? "" : permissionType.trim();
|
||||
}
|
||||
|
||||
public void setPermissionType(String permissionType) {
|
||||
this.permissionType = permissionType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuilder sb = new StringBuilder("{");
|
||||
sb.append("\"roleId\":")
|
||||
.append("\"").append(roleId).append("\"");
|
||||
sb.append("\"roleId\":\"")
|
||||
.append(roleId).append('\"');
|
||||
sb.append(",\"apiTag\":\"")
|
||||
.append(apiTag).append('\"');
|
||||
sb.append(",\"permissionId\":\"")
|
||||
.append(permissionId).append('\"');
|
||||
sb.append(",\"permissionType\":\"")
|
||||
.append(permissionType).append('\"');
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
|
@ -0,0 +1,154 @@
|
||||
package ink.wgink.pojo.dtos.role;
|
||||
|
||||
import ink.wgink.pojo.dtos.user.UserDTO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: RoleUserDTO
|
||||
* @Description: 角色用户
|
||||
* @Author: WangGeng
|
||||
* @Date: 2021/2/18 11:31
|
||||
* @Version: 1.0
|
||||
**/
|
||||
@ApiModel
|
||||
public class RoleUserDTO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -1587518239154577015L;
|
||||
private String userId;
|
||||
private String groupId;
|
||||
private String userUsername;
|
||||
private String userName;
|
||||
private String userPhone;
|
||||
private String userEmail;
|
||||
private String groupName;
|
||||
private Integer userType;
|
||||
private Integer userState;
|
||||
private String userAvatar;
|
||||
|
||||
public RoleUserDTO() {
|
||||
|
||||
}
|
||||
|
||||
public RoleUserDTO(UserDTO userDTO) {
|
||||
this.userId = userDTO.getUserId();
|
||||
this.userUsername = userDTO.getUserUsername();
|
||||
this.userName = userDTO.getUserName();
|
||||
this.userPhone = userDTO.getUserPhone();
|
||||
this.userEmail = userDTO.getUserEmail();
|
||||
this.userType = userDTO.getUserType();
|
||||
this.userState = userDTO.getUserState();
|
||||
this.userAvatar = userDTO.getUserAvatar();
|
||||
}
|
||||
|
||||
public String getUserId() {
|
||||
return userId == null ? "" : userId.trim();
|
||||
}
|
||||
|
||||
public void setUserId(String userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getGroupId() {
|
||||
return groupId == null ? "" : groupId.trim();
|
||||
}
|
||||
|
||||
public void setGroupId(String groupId) {
|
||||
this.groupId = groupId;
|
||||
}
|
||||
|
||||
public String getUserUsername() {
|
||||
return userUsername == null ? "" : userUsername.trim();
|
||||
}
|
||||
|
||||
public void setUserUsername(String userUsername) {
|
||||
this.userUsername = userUsername;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName == null ? "" : userName.trim();
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public String getUserPhone() {
|
||||
return userPhone == null ? "" : userPhone.trim();
|
||||
}
|
||||
|
||||
public void setUserPhone(String userPhone) {
|
||||
this.userPhone = userPhone;
|
||||
}
|
||||
|
||||
public String getUserEmail() {
|
||||
return userEmail == null ? "" : userEmail.trim();
|
||||
}
|
||||
|
||||
public void setUserEmail(String userEmail) {
|
||||
this.userEmail = userEmail;
|
||||
}
|
||||
|
||||
public String getGroupName() {
|
||||
return groupName == null ? "" : groupName.trim();
|
||||
}
|
||||
|
||||
public void setGroupName(String groupName) {
|
||||
this.groupName = groupName;
|
||||
}
|
||||
|
||||
public Integer getUserType() {
|
||||
return userType;
|
||||
}
|
||||
|
||||
public void setUserType(Integer userType) {
|
||||
this.userType = userType;
|
||||
}
|
||||
|
||||
public Integer getUserState() {
|
||||
return userState;
|
||||
}
|
||||
|
||||
public void setUserState(Integer userState) {
|
||||
this.userState = userState;
|
||||
}
|
||||
|
||||
public String getUserAvatar() {
|
||||
return userAvatar == null ? "" : userAvatar.trim();
|
||||
}
|
||||
|
||||
public void setUserAvatar(String userAvatar) {
|
||||
this.userAvatar = userAvatar;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuilder sb = new StringBuilder("{");
|
||||
sb.append("\"userId\":\"")
|
||||
.append(userId).append('\"');
|
||||
sb.append(",\"groupId\":\"")
|
||||
.append(groupId).append('\"');
|
||||
sb.append(",\"userUsername\":\"")
|
||||
.append(userUsername).append('\"');
|
||||
sb.append(",\"userName\":\"")
|
||||
.append(userName).append('\"');
|
||||
sb.append(",\"userPhone\":\"")
|
||||
.append(userPhone).append('\"');
|
||||
sb.append(",\"userEmail\":\"")
|
||||
.append(userEmail).append('\"');
|
||||
sb.append(",\"groupName\":\"")
|
||||
.append(groupName).append('\"');
|
||||
sb.append(",\"userType\":")
|
||||
.append(userType);
|
||||
sb.append(",\"userState\":")
|
||||
.append(userState);
|
||||
sb.append(",\"userAvatar\":\"")
|
||||
.append(userAvatar).append('\"');
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package ink.wgink.util;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
@ -78,6 +79,10 @@ public class RegexUtil {
|
||||
* 强密码
|
||||
*/
|
||||
private static final Pattern PASSWORD_STRONG = Pattern.compile(String.format("(?=.*[A-Za-z])(?=.*[0-9])(?=.*[%s]).{%d,%d}", SPECIAL_CHARACTERS, PASSWORD_LENGTH_MIN, PASSWORD_LENGTH_MAX));
|
||||
/**
|
||||
* 路径参数
|
||||
*/
|
||||
private static final Pattern PATH_PARAMS = Pattern.compile("\\{\\w+\\}");
|
||||
|
||||
/**
|
||||
* 判断弱密码强度
|
||||
@ -220,4 +225,20 @@ public class RegexUtil {
|
||||
return customPattern.matcher(input).matches();
|
||||
}
|
||||
|
||||
/**
|
||||
* 将路径中的参数替换为指定的字符,返回替换后的结果
|
||||
*
|
||||
* @param path 路径
|
||||
* @param replaceStr 替换后的字符
|
||||
* @return
|
||||
*/
|
||||
public static String replacePathParams(String path, String replaceStr) {
|
||||
Matcher matcher = PATH_PARAMS.matcher(path);
|
||||
while (matcher.find()) {
|
||||
String group = matcher.group();
|
||||
path = path.replace(group, replaceStr);
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,18 +1,30 @@
|
||||
package ink.wgink.common.base;
|
||||
|
||||
import ink.wgink.exceptions.ParamsException;
|
||||
import ink.wgink.exceptions.SearchException;
|
||||
import ink.wgink.interfaces.menu.IMenuBaseService;
|
||||
import ink.wgink.interfaces.user.IUserCheckService;
|
||||
import ink.wgink.pojo.dtos.menu.MenuDTO;
|
||||
import ink.wgink.pojo.dtos.permission.SystemApiDTO;
|
||||
import ink.wgink.util.RegexUtil;
|
||||
import ink.wgink.util.map.HashMapUtil;
|
||||
import ink.wgink.util.request.RequestUtil;
|
||||
import io.swagger.models.Operation;
|
||||
import io.swagger.models.Path;
|
||||
import io.swagger.models.Swagger;
|
||||
import io.swagger.models.Tag;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import springfox.documentation.service.Documentation;
|
||||
import springfox.documentation.spring.web.DocumentationCache;
|
||||
import springfox.documentation.swagger2.mappers.ServiceModelToSwagger2Mapper;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
@ -33,34 +45,8 @@ import java.util.Map;
|
||||
public class DefaultBaseController {
|
||||
|
||||
protected static final Logger LOG = LoggerFactory.getLogger(DefaultBaseController.class);
|
||||
|
||||
@Autowired
|
||||
private HttpSession httpSession;
|
||||
@Autowired(required = false)
|
||||
private IMenuBaseService menuBaseService;
|
||||
@Autowired(required = false)
|
||||
private IUserCheckService userCheckService;
|
||||
|
||||
@GetMapping("index")
|
||||
public ModelAndView goIndex() {
|
||||
ModelAndView mv = new ModelAndView("index");
|
||||
|
||||
if (menuBaseService != null) {
|
||||
List<MenuDTO> menus;
|
||||
// 加载菜单
|
||||
if (userCheckService != null) {
|
||||
// 引入用户模块,是统一用户系统,加载统一用户系统菜单
|
||||
menus = menuBaseService.listAllByParentId(IMenuBaseService.MENU_UNIFIED_USER);
|
||||
} else {
|
||||
// 未引入用户模块,是客户端系统,加载客户端菜单
|
||||
menus = new ArrayList<>();
|
||||
}
|
||||
|
||||
mv.addObject("menus", menus);
|
||||
}
|
||||
|
||||
return mv;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取请求参数
|
||||
@ -70,7 +56,7 @@ public class DefaultBaseController {
|
||||
protected Map<String, Object> requestParams() {
|
||||
Map<String, Object> params = requestParams(RequestUtil.getRequest());
|
||||
String keywords = "keywords";
|
||||
if (!StringUtils.isEmpty(params.get(keywords))) {
|
||||
if (params.get(keywords) != null && !StringUtils.isBlank(params.get(keywords).toString())) {
|
||||
try {
|
||||
params.replace(keywords, URLDecoder.decode(params.get(keywords).toString().trim(), "UTF-8"));
|
||||
} catch (Exception e) {
|
||||
@ -78,7 +64,7 @@ public class DefaultBaseController {
|
||||
}
|
||||
}
|
||||
String showLevel = "showLevel";
|
||||
if (StringUtils.isEmpty(params.get(showLevel))) {
|
||||
if (params.get(showLevel) == null || StringUtils.isEmpty(params.get(showLevel).toString())) {
|
||||
params.put(showLevel, "0");
|
||||
}
|
||||
return params;
|
||||
|
@ -2,7 +2,7 @@ package ink.wgink.common.base;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import ink.wgink.common.component.SecurityComponent;
|
||||
import ink.wgink.common.enums.RoleDataAuthorityEnum;
|
||||
import ink.wgink.common.enums.RoleDataRightEnum;
|
||||
import ink.wgink.exceptions.AccessTokenException;
|
||||
import ink.wgink.exceptions.SearchException;
|
||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||
@ -250,16 +250,16 @@ public class DefaultBaseService {
|
||||
}
|
||||
String dataAuthority = currentUser.getDataAuthority();
|
||||
List<String> dataAuthorityUserIds = currentUser.getDataAuthorityUserIds();
|
||||
if (org.apache.commons.lang3.StringUtils.equals(RoleDataAuthorityEnum.ALL.getDataAuthorityType(), dataAuthority)) {
|
||||
if (org.apache.commons.lang3.StringUtils.equals(RoleDataRightEnum.ALL.getValue(), dataAuthority)) {
|
||||
return;
|
||||
} else if (org.apache.commons.lang3.StringUtils.equals(RoleDataAuthorityEnum.SELF.getDataAuthorityType(), dataAuthority)) {
|
||||
} else if (org.apache.commons.lang3.StringUtils.equals(RoleDataRightEnum.SELF.getValue(), dataAuthority)) {
|
||||
params.put(ISystemConstant.DATA_AUTHORITY, dataAuthority);
|
||||
params.put(ISystemConstant.DATA_CREATOR, currentUser.getUserId());
|
||||
} else if (org.apache.commons.lang3.StringUtils.equals(RoleDataAuthorityEnum.DEPARTMENT.getDataAuthorityType(), dataAuthority)
|
||||
|| org.apache.commons.lang3.StringUtils.equals(RoleDataAuthorityEnum.CUSTOM.getDataAuthorityType(), dataAuthority)) {
|
||||
} else if (org.apache.commons.lang3.StringUtils.equals(RoleDataRightEnum.DEPARTMENT.getValue(), dataAuthority)
|
||||
|| org.apache.commons.lang3.StringUtils.equals(RoleDataRightEnum.CUSTOM.getValue(), dataAuthority)) {
|
||||
if (Objects.isNull(dataAuthorityUserIds) || dataAuthorityUserIds.isEmpty()) {
|
||||
LOG.debug("权限列表为空,设置查看个人");
|
||||
params.put(ISystemConstant.DATA_AUTHORITY, RoleDataAuthorityEnum.SELF.getDataAuthorityType());
|
||||
params.put(ISystemConstant.DATA_AUTHORITY, RoleDataRightEnum.SELF.getValue());
|
||||
params.put(ISystemConstant.DATA_CREATOR, currentUser.getUserId());
|
||||
} else {
|
||||
params.put(ISystemConstant.DATA_AUTHORITY, dataAuthority);
|
||||
|
130
common/src/main/java/ink/wgink/common/base/IndexController.java
Normal file
130
common/src/main/java/ink/wgink/common/base/IndexController.java
Normal file
@ -0,0 +1,130 @@
|
||||
package ink.wgink.common.base;
|
||||
|
||||
import ink.wgink.exceptions.ParamsException;
|
||||
import ink.wgink.exceptions.SearchException;
|
||||
import ink.wgink.interfaces.menu.IMenuBaseService;
|
||||
import ink.wgink.interfaces.user.IUserCheckService;
|
||||
import ink.wgink.pojo.dtos.menu.MenuDTO;
|
||||
import ink.wgink.pojo.dtos.permission.SystemApiDTO;
|
||||
import ink.wgink.util.RegexUtil;
|
||||
import io.swagger.models.Operation;
|
||||
import io.swagger.models.Path;
|
||||
import io.swagger.models.Swagger;
|
||||
import io.swagger.models.Tag;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import springfox.documentation.service.Documentation;
|
||||
import springfox.documentation.spring.web.DocumentationCache;
|
||||
import springfox.documentation.swagger2.mappers.ServiceModelToSwagger2Mapper;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: IndexController
|
||||
* @Description: index
|
||||
* @Author: WangGeng
|
||||
* @Date: 2021/2/24 20:17
|
||||
* @Version: 1.0
|
||||
**/
|
||||
@Controller
|
||||
public class IndexController {
|
||||
|
||||
private static String API_TYPE_GET = "get";
|
||||
private static String API_TYPE_POST = "post";
|
||||
private static String API_TYPE_PUT = "put";
|
||||
private static String API_TYPE_DELETE = "delete";
|
||||
|
||||
|
||||
@Autowired(required = false)
|
||||
private IMenuBaseService menuBaseService;
|
||||
@Autowired(required = false)
|
||||
private IUserCheckService userCheckService;
|
||||
@Autowired
|
||||
private DocumentationCache documentationCache;
|
||||
@Autowired
|
||||
private ServiceModelToSwagger2Mapper serviceModelToSwagger2Mapper;
|
||||
|
||||
@GetMapping("system-api/{group}/{apiType}")
|
||||
@ResponseBody
|
||||
public SystemApiDTO getSystemApi(@PathVariable("group") String group, @PathVariable("apiType") String apiType, HttpServletRequest request) {
|
||||
boolean apiTypeFlag = StringUtils.equalsIgnoreCase(API_TYPE_POST, apiType) ||
|
||||
StringUtils.equalsIgnoreCase(API_TYPE_DELETE, apiType) ||
|
||||
StringUtils.equalsIgnoreCase(API_TYPE_PUT, apiType) ||
|
||||
StringUtils.equalsIgnoreCase(API_TYPE_GET, apiType);
|
||||
if (!apiTypeFlag) {
|
||||
throw new ParamsException("api类型错误,只能是 post、delete、put、get 其中一种");
|
||||
}
|
||||
Documentation documentation = documentationCache.documentationByGroup(group);
|
||||
if (documentation == null) {
|
||||
throw new SearchException("无任何接口");
|
||||
}
|
||||
Swagger swagger = serviceModelToSwagger2Mapper.mapDocumentation(documentation);
|
||||
// 标签
|
||||
List<Tag> tags = swagger.getTags();
|
||||
List<SystemApiDTO.ApiDTO> apis = new ArrayList<>();
|
||||
for (Map.Entry<String, Path> kv : swagger.getPaths().entrySet()) {
|
||||
String keyPath = kv.getKey();
|
||||
Path valuePath = kv.getValue();
|
||||
Operation operation = null;
|
||||
if (StringUtils.equals(API_TYPE_POST, apiType)) {
|
||||
operation = valuePath.getPost();
|
||||
} else if (StringUtils.equals(API_TYPE_DELETE, apiType)) {
|
||||
operation = valuePath.getDelete();
|
||||
} else if (StringUtils.equals(API_TYPE_PUT, apiType)) {
|
||||
operation = valuePath.getPut();
|
||||
} else if (StringUtils.equals(API_TYPE_GET, apiType)) {
|
||||
operation = valuePath.getGet();
|
||||
}
|
||||
if (operation == null) {
|
||||
continue;
|
||||
}
|
||||
String apiTag = null;
|
||||
for (Tag tag : tags) {
|
||||
if (StringUtils.equals(tag.getName(), operation.getTags().get(0))) {
|
||||
apiTag = tag.getDescription().replaceAll("\\s", "");
|
||||
}
|
||||
}
|
||||
if (apiTag == null) {
|
||||
continue;
|
||||
}
|
||||
apis.add(new SystemApiDTO.ApiDTO(RegexUtil.replacePathParams(keyPath, "*"), operation.getSummary(), apiTag));
|
||||
}
|
||||
SystemApiDTO systemApiDTO = new SystemApiDTO();
|
||||
systemApiDTO.setSystemTag(request.getContextPath());
|
||||
systemApiDTO.setApis(apis);
|
||||
return systemApiDTO;
|
||||
}
|
||||
|
||||
@GetMapping("index")
|
||||
public ModelAndView goIndex() {
|
||||
ModelAndView mv = new ModelAndView("index");
|
||||
|
||||
if (menuBaseService != null) {
|
||||
List<MenuDTO> menus;
|
||||
// 加载菜单
|
||||
if (userCheckService != null) {
|
||||
// 引入用户模块,是统一用户系统,加载统一用户系统菜单
|
||||
menus = menuBaseService.listAllByParentId(IMenuBaseService.MENU_UNIFIED_USER);
|
||||
} else {
|
||||
// 未引入用户模块,是客户端系统,加载客户端菜单
|
||||
menus = new ArrayList<>();
|
||||
}
|
||||
|
||||
mv.addObject("menus", menus);
|
||||
}
|
||||
|
||||
return mv;
|
||||
}
|
||||
}
|
@ -67,7 +67,6 @@ public class BeanConfig {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
// return new BCryptPasswordEncoder();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3,9 +3,9 @@ package ink.wgink.common.config;
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.base.Predicate;
|
||||
import ink.wgink.common.config.properties.SwaggerProperties;
|
||||
import com.google.common.base.Predicates;
|
||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
@ -19,6 +19,7 @@ import springfox.documentation.service.ResponseMessage;
|
||||
import springfox.documentation.spi.DocumentationType;
|
||||
import springfox.documentation.spring.web.plugins.Docket;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ -32,8 +33,25 @@ import java.util.List;
|
||||
@Configuration
|
||||
public class SwaggerConfig {
|
||||
|
||||
@Autowired
|
||||
private SwaggerProperties swaggerProperties;
|
||||
@Value("${swagger.title:相关接口文档}")
|
||||
private String title;
|
||||
@Value("${swagger.description:相关接口文档}")
|
||||
private String description;
|
||||
@Value("${swagger.service-url:http://www.wgink.ink}")
|
||||
private String serviceUrl;
|
||||
@Value("${swagger.version:1.0}")
|
||||
private String version;
|
||||
@Value("#{'${swagger.base-package-list}'.split(',')}")
|
||||
private List<String> basePackageList;
|
||||
private Predicate<RequestHandler>[] basePackages;
|
||||
|
||||
@PostConstruct
|
||||
private void initBasePackages() {
|
||||
basePackages = new Predicate[basePackageList.size()];
|
||||
for (int i = 0; i < basePackages.length; i++) {
|
||||
basePackages[i] = RequestHandlerSelectors.basePackage(basePackageList.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
private List<ResponseMessage> responseMessageList() {
|
||||
List<ResponseMessage> responseMessageList = new ArrayList<>();
|
||||
@ -53,7 +71,7 @@ public class SwaggerConfig {
|
||||
.globalResponseMessage(RequestMethod.GET, responseMessageList)
|
||||
.apiInfo(apiInfo())
|
||||
.select()
|
||||
.apis(basePackage(swaggerProperties.getBasePackageList()))
|
||||
.apis(Predicates.or(basePackages))
|
||||
.paths(PathSelectors.any())
|
||||
.build();
|
||||
}
|
||||
@ -69,7 +87,7 @@ public class SwaggerConfig {
|
||||
.groupName(ISystemConstant.API_GROUP_SYSTEM)
|
||||
.apiInfo(apiInfo())
|
||||
.select()
|
||||
.apis(basePackage(swaggerProperties.getBasePackageList()))
|
||||
.apis(Predicates.or(basePackages))
|
||||
.paths(PathSelectors.ant("/api/**"))
|
||||
.build();
|
||||
}
|
||||
@ -85,7 +103,7 @@ public class SwaggerConfig {
|
||||
.groupName(ISystemConstant.API_GROUP_RESOURCE)
|
||||
.apiInfo(apiInfo())
|
||||
.select()
|
||||
.apis(basePackage(swaggerProperties.getBasePackageList()))
|
||||
.apis(Predicates.or(basePackages))
|
||||
.paths(PathSelectors.ant("/resource/**"))
|
||||
.build();
|
||||
}
|
||||
@ -101,7 +119,7 @@ public class SwaggerConfig {
|
||||
.groupName(ISystemConstant.API_GROUP_APP)
|
||||
.apiInfo(apiInfo())
|
||||
.select()
|
||||
.apis(basePackage(swaggerProperties.getBasePackageList()))
|
||||
.apis(Predicates.or(basePackages))
|
||||
.paths(PathSelectors.ant("/app/**"))
|
||||
.build();
|
||||
}
|
||||
@ -117,7 +135,7 @@ public class SwaggerConfig {
|
||||
.groupName(ISystemConstant.API_GROUP_ROUTE)
|
||||
.apiInfo(apiInfo())
|
||||
.select()
|
||||
.apis(basePackage(swaggerProperties.getBasePackageList()))
|
||||
.apis(Predicates.or(basePackages))
|
||||
.paths(PathSelectors.ant("/route/**"))
|
||||
.build();
|
||||
}
|
||||
@ -133,7 +151,7 @@ public class SwaggerConfig {
|
||||
.groupName(ISystemConstant.API_GROUP_WECHAT)
|
||||
.apiInfo(apiInfo())
|
||||
.select()
|
||||
.apis(basePackage(swaggerProperties.getBasePackageList()))
|
||||
.apis(Predicates.or(basePackages))
|
||||
.paths(PathSelectors.ant("/wechat/**"))
|
||||
.build();
|
||||
}
|
||||
@ -149,17 +167,17 @@ public class SwaggerConfig {
|
||||
.groupName(ISystemConstant.API_GROUP_WECHAT_MINI_APP)
|
||||
.apiInfo(apiInfo())
|
||||
.select()
|
||||
.apis(basePackage(swaggerProperties.getBasePackageList()))
|
||||
.apis(Predicates.or(basePackages))
|
||||
.paths(PathSelectors.ant("/wxminiapp/**"))
|
||||
.build();
|
||||
}
|
||||
|
||||
private ApiInfo apiInfo() {
|
||||
return new ApiInfoBuilder()
|
||||
.title(swaggerProperties.getTitle())
|
||||
.description(swaggerProperties.getDescription())
|
||||
.termsOfServiceUrl(swaggerProperties.getServiceUrl())
|
||||
.version(swaggerProperties.getVersion())
|
||||
.title(title)
|
||||
.description(description)
|
||||
.termsOfServiceUrl(serviceUrl)
|
||||
.version(version)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
@ -1,89 +0,0 @@
|
||||
package ink.wgink.common.config.properties;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: SwaggerProperties
|
||||
* @Description: swagger
|
||||
* @Author: WangGeng
|
||||
* @Date: 2021/1/24 20:00
|
||||
* @Version: 1.0
|
||||
**/
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = "swagger")
|
||||
public class SwaggerProperties {
|
||||
|
||||
private String title = "相关接口文档";
|
||||
private String description = "相关接口文档";
|
||||
private String serviceUrl = "http://www.wgink.ink/";
|
||||
private String version = "1.0";
|
||||
private List<String> basePackageList;
|
||||
|
||||
public String getTitle() {
|
||||
return title == null ? "" : title.trim();
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description == null ? "" : description.trim();
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getServiceUrl() {
|
||||
return serviceUrl == null ? "" : serviceUrl.trim();
|
||||
}
|
||||
|
||||
public void setServiceUrl(String serviceUrl) {
|
||||
this.serviceUrl = serviceUrl;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return version == null ? "" : version.trim();
|
||||
}
|
||||
|
||||
public void setVersion(String version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public List<String> getBasePackageList() {
|
||||
if (basePackageList == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
basePackageList.add("ink.wgink");
|
||||
return basePackageList;
|
||||
}
|
||||
|
||||
public void setBasePackageList(List<String> basePackageList) {
|
||||
this.basePackageList = basePackageList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuilder sb = new StringBuilder("{");
|
||||
sb.append("\"title\":\"")
|
||||
.append(title).append('\"');
|
||||
sb.append(",\"description\":\"")
|
||||
.append(description).append('\"');
|
||||
sb.append(",\"serviceUrl\":\"")
|
||||
.append(serviceUrl).append('\"');
|
||||
sb.append(",\"version\":\"")
|
||||
.append(version).append('\"');
|
||||
sb.append(",\"basePackageList\":")
|
||||
.append(basePackageList);
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
@ -10,20 +10,20 @@ package ink.wgink.common.enums;
|
||||
* @Date: 2019/11/23 9:43 下午
|
||||
* @Version: 1.0
|
||||
**/
|
||||
public enum RoleDataAuthorityEnum {
|
||||
public enum RoleDataRightEnum {
|
||||
|
||||
ALL("all"),
|
||||
DEPARTMENT("department"),
|
||||
CUSTOM("custom"),
|
||||
SELF("self");
|
||||
|
||||
private String dataAuthorityType;
|
||||
private String value;
|
||||
|
||||
RoleDataAuthorityEnum(String dataAuthorityType) {
|
||||
this.dataAuthorityType = dataAuthorityType;
|
||||
RoleDataRightEnum(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getDataAuthorityType() {
|
||||
return dataAuthorityType == null ? "" : dataAuthorityType.trim();
|
||||
public String getValue() {
|
||||
return value == null ? "" : value.trim();
|
||||
}
|
||||
}
|
@ -30,7 +30,7 @@ import java.util.Map;
|
||||
* @Date: 2019/11/18 14:00
|
||||
* @Version: 1.0
|
||||
**/
|
||||
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "地区字典管理接口")
|
||||
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "地区字典接口")
|
||||
@RestController
|
||||
@RequestMapping(ISystemConstant.API_PREFIX + "/area")
|
||||
public class AreaController extends DefaultBaseController {
|
||||
@ -100,7 +100,7 @@ public class AreaController extends DefaultBaseController {
|
||||
return areaService.listAllByParentId(areaParentId);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "分页地区字典列表", notes = "分页地区字典列表接口")
|
||||
@ApiOperation(value = "地区字典分页列表", notes = "地区字典分页列表接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "parentId", value = "上级ID", paramType = "query", dataType = "String"),
|
||||
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"),
|
||||
@ -122,7 +122,7 @@ public class AreaController extends DefaultBaseController {
|
||||
return areaService.listPage(page);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "zTree列表", notes = "zTree列表接口")
|
||||
@ApiOperation(value = "地区字典zTree列表", notes = "地区字典zTree列表接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "父ID", paramType = "query", dataType = "String")
|
||||
})
|
||||
|
@ -30,7 +30,7 @@ import java.util.Map;
|
||||
* @Date: 2019/11/18 14:00
|
||||
* @Version: 1.0
|
||||
**/
|
||||
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "字典管理接口")
|
||||
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "字典接口")
|
||||
@RestController
|
||||
@RequestMapping(ISystemConstant.API_PREFIX + "/data")
|
||||
public class DataController extends DefaultBaseController {
|
||||
@ -100,7 +100,7 @@ public class DataController extends DefaultBaseController {
|
||||
return dataService.listAllByParentId(dataParentId);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "分页字典列表", notes = "分页字典列表接口")
|
||||
@ApiOperation(value = "字典分页列表", notes = "字典分页列表接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "parentId", value = "上级ID", paramType = "query", dataType = "String"),
|
||||
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"),
|
||||
@ -122,7 +122,7 @@ public class DataController extends DefaultBaseController {
|
||||
return dataService.listPage(page);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "zTree列表", notes = "zTree列表接口")
|
||||
@ApiOperation(value = "字典zTree列表", notes = "字典zTree列表接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "父ID", paramType = "query", dataType = "String")
|
||||
})
|
||||
|
@ -31,7 +31,7 @@ import java.util.Map;
|
||||
* @Date: 2019/3/10 7:03 PM
|
||||
* @Version: 1.0
|
||||
**/
|
||||
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "文件管理接口")
|
||||
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "文件接口")
|
||||
@RestController
|
||||
@RequestMapping(ISystemConstant.API_PREFIX + "/file")
|
||||
public class FileController extends DefaultBaseController {
|
||||
@ -57,7 +57,7 @@ public class FileController extends DefaultBaseController {
|
||||
return fileService.listPageInfo(page);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除文章类别(id列表)", notes = "删除文章类别(id列表)接口")
|
||||
@ApiOperation(value = "删除文件类别(id列表)", notes = "删除文件类别(id列表)接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "ids", value = "ID列表,用下划线分隔", paramType = "path", example = "1_2_3")
|
||||
})
|
||||
@ -152,13 +152,15 @@ public class FileController extends DefaultBaseController {
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
@ApiOperation(value = "百度富文本配置", notes = "百度富文本配置接口")
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@RequestMapping("ueditor")
|
||||
public JSONObject uEditor(MultipartFile file, HttpServletRequest request) throws IOException {
|
||||
Map<String, Object> params = requestParams();
|
||||
return fileService.uEditor(file, request, params);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "上传图片", notes = "上传图片接口")
|
||||
@ApiOperation(value = "wangEditor上传图片", notes = "wangEditor上传图片接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "image", value = "文件name", paramType = "query")
|
||||
})
|
||||
|
@ -3,9 +3,12 @@ package ink.wgink.module.permission.controller.api;
|
||||
import ink.wgink.annotation.CheckRequestBodyAnnotation;
|
||||
import ink.wgink.common.base.DefaultBaseController;
|
||||
import ink.wgink.common.component.SecurityComponent;
|
||||
import ink.wgink.exceptions.ParamsException;
|
||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||
import ink.wgink.module.permission.pojo.vos.SystemApiVO;
|
||||
import ink.wgink.pojo.ListPage;
|
||||
import ink.wgink.pojo.dtos.permission.PermissionDTO;
|
||||
import ink.wgink.pojo.dtos.permission.PermissionGroupDTO;
|
||||
import ink.wgink.pojo.result.ErrorResult;
|
||||
import ink.wgink.pojo.result.SuccessResult;
|
||||
import ink.wgink.pojo.result.SuccessResultData;
|
||||
@ -13,6 +16,7 @@ import ink.wgink.pojo.result.SuccessResultList;
|
||||
import ink.wgink.module.permission.pojo.vos.PermissionVO;
|
||||
import ink.wgink.module.permission.service.IPermissionService;
|
||||
import io.swagger.annotations.*;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.AntPathMatcher;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@ -48,6 +52,22 @@ public class PermissionController extends DefaultBaseController {
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "新增权限(快速)", notes = "新增权限(快速)接口")
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@PostMapping("save-quick/{permissionType}")
|
||||
@CheckRequestBodyAnnotation
|
||||
public SuccessResult saveQuick(@PathVariable("permissionType") String permissionType, @RequestBody SystemApiVO systemApiVO) {
|
||||
boolean permissionTypeFlag = StringUtils.equals(permissionType, IPermissionService.PERMISSION_INSERT) ||
|
||||
StringUtils.equals(permissionType, IPermissionService.PERMISSION_DELETE) ||
|
||||
StringUtils.equals(permissionType, IPermissionService.PERMISSION_UPDATE) ||
|
||||
StringUtils.equals(permissionType, IPermissionService.PERMISSION_QUERY);
|
||||
if (!permissionTypeFlag) {
|
||||
throw new ParamsException("权限类型错误");
|
||||
}
|
||||
permissionService.saveQuick(permissionType, systemApiVO);
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除权限(id列表)", notes = "删除权限(id列表)接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "ids", value = "ID列表,用下划线分隔", paramType = "path", example = "1_2_3")
|
||||
@ -106,6 +126,14 @@ public class PermissionController extends DefaultBaseController {
|
||||
return permissionService.listPage(page);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "权限分组列表", notes = "权限分组列表接口")
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("listgroup")
|
||||
public List<PermissionGroupDTO> listGroup() {
|
||||
Map<String, Object> params = requestParams();
|
||||
return permissionService.listGroup(params);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "权限统计", notes = "权限统计接口")
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("count")
|
||||
|
@ -27,6 +27,11 @@ public class PermissionRouteController {
|
||||
return new ModelAndView("permission/save");
|
||||
}
|
||||
|
||||
@GetMapping("save-quick")
|
||||
public ModelAndView saveQuick() {
|
||||
return new ModelAndView("permission/save-quick");
|
||||
}
|
||||
|
||||
@GetMapping("update")
|
||||
public ModelAndView update() {
|
||||
return new ModelAndView("permission/update");
|
||||
|
@ -2,6 +2,7 @@ package ink.wgink.module.permission.pojo.vos;
|
||||
|
||||
import ink.wgink.annotation.CheckEmptyAnnotation;
|
||||
import ink.wgink.annotation.CheckNumberAnnotation;
|
||||
import ink.wgink.module.permission.service.IPermissionService;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
@ -19,10 +20,13 @@ public class PermissionVO {
|
||||
@CheckEmptyAnnotation(name = "权限名称")
|
||||
private String permissionTitle;
|
||||
@ApiModelProperty(name = "permissionType", value = "权限类型")
|
||||
@CheckEmptyAnnotation(name = "权限类型", types = {"permissionInsert", "permissionDelete", "permissionUpdate", "permissionQuery"})
|
||||
@CheckEmptyAnnotation(name = "权限类型", types = {IPermissionService.PERMISSION_INSERT, IPermissionService.PERMISSION_DELETE, IPermissionService.PERMISSION_UPDATE, IPermissionService.PERMISSION_QUERY})
|
||||
private String permissionType;
|
||||
@ApiModelProperty(name = "permissionUrl", value = "权限路径")
|
||||
private String permissionUrl;
|
||||
@ApiModelProperty(name = "apiTag", value = "接口标识")
|
||||
@CheckEmptyAnnotation(name = "系统标识")
|
||||
private String apiTag;
|
||||
@ApiModelProperty(name = "systemTag", value = "系统标识")
|
||||
private String systemTag;
|
||||
@ApiModelProperty(name = "isPublic", value = "是否公共")
|
||||
@ -53,8 +57,16 @@ public class PermissionVO {
|
||||
this.permissionUrl = permissionUrl;
|
||||
}
|
||||
|
||||
public String getApiTag() {
|
||||
return apiTag == null ? "" : apiTag.trim();
|
||||
}
|
||||
|
||||
public void setApiTag(String apiTag) {
|
||||
this.apiTag = apiTag;
|
||||
}
|
||||
|
||||
public String getSystemTag() {
|
||||
return systemTag == null ? "" : systemTag.trim();
|
||||
return systemTag == null ? IPermissionService.DEFAULT_SYSTEM_TAG : systemTag.trim();
|
||||
}
|
||||
|
||||
public void setSystemTag(String systemTag) {
|
||||
@ -78,6 +90,8 @@ public class PermissionVO {
|
||||
.append(permissionType).append('\"');
|
||||
sb.append(",\"permissionUrl\":\"")
|
||||
.append(permissionUrl).append('\"');
|
||||
sb.append(",\"apiTag\":\"")
|
||||
.append(apiTag).append('\"');
|
||||
sb.append(",\"systemTag\":\"")
|
||||
.append(systemTag).append('\"');
|
||||
sb.append(",\"isPublic\":")
|
||||
|
@ -0,0 +1,97 @@
|
||||
package ink.wgink.module.permission.pojo.vos;
|
||||
|
||||
import ink.wgink.annotation.CheckEmptyAnnotation;
|
||||
import ink.wgink.annotation.CheckListAnnotation;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: PermissionSystemApiDTO
|
||||
* @Description: 系统api
|
||||
* @Author: WangGeng
|
||||
* @Date: 2021/2/24 16:35
|
||||
* @Version: 1.0
|
||||
**/
|
||||
@ApiModel
|
||||
public class SystemApiVO {
|
||||
|
||||
@ApiModelProperty(name = "systemTag", value = "系统标识")
|
||||
@CheckEmptyAnnotation(name = "系统标识")
|
||||
private String systemTag;
|
||||
@ApiModelProperty(name = "apis", value = "接口列表")
|
||||
@CheckListAnnotation(name = "接口列表")
|
||||
private List<ApiVO> apis;
|
||||
|
||||
public String getSystemTag() {
|
||||
return systemTag == null ? "" : systemTag.trim();
|
||||
}
|
||||
|
||||
public void setSystemTag(String systemTag) {
|
||||
this.systemTag = systemTag;
|
||||
}
|
||||
|
||||
public List<ApiVO> getApis() {
|
||||
if (apis == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return apis;
|
||||
}
|
||||
|
||||
public void setApis(List<ApiVO> apis) {
|
||||
this.apis = apis;
|
||||
}
|
||||
|
||||
@ApiModel
|
||||
public static class ApiVO {
|
||||
@ApiModelProperty(name = "api", value = "接口")
|
||||
private String api;
|
||||
@ApiModelProperty(name = "apiName", value = "接口名称")
|
||||
private String apiName;
|
||||
@ApiModelProperty(name = "apiTag", value = "api标识")
|
||||
private String apiTag;
|
||||
|
||||
public String getApi() {
|
||||
return api == null ? "" : api.trim();
|
||||
}
|
||||
|
||||
public void setApi(String api) {
|
||||
this.api = api;
|
||||
}
|
||||
|
||||
public String getApiName() {
|
||||
return apiName == null ? "" : apiName.trim();
|
||||
}
|
||||
|
||||
public void setApiName(String apiName) {
|
||||
this.apiName = apiName;
|
||||
}
|
||||
|
||||
public String getApiTag() {
|
||||
return apiTag == null ? "" : apiTag.trim();
|
||||
}
|
||||
|
||||
public void setApiTag(String apiTag) {
|
||||
this.apiTag = apiTag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuilder sb = new StringBuilder("{");
|
||||
sb.append("\"api\":\"")
|
||||
.append(api).append('\"');
|
||||
sb.append(",\"apiName\":\"")
|
||||
.append(apiName).append('\"');
|
||||
sb.append(",\"apiTag\":\"")
|
||||
.append(apiTag).append('\"');
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,8 +1,10 @@
|
||||
package ink.wgink.module.permission.service;
|
||||
|
||||
import ink.wgink.interfaces.permission.IPermissionCheckService;
|
||||
import ink.wgink.module.permission.pojo.vos.SystemApiVO;
|
||||
import ink.wgink.pojo.ListPage;
|
||||
import ink.wgink.pojo.dtos.permission.PermissionDTO;
|
||||
import ink.wgink.pojo.dtos.permission.PermissionGroupDTO;
|
||||
import ink.wgink.pojo.result.SuccessResultData;
|
||||
import ink.wgink.pojo.result.SuccessResultList;
|
||||
import ink.wgink.module.permission.pojo.vos.PermissionVO;
|
||||
@ -19,6 +21,27 @@ import java.util.Map;
|
||||
**/
|
||||
public interface IPermissionService extends IPermissionCheckService {
|
||||
|
||||
/**
|
||||
* 默认系统标识
|
||||
*/
|
||||
String DEFAULT_SYSTEM_TAG = "default";
|
||||
/**
|
||||
* 新增权限
|
||||
*/
|
||||
String PERMISSION_INSERT = "permissionInsert";
|
||||
/**
|
||||
* 删除权限
|
||||
*/
|
||||
String PERMISSION_DELETE = "permissionDelete";
|
||||
/**
|
||||
* 修改权限
|
||||
*/
|
||||
String PERMISSION_UPDATE = "permissionUpdate";
|
||||
/**
|
||||
* 查询权限
|
||||
*/
|
||||
String PERMISSION_QUERY = "permissionQuery";
|
||||
|
||||
/**
|
||||
* 新增权限
|
||||
*
|
||||
@ -28,6 +51,14 @@ public interface IPermissionService extends IPermissionCheckService {
|
||||
*/
|
||||
void save(PermissionVO permissionVO);
|
||||
|
||||
/**
|
||||
* 新增权限(快速)
|
||||
*
|
||||
* @param permissionType
|
||||
* @param systemApiVO
|
||||
*/
|
||||
void saveQuick(String permissionType, SystemApiVO systemApiVO);
|
||||
|
||||
/**
|
||||
* 新增权限
|
||||
*
|
||||
@ -84,6 +115,14 @@ public interface IPermissionService extends IPermissionCheckService {
|
||||
*/
|
||||
SuccessResultList<List<PermissionDTO>> listPage(ListPage page);
|
||||
|
||||
/**
|
||||
* 权限分组列表
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
List<PermissionGroupDTO> listGroup(Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 权限统计
|
||||
*
|
||||
@ -106,5 +145,15 @@ public interface IPermissionService extends IPermissionCheckService {
|
||||
* @param permissionIds 权限ID列表
|
||||
* @return
|
||||
*/
|
||||
List<PermissionDTO> listByIds(List<String> permissionIds);
|
||||
List<PermissionDTO> list(List<String> permissionIds);
|
||||
|
||||
/**
|
||||
* 权限列表
|
||||
*
|
||||
* @param permissionType 权限类型
|
||||
* @param systemTag 系统标识
|
||||
* @return
|
||||
*/
|
||||
List<PermissionDTO> list(String permissionType, String systemTag);
|
||||
|
||||
}
|
@ -3,8 +3,10 @@ package ink.wgink.module.permission.service.impl;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import ink.wgink.common.base.DefaultBaseService;
|
||||
import ink.wgink.module.permission.pojo.vos.SystemApiVO;
|
||||
import ink.wgink.pojo.ListPage;
|
||||
import ink.wgink.pojo.dtos.permission.PermissionDTO;
|
||||
import ink.wgink.pojo.dtos.permission.PermissionGroupDTO;
|
||||
import ink.wgink.pojo.result.SuccessResultData;
|
||||
import ink.wgink.pojo.result.SuccessResultList;
|
||||
import ink.wgink.module.permission.dao.IPermissionDao;
|
||||
@ -12,9 +14,13 @@ import ink.wgink.module.permission.pojo.vos.PermissionVO;
|
||||
import ink.wgink.module.permission.service.IPermissionService;
|
||||
import ink.wgink.util.UUIDUtil;
|
||||
import ink.wgink.util.map.HashMapUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.core.parameters.P;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ -36,6 +42,33 @@ public class PermissionServiceImpl extends DefaultBaseService implements IPermis
|
||||
savePermissionReturnId(permissionVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveQuick(String permissionType, SystemApiVO systemApiVO) {
|
||||
List<PermissionDTO> permissionDTOs = list(permissionType, systemApiVO.getSystemTag());
|
||||
List<SystemApiVO.ApiVO> apiVOs = systemApiVO.getApis();
|
||||
for (PermissionDTO permissionDTO : permissionDTOs) {
|
||||
for (int i = 0; i < apiVOs.size(); i++) {
|
||||
SystemApiVO.ApiVO apiVO = apiVOs.get(i);
|
||||
if (StringUtils.equalsIgnoreCase(permissionDTO.getApiTag(), apiVO.getApiTag()) &&
|
||||
StringUtils.equalsIgnoreCase(permissionDTO.getPermissionUrl(), apiVO.getApi())) {
|
||||
// 相同不进行添加
|
||||
apiVOs.remove(i);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (SystemApiVO.ApiVO apiVO : apiVOs) {
|
||||
PermissionVO permissionVO = new PermissionVO();
|
||||
permissionVO.setPermissionTitle(apiVO.getApiName());
|
||||
permissionVO.setPermissionUrl(apiVO.getApi());
|
||||
permissionVO.setPermissionType(permissionType);
|
||||
permissionVO.setApiTag(apiVO.getApiTag());
|
||||
permissionVO.setSystemTag(systemApiVO.getSystemTag());
|
||||
permissionVO.setIsPublic(0);
|
||||
savePermissionReturnId(permissionVO);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String savePermissionReturnId(PermissionVO permissionVO) {
|
||||
String permissionId = UUIDUtil.getUUID();
|
||||
@ -89,6 +122,50 @@ public class PermissionServiceImpl extends DefaultBaseService implements IPermis
|
||||
return new SuccessResultList<>(permissionDTOs, pageInfo.getPageNum(), pageInfo.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PermissionGroupDTO> listGroup(Map<String, Object> params) {
|
||||
List<PermissionDTO> permissionDTOs = list(params);
|
||||
// 聚合 group
|
||||
Map<String, PermissionGroupDTO> permissionGroupDTOMap = new HashMap<>(16);
|
||||
for (PermissionDTO permissionDTO : permissionDTOs) {
|
||||
PermissionGroupDTO permissionGroupDTO = permissionGroupDTOMap.get(permissionDTO.getSystemTag());
|
||||
if (permissionGroupDTO == null) {
|
||||
permissionGroupDTO = new PermissionGroupDTO();
|
||||
permissionGroupDTO.setSystemTag(permissionDTO.getSystemTag());
|
||||
permissionGroupDTO.setPermissionApis(new ArrayList<>());
|
||||
permissionGroupDTOMap.put(permissionDTO.getSystemTag(), permissionGroupDTO);
|
||||
}
|
||||
}
|
||||
if (permissionGroupDTOMap.isEmpty()) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
// 聚合 api
|
||||
Map<String, PermissionGroupDTO.PermissionApiDTO> permissionApiDTOMap = new HashMap<>(16);
|
||||
for (PermissionDTO permissionDTO : permissionDTOs) {
|
||||
PermissionGroupDTO.PermissionApiDTO permissionApiDTO = permissionApiDTOMap.get(permissionDTO.getApiTag());
|
||||
if (permissionApiDTO == null) {
|
||||
permissionApiDTO = new PermissionGroupDTO.PermissionApiDTO();
|
||||
permissionApiDTO.setSystemTag(permissionDTO.getSystemTag());
|
||||
permissionApiDTO.setApiTag(permissionDTO.getApiTag());
|
||||
permissionApiDTO.setPermissions(new ArrayList<>());
|
||||
permissionApiDTOMap.put(permissionDTO.getApiTag(), permissionApiDTO);
|
||||
}
|
||||
permissionApiDTO.getPermissions().add(permissionDTO);
|
||||
}
|
||||
List<PermissionGroupDTO> permissionGroupDTOs = new ArrayList<>();
|
||||
for (Map.Entry<String, PermissionGroupDTO> groupKV : permissionGroupDTOMap.entrySet()) {
|
||||
List<PermissionGroupDTO.PermissionApiDTO> permissionApis = new ArrayList<>();
|
||||
for (Map.Entry<String, PermissionGroupDTO.PermissionApiDTO> apiKV : permissionApiDTOMap.entrySet()) {
|
||||
if (StringUtils.equals(groupKV.getKey(), apiKV.getValue().getSystemTag())) {
|
||||
permissionApis.add(apiKV.getValue());
|
||||
}
|
||||
}
|
||||
groupKV.getValue().setPermissionApis(permissionApis);
|
||||
permissionGroupDTOs.add(groupKV.getValue());
|
||||
}
|
||||
return permissionGroupDTOs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer countNumberPermission(Map<String, Object> params) {
|
||||
Integer count = permissionDao.count(params);
|
||||
@ -101,10 +178,18 @@ public class PermissionServiceImpl extends DefaultBaseService implements IPermis
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PermissionDTO> listByIds(List<String> permissionIds) {
|
||||
public List<PermissionDTO> list(List<String> permissionIds) {
|
||||
Map<String, Object> params = getHashMap(2);
|
||||
params.put("permissionIds", permissionIds);
|
||||
return list(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PermissionDTO> list(String permissionType, String systemTag) {
|
||||
Map<String, Object> params = getHashMap(4);
|
||||
params.put("permissionType", permissionType);
|
||||
params.put("systemTag", StringUtils.isBlank(systemTag) ? DEFAULT_SYSTEM_TAG : systemTag);
|
||||
return list(params);
|
||||
}
|
||||
|
||||
}
|
@ -9,6 +9,7 @@
|
||||
<result column="permission_title" property="permissionTitle"/>
|
||||
<result column="permission_type" property="permissionType"/>
|
||||
<result column="permission_url" property="permissionUrl"/>
|
||||
<result column="api_tag" property="apiTag"/>
|
||||
<result column="system_tag" property="systemTag"/>
|
||||
<result column="is_public" property="isPublic"/>
|
||||
</resultMap>
|
||||
@ -21,6 +22,7 @@
|
||||
`permission_title` varchar(255) DEFAULT NULL COMMENT '权限标题',
|
||||
`permission_type` varchar(255) DEFAULT NULL COMMENT '权限类型',
|
||||
`permission_url` varchar(255) DEFAULT NULL COMMENT '权限路径',
|
||||
`api_tag` varchar(255) DEFAULT NULL COMMENT 'API标识(Controller名称,用于对API进行分组)',
|
||||
`system_tag` varchar(255) DEFAULT NULL COMMENT '系统标识(系统路径),NULL表示本系统',
|
||||
`is_public` int(11) DEFAULT NULL COMMENT '是否公共',
|
||||
`creator` char(36) DEFAULT NULL,
|
||||
@ -41,6 +43,7 @@
|
||||
permission_title,
|
||||
permission_type,
|
||||
permission_url,
|
||||
api_tag,
|
||||
system_tag,
|
||||
is_public,
|
||||
creator,
|
||||
@ -53,6 +56,7 @@
|
||||
#{permissionTitle},
|
||||
#{permissionType},
|
||||
#{permissionUrl},
|
||||
#{apiTag},
|
||||
#{systemTag},
|
||||
#{isPublic},
|
||||
#{creator},
|
||||
@ -103,6 +107,9 @@
|
||||
<if test="permissionUrl != null and permissionUrl != ''">
|
||||
permission_url = #{permissionUrl},
|
||||
</if>
|
||||
<if test="apiTag != null and apiTag != ''">
|
||||
api_tag = #{apiTag},
|
||||
</if>
|
||||
<if test="systemTag != null and systemTag != ''">
|
||||
system_tag = #{systemTag},
|
||||
</if>
|
||||
@ -121,6 +128,7 @@
|
||||
t1.permission_title,
|
||||
t1.permission_type,
|
||||
t1.permission_url,
|
||||
t1.api_tag,
|
||||
t1.system_tag,
|
||||
t1.is_public,
|
||||
t1.permission_id
|
||||
@ -140,6 +148,7 @@
|
||||
t1.permission_title,
|
||||
t1.permission_type,
|
||||
t1.permission_url,
|
||||
t1.api_tag,
|
||||
t1.system_tag,
|
||||
t1.is_public,
|
||||
t1.permission_id
|
||||
@ -162,6 +171,10 @@
|
||||
AND
|
||||
t1.system_tag = #{systemTag}
|
||||
</if>
|
||||
<if test="apiTag != null and apiTag != ''">
|
||||
AND
|
||||
t1.api_tag = #{apiTag}
|
||||
</if>
|
||||
<if test="isPublic != null">
|
||||
AND
|
||||
t1.is_public = #{isPublic}
|
||||
|
@ -31,6 +31,9 @@
|
||||
<button type="button" class="layui-btn layui-btn-sm" lay-event="saveEvent">
|
||||
<i class="fa fa-lg fa-plus"></i> 新增
|
||||
</button>
|
||||
<button type="button" class="layui-btn layui-btn-sm" lay-event="saveQuickEvent">
|
||||
<i class="fa fa-lg fa-plus"></i> 快速新增
|
||||
</button>
|
||||
<button type="button" class="layui-btn layui-btn-normal layui-btn-sm" lay-event="updateEvent">
|
||||
<i class="fa fa-lg fa-edit"></i> 编辑
|
||||
</button>
|
||||
@ -225,6 +228,16 @@
|
||||
reloadTable();
|
||||
}
|
||||
});
|
||||
} else if(layEvent === 'saveQuickEvent') {
|
||||
top.dialog.open({
|
||||
url: top.restAjax.path('route/permission/save-quick?permissionType={permissionType}', [permissionType]),
|
||||
title: '快捷添加',
|
||||
width: '900px',
|
||||
height: '500px',
|
||||
onClose: function() {
|
||||
reloadTable();
|
||||
}
|
||||
});
|
||||
} else if(layEvent === 'updateEvent') {
|
||||
if(checkDatas.length === 0) {
|
||||
top.dialog.msg(top.dataMessage.table.selectEdit);
|
||||
|
@ -0,0 +1,116 @@
|
||||
<!doctype html>
|
||||
<html lang="en" xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<base th:href="${#request.getContextPath() + '/'} ">
|
||||
<meta charset="utf-8">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
||||
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
|
||||
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
|
||||
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
|
||||
</head>
|
||||
<body>
|
||||
<div class="layui-anim layui-anim-fadein">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body">
|
||||
<form class="layui-form layui-form-pane" lay-filter="dataForm">
|
||||
<input type="hidden" id="permissionType" name="permissionType" value="">
|
||||
<blockquote id="permissionTypeName" class="layui-elem-quote" style="display: none;"></blockquote>
|
||||
<div class="layui-form-item">
|
||||
<textarea id="apiJSONObject" lay-verify="required" placeholder="请添加上述地址返回的JSON对象,SYSTEM 可根据需要替换为 APP、ROUTE 等" class="layui-textarea" required style="height: 308px"></textarea>
|
||||
</div>
|
||||
<div class="layui-form-item layui-layout-admin">
|
||||
<div class="layui-input-block">
|
||||
<div class="layui-footer" style="left: 0;">
|
||||
<button type="button" class="layui-btn" lay-submit lay-filter="submitForm">提交新增</button>
|
||||
<button type="button" class="layui-btn layui-btn-primary close">关闭</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||
<script>
|
||||
layui.config({
|
||||
base: 'assets/layuiadmin/' //静态资源所在路径
|
||||
}).extend({
|
||||
index: 'lib/index' //主入口模块
|
||||
}).use(['index', 'form', 'laydate', 'laytpl'], function(){
|
||||
var $ = layui.$;
|
||||
var form = layui.form;
|
||||
var laytpl = layui.laytpl;
|
||||
var laydate = layui.laydate;
|
||||
var permissionType = top.restAjax.params(window.location.href).permissionType;
|
||||
|
||||
if(permissionType === 'permissionInsert') {
|
||||
$('#permissionTypeName').html('新增权限,访问系统的 <a href="system-api/SYSTEM/post" target="_blank"><b>/system-api/SYSTEM/post</b></a> 路径,可得到接口 JSON 对象');
|
||||
} else if(permissionType === 'permissionDelete') {
|
||||
$('#permissionTypeName').html('删除权限,访问系统的 <a href="system-api/SYSTEM/delete" target="_blank"><b>/system-api/SYSTEM/delete</b></a> 路径,可得到接口 JSON 对象');
|
||||
} else if(permissionType === 'permissionUpdate') {
|
||||
$('#permissionTypeName').html('修改权限,访问系统的 <a href="system-api/SYSTEM/put" target="_blank"><b>/system-api/SYSTEM/put</b></a> 路径,可得到接口 JSON 对象');
|
||||
} else if(permissionType === 'permissionQuery') {
|
||||
$('#permissionTypeName').html('查询权限,访问系统的 <a href="system-api/SYSTEM/get" target="_blank"><b>/system-api/SYSTEM/get</b></a> 路径,可得到接口 JSON 对象');
|
||||
} else {
|
||||
$('#permissionTypeName').text('权限错误!');
|
||||
}
|
||||
$('#permissionTypeName').show();
|
||||
|
||||
|
||||
function closeBox() {
|
||||
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
||||
}
|
||||
|
||||
// 提交表单
|
||||
form.on('submit(submitForm)', function(formData) {
|
||||
var apiJSONObject;
|
||||
try {
|
||||
apiJSONObject = JSON.parse($('#apiJSONObject').val());
|
||||
} catch (e) {
|
||||
top.dialog.msg('提交内容格式非标准 JSON');
|
||||
return;
|
||||
}
|
||||
if(typeof apiJSONObject != 'object' || !apiJSONObject) {
|
||||
top.dialog.msg('提交内容格式非标准 JSON');
|
||||
return;
|
||||
}
|
||||
top.dialog.confirm(top.dataMessage.commit, function(index) {
|
||||
top.dialog.close(index);
|
||||
var loadLayerIndex;
|
||||
top.restAjax.post(top.restAjax.path('api/permission/save-quick/{permissionType}', [permissionType]), apiJSONObject, null, function(code, data) {
|
||||
var layerIndex = top.dialog.msg(top.dataMessage.commitSuccess, {
|
||||
time: 0,
|
||||
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
|
||||
shade: 0.3,
|
||||
yes: function(index) {
|
||||
top.dialog.close(index);
|
||||
window.location.reload();
|
||||
},
|
||||
btn2: function() {
|
||||
closeBox();
|
||||
}
|
||||
});
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function() {
|
||||
loadLayerIndex = top.dialog.msg(top.dataMessage.committing, {icon: 16, time: 0, shade: 0.3});
|
||||
}, function() {
|
||||
top.dialog.close(loadLayerIndex);
|
||||
});
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
$('.close').on('click', function() {
|
||||
closeBox();
|
||||
});
|
||||
|
||||
// 校验
|
||||
form.verify({
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -35,6 +35,12 @@
|
||||
<input type="text" id="permissionUrl" name="permissionUrl" class="layui-input" value="" lay-verify="required" placeholder="请输入权限路径,以'/'开头,符合Ant风格的通配符,例如:/api/**" maxlength="255">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">API标识</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="apiTag" name="apiTag" class="layui-input" value="" placeholder="请输入API标识(Controller名称,用于对API进行分组)" maxlength="255">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">系统标识</label>
|
||||
<div class="layui-input-block">
|
||||
|
@ -35,6 +35,12 @@
|
||||
<input type="text" id="permissionUrl" name="permissionUrl" class="layui-input" value="" lay-verify="required" placeholder="请输入权限路径,以'/'开头,符合Ant风格的通配符,例如:api/**" maxlength="255">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">API标识</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="apiTag" name="apiTag" class="layui-input" value="" placeholder="请输入API标识(Controller名称,用于对API进行分组)" maxlength="255">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">系统标识</label>
|
||||
<div class="layui-input-block">
|
||||
|
@ -82,7 +82,7 @@ public class DepartmentController extends DefaultBaseController {
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "更新合并到新增组织", notes = "更新合并到新增组织接口")
|
||||
@ApiOperation(value = "更新合并到新增组织部门", notes = "更新合并到新增组织部门接口")
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@PutMapping("updatemergenew")
|
||||
@CheckRequestBodyAnnotation
|
||||
@ -91,7 +91,7 @@ public class DepartmentController extends DefaultBaseController {
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "更新合并到组织", notes = "更新合并到组织接口")
|
||||
@ApiOperation(value = "更新合并到组织部门", notes = "更新合并到组织部门接口")
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@PutMapping("updatemerge/{departmentId}")
|
||||
@CheckRequestBodyAnnotation
|
||||
@ -100,7 +100,7 @@ public class DepartmentController extends DefaultBaseController {
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "更新分割部门", notes = "更新分割部门接口")
|
||||
@ApiOperation(value = "更新分割组织部门", notes = "更新分割组织部门接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "departmentId", value = "部门ID", paramType = "path"),
|
||||
})
|
||||
@ -112,7 +112,7 @@ public class DepartmentController extends DefaultBaseController {
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "导入Excel", notes = "导入Excel")
|
||||
@ApiOperation(value = "组织部门导入Excel", notes = "组织部门导入Excel")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "excel", value = "文件名称", paramType = "query"),
|
||||
})
|
||||
@ -141,7 +141,7 @@ public class DepartmentController extends DefaultBaseController {
|
||||
return departmentService.listAll(params);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "zTree列表", notes = "zTree列表接口")
|
||||
@ApiOperation(value = "组织部门zTree列表", notes = "组织部门zTree列表接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "父ID", paramType = "query", dataType = "String")
|
||||
})
|
||||
@ -166,7 +166,7 @@ public class DepartmentController extends DefaultBaseController {
|
||||
return departmentService.get(departmentId);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "easyui组织部门列表", notes = "easyui组织部门列表列表接口")
|
||||
@ApiOperation(value = "组织部门分页列表", notes = "组织部门分页列表接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "parentId", value = "上级ID", paramType = "query", dataType = "String"),
|
||||
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"),
|
||||
@ -188,7 +188,7 @@ public class DepartmentController extends DefaultBaseController {
|
||||
return departmentService.listPage(page);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获得同一级部门数量(按部门名称)", notes = "获得同一级部门数量(按部门名称)接口")
|
||||
@ApiOperation(value = "组织部门获得同一级部门数量(按部门名称)", notes = "组织部门获得同一级部门数量(按部门名称)接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "departmentParentId", value = "上级部门ID", paramType = "path"),
|
||||
@ApiImplicitParam(name = "departmentName", value = "上级部门ID", paramType = "path"),
|
||||
|
@ -35,7 +35,7 @@ public class DepartmentUserController extends DefaultBaseController {
|
||||
@Autowired
|
||||
private IDepartmentUserService departmentUserService;
|
||||
|
||||
@ApiOperation(value = "更新组织部门人员列表", notes = "更新组织部门人员列表接口")
|
||||
@ApiOperation(value = "更新组织部门用户列表", notes = "更新组织部门用户列表接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "departmentId", value = "部门ID", paramType = "path")
|
||||
})
|
||||
@ -47,7 +47,7 @@ public class DepartmentUserController extends DefaultBaseController {
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "组织部门人员删除", notes = "组织部门人员删除接口")
|
||||
@ApiOperation(value = "组织部门用户删除", notes = "组织部门用户删除接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "departmentId", value = "部门ID", paramType = "path"),
|
||||
@ApiImplicitParam(name = "ids", value = "人员ID列表,用下划线分隔", paramType = "path", example = "1_2_3")
|
||||
@ -60,7 +60,7 @@ public class DepartmentUserController extends DefaultBaseController {
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "人员列表", notes = "人员列表接口")
|
||||
@ApiOperation(value = "组织部门用户列表", notes = "组织部门用户列表接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "departmentId", value = "部门ID", paramType = "path"),
|
||||
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"),
|
||||
@ -75,7 +75,7 @@ public class DepartmentUserController extends DefaultBaseController {
|
||||
return departmentUserService.listPage(departmentId, page);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "人员ID列表", notes = "人员ID列表接口")
|
||||
@ApiOperation(value = "组织部门用户ID列表", notes = "组织部门用户ID列表接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "departmentId", value = "部门ID", paramType = "path"),
|
||||
})
|
||||
|
@ -164,7 +164,7 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
// 初始化角色用户ID列表
|
||||
// 初始化职位用户ID列表
|
||||
function initSelectUserIds() {
|
||||
var layIndex;
|
||||
top.restAjax.get(top.restAjax.path('api/department/user/listuserid/{departmentId}', [departmentId]), {}, null, function(code, data) {
|
||||
|
@ -28,7 +28,7 @@ import java.util.Map;
|
||||
* @Date: 2019/1/6 3:03 PM
|
||||
* @Version: 1.0
|
||||
**/
|
||||
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "组信息管理接口")
|
||||
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "组")
|
||||
@RestController
|
||||
@RequestMapping(ISystemConstant.API_PREFIX + "/group")
|
||||
public class GroupController extends DefaultBaseController {
|
||||
@ -88,7 +88,7 @@ public class GroupController extends DefaultBaseController {
|
||||
return groupService.get(groupId);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "zTree列表", notes = "zTree列表接口")
|
||||
@ApiOperation(value = "组zTree列表", notes = "组zTree列表接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "父ID", paramType = "query", dataType = "String")
|
||||
})
|
||||
@ -104,7 +104,7 @@ public class GroupController extends DefaultBaseController {
|
||||
return groupService.listZTree(params);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "分页组列表", notes = "分页组列表接口")
|
||||
@ApiOperation(value = "组分页列表", notes = "组分页列表接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "parentId", value = "上级ID", paramType = "query", dataType = "String"),
|
||||
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"),
|
||||
|
@ -27,7 +27,7 @@ import java.util.Map;
|
||||
* @Date: 2021/2/16 11:31 上午
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "用户组用户")
|
||||
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "组用户")
|
||||
@RestController
|
||||
@RequestMapping(ISystemConstant.API_PREFIX + "/group/user")
|
||||
public class GroupUserController extends DefaultBaseController {
|
||||
@ -35,7 +35,7 @@ public class GroupUserController extends DefaultBaseController {
|
||||
@Autowired
|
||||
private IGroupUserService groupUserService;
|
||||
|
||||
@ApiOperation(value = "更新用户组人员列表", notes = "更新用户组人员列表接口")
|
||||
@ApiOperation(value = "更新组用户列表", notes = "更新组用户列表接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "departmentId", value = "部门ID", paramType = "path")
|
||||
})
|
||||
@ -47,7 +47,7 @@ public class GroupUserController extends DefaultBaseController {
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "用户组人员删除", notes = "用户组人员删除接口")
|
||||
@ApiOperation(value = "组用户删除", notes = "组用户删除接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "groupId", value = "部门ID", paramType = "path"),
|
||||
@ApiImplicitParam(name = "ids", value = "人员ID列表,用下划线分隔", paramType = "path", example = "1_2_3")
|
||||
@ -60,7 +60,7 @@ public class GroupUserController extends DefaultBaseController {
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "组人员列表", notes = "组人员列表接口")
|
||||
@ApiOperation(value = "组用户列表", notes = "组用户列表接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "groupId", value = "组ID", paramType = "path", dataType = "String"),
|
||||
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"),
|
||||
@ -75,7 +75,7 @@ public class GroupUserController extends DefaultBaseController {
|
||||
return groupUserService.listPage(groupId, page);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "人员ID列表", notes = "人员ID列表接口")
|
||||
@ApiOperation(value = "组用户ID列表", notes = "组用户ID列表接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "groupId", value = "用户组ID", paramType = "path"),
|
||||
})
|
||||
|
@ -164,7 +164,7 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
// 初始化角色用户ID列表
|
||||
// 初始化用户组用户ID列表
|
||||
function initSelectUserIds() {
|
||||
var layIndex;
|
||||
top.restAjax.get(top.restAjax.path('api/group/user/listuserid/{groupId}', [groupId]), {}, null, function(code, data) {
|
||||
|
@ -27,7 +27,7 @@ import java.util.Map;
|
||||
* @Version: 1.0
|
||||
* @MenuUrl: admin/menu/gomenus
|
||||
**/
|
||||
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "菜单信息管理接口")
|
||||
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "菜单")
|
||||
@RestController
|
||||
@RequestMapping(ISystemConstant.API_PREFIX + "/menu")
|
||||
public class MenuController extends DefaultBaseController {
|
||||
@ -45,7 +45,7 @@ public class MenuController extends DefaultBaseController {
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "菜单删除", notes = "通过id列表批量删除菜单接口")
|
||||
@ApiOperation(value = "删除菜单", notes = "通过id列表批量删除菜单接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "ids", value = "菜单ID列表,用下划线分隔", paramType = "path")
|
||||
})
|
||||
@ -122,7 +122,7 @@ public class MenuController extends DefaultBaseController {
|
||||
return menuService.listAllByParentId(menuParentId);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "zTree列表", notes = "zTree列表接口")
|
||||
@ApiOperation(value = "菜单zTree列表", notes = "菜单zTree列表接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "父ID", paramType = "query", dataType = "String")
|
||||
})
|
||||
@ -138,7 +138,7 @@ public class MenuController extends DefaultBaseController {
|
||||
return menuService.listZTree(params);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "菜单列表", notes = "菜单列表接口")
|
||||
@ApiOperation(value = "菜单分页列表", notes = "菜单分页列表接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "parentId", value = "上级ID", paramType = "query", dataType = "String"),
|
||||
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"),
|
||||
|
@ -509,8 +509,8 @@ public class ServiceMenuStartUp implements ApplicationRunner {
|
||||
menuId = UUIDUtil.getUUID();
|
||||
params.put("menuId", menuId);
|
||||
params.put("menuParentId", menuParentId);
|
||||
params.put("menuName", "修改权限");
|
||||
params.put("menuSummary", "修改权限");
|
||||
params.put("menuName", "查询权限");
|
||||
params.put("menuSummary", "查询权限");
|
||||
params.put("menuUrl", "/route/permission/list?permissionType=permissionQuery");
|
||||
params.put("menuType", "1");
|
||||
params.put("menuIcon", "fa-icon-color-white fa fa-users");
|
||||
|
@ -164,10 +164,10 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
// 初始化角色用户ID列表
|
||||
// 初始化职位用户ID列表
|
||||
function initSelectUserIds() {
|
||||
var layIndex;
|
||||
top.restAjax.get(top.restAjax.path('api/position/user/listuserid/{groupId}', [positionId]), {}, null, function(code, data) {
|
||||
top.restAjax.get(top.restAjax.path('api/position/user/listuserid/{positionId}', [positionId]), {}, null, function(code, data) {
|
||||
var selectedUserIds = '';
|
||||
for(var i = 0, item; item = data[i++]; ) {
|
||||
if(selectedUserIds.length > 0) {
|
||||
@ -227,6 +227,7 @@
|
||||
ids: ids
|
||||
}, null, function (code, data) {
|
||||
top.dialog.msg(top.dataMessage.updated);
|
||||
$('#selectedUserIds').val(ids.toString().replaceAll(',', '\_'));
|
||||
initSelectUserIds();
|
||||
}, function (code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
|
@ -29,7 +29,7 @@ import java.util.Map;
|
||||
* @Version: 1.0
|
||||
* @MenuUrl: admin/role/goroles
|
||||
**/
|
||||
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "角色信息管理接口")
|
||||
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "角色")
|
||||
@RestController
|
||||
@RequestMapping(ISystemConstant.API_PREFIX + "/role")
|
||||
public class RoleController extends DefaultBaseController {
|
||||
@ -91,7 +91,7 @@ public class RoleController extends DefaultBaseController {
|
||||
return roleService.get(roleId);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "zTree列表", notes = "zTree列表接口")
|
||||
@ApiOperation(value = "角色zTree列表", notes = "角色zTree列表接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "上级ID", paramType = "query", dataType = "String")
|
||||
})
|
||||
@ -107,7 +107,7 @@ public class RoleController extends DefaultBaseController {
|
||||
return roleService.listZTree(params);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "角色列表", notes = "角色列表接口")
|
||||
@ApiOperation(value = "角色分页列表", notes = "角色分页列表接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "parentId", value = "上级ID", paramType = "query", dataType = "String"),
|
||||
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"),
|
||||
|
@ -0,0 +1,51 @@
|
||||
package ink.wgink.service.role.controller.api;
|
||||
|
||||
import ink.wgink.annotation.CheckRequestBodyAnnotation;
|
||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||
import ink.wgink.pojo.dtos.role.RoleDataRightInfoDTO;
|
||||
import ink.wgink.pojo.result.ErrorResult;
|
||||
import ink.wgink.pojo.result.SuccessResult;
|
||||
import ink.wgink.service.role.pojo.vos.RoleDataRightVO;
|
||||
import ink.wgink.service.role.service.IRoleDataRightService;
|
||||
import io.swagger.annotations.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: RoleDataRightController
|
||||
* @Description: 角色数据权限
|
||||
* @Author: WangGeng
|
||||
* @Date: 2021/2/21 10:01
|
||||
* @Version: 1.0
|
||||
**/
|
||||
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "角色数据权限")
|
||||
@RestController
|
||||
@RequestMapping(ISystemConstant.API_PREFIX + "/role/data-right")
|
||||
public class RoleDataRightController {
|
||||
|
||||
@Autowired
|
||||
private IRoleDataRightService roleDataRightService;
|
||||
|
||||
@ApiOperation(value = "更新角色数据权限", notes = "更新角色数据权限接口")
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@PutMapping("update/{roleId}")
|
||||
@CheckRequestBodyAnnotation
|
||||
public SuccessResult update(@PathVariable("roleId") String roleId, @RequestBody RoleDataRightVO roleDataRightVO) {
|
||||
roleDataRightService.update(roleId, roleDataRightVO);
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "角色数据权限详情", notes = "角色数据权限详情接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "roleId", value = "角色ID", paramType = "path")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("get/{roleId}")
|
||||
public RoleDataRightInfoDTO get(@PathVariable("roleId") String roleId) {
|
||||
return roleDataRightService.get(roleId);
|
||||
}
|
||||
|
||||
}
|
@ -1,63 +0,0 @@
|
||||
package ink.wgink.service.role.controller.api;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: RoleGroupController
|
||||
* @Description: 角色组
|
||||
* @Author: wanggeng
|
||||
* @Date: 2021/2/5 9:02 上午
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public class RoleGroupController {
|
||||
|
||||
// @ApiOperation(value = "更新角色组列表", notes = "更新角色组列表接口")
|
||||
// @ApiImplicitParams({
|
||||
// @ApiImplicitParam(name = "roleId", value = "角色ID", paramType = "path")
|
||||
// })
|
||||
// @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
// @PutMapping("updaterolegroup/{roleId}")
|
||||
// public SuccessResult updateRoleGroup(@PathVariable("roleId") String roleId,
|
||||
// @RequestBody RoleGroupVO roleGroupVO) {
|
||||
// Map<String, Object> params = getParams();
|
||||
// params.put("selectedGroupIds", roleGroupVO.getSelectedGroupIds());
|
||||
// params.put("roleId", roleId);
|
||||
//
|
||||
// return groupService.updateRoleGroup(params);
|
||||
// }
|
||||
|
||||
|
||||
// @ApiOperation(value = "easyui组列表", notes = "easyui组列表接口")
|
||||
// @ApiImplicitParams({
|
||||
// @ApiImplicitParam(name = "roleId", value = "角色ID", paramType = "path"),
|
||||
// @ApiImplicitParam(name = "parentId", value = "上级ID", paramType = "query", dataType = "String"),
|
||||
// @ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"),
|
||||
// @ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20"),
|
||||
// @ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query", dataType = "String"),
|
||||
// @ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataType = "String"),
|
||||
// @ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "String")
|
||||
// })
|
||||
// @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
// @GetMapping("listrolegroup/{roleId}")
|
||||
// public SuccessResultList<List<RoleGroupDTO>> listRoleGroup(@PathVariable("roleId") String roleId, ListPage page) {
|
||||
// Map<String, Object> params = requestParams();
|
||||
// params.put("roleId", roleId);
|
||||
// page.setParams(params);
|
||||
// return groupService.listRoleGroup(page);
|
||||
// }
|
||||
|
||||
|
||||
// @ApiOperation(value = "角色组选择列表", notes = "角色组选择列表接口")
|
||||
// @ApiImplicitParams({
|
||||
// @ApiImplicitParam(name = "roleId", value = "角色ID", paramType = "path"),
|
||||
// })
|
||||
// @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
// @GetMapping("listselectrolegroup/{roleId}")
|
||||
// public List<RoleGroupDTO> listSelectRoleGroup(@PathVariable("roleId") String roleId) {
|
||||
// Map<String, Object> params = requestParams();
|
||||
// params.put("roleId", roleId);
|
||||
// return groupService.listSelectRoleGroup(params);
|
||||
// }
|
||||
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package ink.wgink.service.role.controller.api;
|
||||
|
||||
import ink.wgink.annotation.CheckRequestBodyAnnotation;
|
||||
import ink.wgink.common.base.DefaultBaseController;
|
||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||
import ink.wgink.pojo.dtos.role.RoleMenuDTO;
|
||||
import ink.wgink.pojo.result.ErrorResult;
|
||||
import ink.wgink.pojo.result.SuccessResult;
|
||||
import ink.wgink.service.role.pojo.vos.RoleDataRightVO;
|
||||
import ink.wgink.service.role.pojo.vos.RoleMenuVO;
|
||||
import ink.wgink.service.role.service.IRoleMenuService;
|
||||
import io.swagger.annotations.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: RoleMenuController
|
||||
* @Description: 角色菜单
|
||||
* @Author: WangGeng
|
||||
* @Date: 2021/2/23 21:41
|
||||
* @Version: 1.0
|
||||
**/
|
||||
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "角色菜单")
|
||||
@RestController
|
||||
@RequestMapping(ISystemConstant.API_PREFIX + "/role/menu")
|
||||
public class RoleMenuController extends DefaultBaseController {
|
||||
|
||||
@Autowired
|
||||
private IRoleMenuService roleMenuService;
|
||||
|
||||
@ApiOperation(value = "更新角色菜单", notes = "更新角色菜单接口")
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@PutMapping("update/{roleId}")
|
||||
@CheckRequestBodyAnnotation
|
||||
public SuccessResult update(@PathVariable("roleId") String roleId, @RequestBody RoleMenuVO roleMenuVO) {
|
||||
roleMenuService.update(roleId, roleMenuVO);
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "角色菜单列表", notes = "角色菜单列表接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "roleId", value = "角色ID", paramType = "path")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("list/{roleId}")
|
||||
public List<RoleMenuDTO> list(@PathVariable("roleId") String roleId) {
|
||||
return roleMenuService.list(roleId);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package ink.wgink.service.role.controller.api;
|
||||
|
||||
import ink.wgink.annotation.CheckRequestBodyAnnotation;
|
||||
import ink.wgink.common.base.DefaultBaseController;
|
||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||
import ink.wgink.pojo.dtos.role.RolePermissionDTO;
|
||||
import ink.wgink.pojo.result.ErrorResult;
|
||||
import ink.wgink.pojo.result.SuccessResult;
|
||||
import ink.wgink.service.role.pojo.vos.RolePermissionVO;
|
||||
import ink.wgink.service.role.service.IRolePermissionService;
|
||||
import io.swagger.annotations.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: RolePermissionController
|
||||
* @Description: 角色权限
|
||||
* @Author: WangGeng
|
||||
* @Date: 2021/2/20 17:54
|
||||
* @Version: 1.0
|
||||
**/
|
||||
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "角色权限")
|
||||
@RestController
|
||||
@RequestMapping(ISystemConstant.API_PREFIX + "/role/permission")
|
||||
public class RolePermissionController extends DefaultBaseController {
|
||||
|
||||
@Autowired
|
||||
private IRolePermissionService rolePermissionService;
|
||||
|
||||
@ApiOperation(value = "修改角色权限", notes = "修改角色权限接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "roleId", value = "角色ID", paramType = "path"),
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@PutMapping("update/{roleId}")
|
||||
@CheckRequestBodyAnnotation
|
||||
public SuccessResult update(@PathVariable("roleId") String roleId, @RequestBody RolePermissionVO rolePermissionVO) {
|
||||
rolePermissionService.update(roleId, rolePermissionVO);
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "角色权限详情", notes = "角色权限详情接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "roleId", value = "角色ID", paramType = "path"),
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("list/{roleId}")
|
||||
public List<RolePermissionDTO> list(@PathVariable("roleId") String roleId) {
|
||||
return rolePermissionService.list(roleId);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
package ink.wgink.service.role.controller.api;
|
||||
|
||||
import ink.wgink.common.base.DefaultBaseController;
|
||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||
import ink.wgink.pojo.ListPage;
|
||||
import ink.wgink.pojo.dtos.role.RoleUserDTO;
|
||||
import ink.wgink.pojo.result.ErrorResult;
|
||||
import ink.wgink.pojo.result.SuccessResult;
|
||||
import ink.wgink.pojo.result.SuccessResultList;
|
||||
import ink.wgink.pojo.vos.IdsVO;
|
||||
import ink.wgink.service.role.service.IRoleUserService;
|
||||
import io.swagger.annotations.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: RoleUserController
|
||||
* @Description: 角色用户
|
||||
* @Author: WangGeng
|
||||
* @Date: 2021/2/18 11:19
|
||||
* @Version: 1.0
|
||||
**/
|
||||
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "角色用户")
|
||||
@RestController
|
||||
@RequestMapping(ISystemConstant.API_PREFIX + "/role/user")
|
||||
public class RoleUserController extends DefaultBaseController {
|
||||
|
||||
@Autowired
|
||||
private IRoleUserService roleUserService;
|
||||
|
||||
@ApiOperation(value = "更新角色用户列表", notes = "更新角色用户列表接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "departmentId", value = "部门ID", paramType = "path")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@PutMapping("update/{roleId}")
|
||||
public synchronized SuccessResult update(@PathVariable("roleId") String roleId,
|
||||
@RequestBody IdsVO idsVO) {
|
||||
roleUserService.update(roleId, idsVO.getIds());
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除角色用户", notes = "删除角色用户接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "roleId", value = "部门ID", paramType = "path"),
|
||||
@ApiImplicitParam(name = "ids", value = "人员ID列表,用下划线分隔", paramType = "path", example = "1_2_3")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@DeleteMapping("remove/{roleId}/{ids}")
|
||||
public synchronized SuccessResult remove(@PathVariable("roleId") String roleId,
|
||||
@PathVariable("ids") String ids) {
|
||||
roleUserService.delete(roleId, Arrays.asList(ids.split("_")));
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "角色用户分页列表", notes = "角色用户分页列表接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "roleId", value = "角色ID", paramType = "path", dataType = "String"),
|
||||
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"),
|
||||
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20"),
|
||||
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query", dataType = "String")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("listpage/{roleId}")
|
||||
public SuccessResultList<List<RoleUserDTO>> listPage(@PathVariable("roleId") String roleId, ListPage page) {
|
||||
Map<String, Object> params = requestParams();
|
||||
page.setParams(params);
|
||||
return roleUserService.listPage(roleId, page);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "角色用户ID列表", notes = "角色用户ID列表接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "roleId", value = "用户角色ID", paramType = "path"),
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("listuserid/{roleId}")
|
||||
public List<String> listUserId(@PathVariable("roleId") String roleId) {
|
||||
return roleUserService.listUserId(roleId);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package ink.wgink.service.role.controller.route;
|
||||
|
||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: RoleDataAuthorityRouteController
|
||||
* @Description: 角色数据权限
|
||||
* @Author: WangGeng
|
||||
* @Date: 2021/2/21 9:57
|
||||
* @Version: 1.0
|
||||
**/
|
||||
@Api(tags = ISystemConstant.ROUTE_TAGS_PREFIX + "角色数据权限路由接口")
|
||||
@Controller
|
||||
@RequestMapping(ISystemConstant.ROUTE_PREFIX + "/role/data-right")
|
||||
public class RoleDataRightRouteController {
|
||||
|
||||
@GetMapping("update")
|
||||
public ModelAndView update() {
|
||||
return new ModelAndView("role/dataright/update");
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package ink.wgink.service.role.controller.route;
|
||||
|
||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: RoleMenuRouteController
|
||||
* @Description: 角色菜单路由
|
||||
* @Author: WangGeng
|
||||
* @Date: 2021/2/23 21:35
|
||||
* @Version: 1.0
|
||||
**/
|
||||
@Api(tags = ISystemConstant.ROUTE_TAGS_PREFIX + "角色菜单路由")
|
||||
@Controller
|
||||
@RequestMapping(ISystemConstant.ROUTE_PREFIX + "/role/menu")
|
||||
public class RoleMenuRouteController {
|
||||
|
||||
@GetMapping("tree")
|
||||
public ModelAndView tree() {
|
||||
return new ModelAndView("role/menu/tree");
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package ink.wgink.service.role.controller.route;
|
||||
|
||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: RolePermissionRouteController
|
||||
* @Description: 角色权限
|
||||
* @Author: WangGeng
|
||||
* @Date: 2021/2/19 11:23
|
||||
* @Version: 1.0
|
||||
**/
|
||||
@Api(tags = ISystemConstant.ROUTE_TAGS_PREFIX + "角色权限路由接口")
|
||||
@Controller
|
||||
@RequestMapping(ISystemConstant.ROUTE_PREFIX + "/role/permission")
|
||||
public class RolePermissionRouteController {
|
||||
|
||||
@GetMapping("update")
|
||||
public ModelAndView list() {
|
||||
return new ModelAndView("role/permission/update");
|
||||
}
|
||||
|
||||
}
|
@ -42,4 +42,9 @@ public class RoleRouteController {
|
||||
return new ModelAndView("role/list");
|
||||
}
|
||||
|
||||
@GetMapping("data-authority")
|
||||
public ModelAndView dataAuthority() {
|
||||
return new ModelAndView("role/data-authority");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,30 @@
|
||||
package ink.wgink.service.role.controller.route;
|
||||
|
||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: RoleUserRouteController
|
||||
* @Description: 角色用户
|
||||
* @Author: WangGeng
|
||||
* @Date: 2021/2/18 11:57
|
||||
* @Version: 1.0
|
||||
**/
|
||||
@Api(tags = ISystemConstant.ROUTE_TAGS_PREFIX + "角色用户路由接口")
|
||||
@Controller
|
||||
@RequestMapping(ISystemConstant.ROUTE_PREFIX + "/role/user")
|
||||
public class RoleUserRouteController {
|
||||
|
||||
@GetMapping("list")
|
||||
public ModelAndView list() {
|
||||
return new ModelAndView("role/user/list");
|
||||
}
|
||||
|
||||
}
|
@ -4,13 +4,8 @@ import ink.wgink.exceptions.RemoveException;
|
||||
import ink.wgink.exceptions.SaveException;
|
||||
import ink.wgink.exceptions.SearchException;
|
||||
import ink.wgink.exceptions.UpdateException;
|
||||
import ink.wgink.service.role.pojo.pos.RolePO;
|
||||
import ink.wgink.pojo.bos.RoleBO;
|
||||
import ink.wgink.pojo.bos.RoleMenuBO;
|
||||
import ink.wgink.pojo.dtos.ZTreeDTO;
|
||||
import ink.wgink.pojo.dtos.role.RoleDTO;
|
||||
import ink.wgink.pojo.dtos.role.RoleDataAuthorityDTO;
|
||||
import net.sf.jsqlparser.statement.update.Update;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -0,0 +1,56 @@
|
||||
package ink.wgink.service.role.dao;
|
||||
|
||||
import ink.wgink.exceptions.RemoveException;
|
||||
import ink.wgink.exceptions.SaveException;
|
||||
import ink.wgink.exceptions.UpdateException;
|
||||
import ink.wgink.pojo.dtos.role.RoleDataRightDTO;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: IRoleDataRightDao
|
||||
* @Description: 角色数据权限
|
||||
* @Author: WangGeng
|
||||
* @Date: 2021/2/21 15:41
|
||||
* @Version: 1.0
|
||||
**/
|
||||
@Repository
|
||||
public interface IRoleDataRightDao {
|
||||
|
||||
/**
|
||||
* 建表
|
||||
*
|
||||
* @throws UpdateException
|
||||
*/
|
||||
void createTable() throws UpdateException;
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param params
|
||||
* @throws SaveException
|
||||
*/
|
||||
void save(Map<String, Object> params) throws SaveException;
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param params
|
||||
* @throws SaveException
|
||||
*/
|
||||
void delete(Map<String, Object> params) throws RemoveException;
|
||||
|
||||
/**
|
||||
* 数据权限列表
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
List<RoleDataRightDTO> list(Map<String, Object> params);
|
||||
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
package ink.wgink.service.role.dao;
|
||||
|
||||
import ink.wgink.exceptions.SearchException;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: IRoleGroupDao
|
||||
* @Description: 角色组
|
||||
* @Author: wanggeng
|
||||
* @Date: 2021/2/5 8:43 上午
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@Repository
|
||||
public interface IRoleGroupDao {
|
||||
|
||||
/**
|
||||
* 角色组列表
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
* @throws SearchException
|
||||
*/
|
||||
// List<RoleGroupDTO> listRoleGroups(Map<String, Object> params) throws SearchException;
|
||||
|
||||
}
|
@ -1,5 +1,15 @@
|
||||
package ink.wgink.service.role.dao;
|
||||
|
||||
import ink.wgink.exceptions.RemoveException;
|
||||
import ink.wgink.exceptions.SaveException;
|
||||
import ink.wgink.exceptions.SearchException;
|
||||
import ink.wgink.exceptions.UpdateException;
|
||||
import ink.wgink.pojo.dtos.role.RoleMenuDTO;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
@ -10,5 +20,39 @@ package ink.wgink.service.role.dao;
|
||||
* @Date: 2021/2/2 12:38 下午
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@Repository
|
||||
public interface IRoleMenuDao {
|
||||
|
||||
/**
|
||||
* 建表
|
||||
*
|
||||
* @throws UpdateException
|
||||
*/
|
||||
void createTable() throws UpdateException;
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param params
|
||||
* @throws SaveException
|
||||
*/
|
||||
void save(Map<String, Object> params) throws SaveException;
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param params
|
||||
* @throws RemoveException
|
||||
*/
|
||||
void delete(Map<String, Object> params) throws RemoveException;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
* @throws SearchException
|
||||
*/
|
||||
List<RoleMenuDTO> list(Map<String, Object> params) throws SearchException;
|
||||
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package ink.wgink.service.role.dao;
|
||||
import ink.wgink.exceptions.RemoveException;
|
||||
import ink.wgink.exceptions.SaveException;
|
||||
import ink.wgink.exceptions.SearchException;
|
||||
import ink.wgink.exceptions.UpdateException;
|
||||
import ink.wgink.pojo.dtos.role.RolePermissionDTO;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@ -22,6 +23,13 @@ import java.util.Map;
|
||||
@Repository
|
||||
public interface IRolePermissionDao {
|
||||
|
||||
/**
|
||||
* 建表
|
||||
*
|
||||
* @throws UpdateException
|
||||
*/
|
||||
void createTable() throws UpdateException;
|
||||
|
||||
/**
|
||||
* 新增权限角色
|
||||
*
|
||||
@ -39,21 +47,12 @@ public interface IRolePermissionDao {
|
||||
void delete(Map<String, Object> params) throws RemoveException;
|
||||
|
||||
/**
|
||||
* 权限详情
|
||||
* 权限列表
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
* @throws SearchException
|
||||
*/
|
||||
RolePermissionDTO get(Map<String, Object> params) throws SearchException;
|
||||
|
||||
/**
|
||||
* 权限列表
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return
|
||||
* @throws SearchException
|
||||
*/
|
||||
List<RolePermissionDTO> listByRoleId(String roleId) throws SearchException;
|
||||
List<RolePermissionDTO> list(Map<String, Object> params) throws SearchException;
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,66 @@
|
||||
package ink.wgink.service.role.dao;
|
||||
|
||||
import ink.wgink.exceptions.RemoveException;
|
||||
import ink.wgink.exceptions.SaveException;
|
||||
import ink.wgink.exceptions.SearchException;
|
||||
import ink.wgink.exceptions.UpdateException;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: IRoleUserDao
|
||||
* @Description: 角色用户
|
||||
* @Author: WangGeng
|
||||
* @Date: 2021/2/18 11:38
|
||||
* @Version: 1.0
|
||||
**/
|
||||
@Repository
|
||||
public interface IRoleUserDao {
|
||||
|
||||
/**
|
||||
* 建表
|
||||
*
|
||||
* @throws UpdateException
|
||||
*/
|
||||
void createTable() throws UpdateException;
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param params
|
||||
* @throws SaveException
|
||||
*/
|
||||
void save(Map<String, Object> params) throws SaveException;
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param params
|
||||
* @throws RemoveException
|
||||
*/
|
||||
void delete(Map<String, Object> params) throws RemoveException;
|
||||
|
||||
/**
|
||||
* 用户ID列表
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
* @throws SearchException
|
||||
*/
|
||||
List<String> listUserId(Map<String, Object> params) throws SearchException;
|
||||
|
||||
/**
|
||||
* 用户ID列表
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
* @throws SearchException
|
||||
*/
|
||||
List<String> listGroupUserId(Map<String, Object> params) throws SearchException;
|
||||
|
||||
}
|
@ -1,56 +0,0 @@
|
||||
package ink.wgink.service.role.pojo.vos;
|
||||
|
||||
import ink.wgink.annotation.CheckEmptyAnnotation;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: RoleDataAuthorityVO
|
||||
* @Description: 角色数据权限
|
||||
* @Author: WangGeng
|
||||
* @Date: 2019/11/23 8:10 下午
|
||||
* @Version: 1.0
|
||||
**/
|
||||
@ApiModel
|
||||
public class RoleDataAuthorityVO {
|
||||
|
||||
@ApiModelProperty(name = "dataAuthorityType", value = "数据权限类型")
|
||||
@CheckEmptyAnnotation(name = "数据权限类型", types = {"all", "department", "custom", "self"})
|
||||
private String dataAuthorityType;
|
||||
|
||||
@ApiModelProperty(name = "roleUserAuthorityList", value = "角色数据权限列表")
|
||||
private List<RoleUserAuthorityVO> roleUserAuthorityList;
|
||||
|
||||
public String getDataAuthorityType() {
|
||||
return dataAuthorityType == null ? "" : dataAuthorityType.trim();
|
||||
}
|
||||
|
||||
public void setDataAuthorityType(String dataAuthorityType) {
|
||||
this.dataAuthorityType = dataAuthorityType;
|
||||
}
|
||||
|
||||
public List<RoleUserAuthorityVO> getRoleUserAuthorityList() {
|
||||
return roleUserAuthorityList == null ? new ArrayList<>(0) : roleUserAuthorityList;
|
||||
}
|
||||
|
||||
public void setRoleUserAuthorityList(List<RoleUserAuthorityVO> roleUserAuthorityList) {
|
||||
this.roleUserAuthorityList = roleUserAuthorityList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuilder sb = new StringBuilder("{");
|
||||
sb.append("\"dataAuthorityType\":")
|
||||
.append("\"").append(dataAuthorityType).append("\"");
|
||||
sb.append(",\"roleUserAuthorityList\":")
|
||||
.append(roleUserAuthorityList);
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
package ink.wgink.service.role.pojo.vos;
|
||||
|
||||
import ink.wgink.annotation.CheckEmptyAnnotation;
|
||||
import ink.wgink.common.enums.RoleDataRightEnum;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: RoleDataAuthorityVO
|
||||
* @Description: 角色数据权限
|
||||
* @Author: WangGeng
|
||||
* @Date: 2019/11/23 8:10 下午
|
||||
* @Version: 1.0
|
||||
**/
|
||||
@ApiModel
|
||||
public class RoleDataRightVO {
|
||||
|
||||
@ApiModelProperty(name = "roleDataRight", value = "数据权限类型")
|
||||
@CheckEmptyAnnotation(name = "数据权限类型", types = {"all", "department", "custom", "self"})
|
||||
private String roleDataRight;
|
||||
@ApiModelProperty(name = "userIds", value = "角色数据权限列表")
|
||||
private List<String> userIds;
|
||||
|
||||
public String getRoleDataRight() {
|
||||
return roleDataRight == null ? "" : roleDataRight.trim();
|
||||
}
|
||||
|
||||
public void setRoleDataRight(String roleDataRight) {
|
||||
this.roleDataRight = roleDataRight;
|
||||
}
|
||||
|
||||
public List<String> getUserIds() {
|
||||
if (userIds == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return userIds;
|
||||
}
|
||||
|
||||
public void setUserIds(List<String> userIds) {
|
||||
this.userIds = userIds;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuilder sb = new StringBuilder("{");
|
||||
sb.append("\"roleDataRight\":\"")
|
||||
.append(roleDataRight).append('\"');
|
||||
sb.append(",\"userIds\":")
|
||||
.append(userIds);
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
@ -3,6 +3,9 @@ package ink.wgink.service.role.pojo.vos;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName: RoleUserAuthorizationVO
|
||||
* @Description: 角色用户授权
|
||||
@ -11,16 +14,19 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
* @Version: 1.0
|
||||
**/
|
||||
@ApiModel
|
||||
public class RoleUserAuthorizationVO {
|
||||
public class RoleMenuVO {
|
||||
|
||||
@ApiModelProperty(name = "menuIds", value = "菜单ID列表,下划线分隔", example = "1_2_3")
|
||||
private String menuIds;
|
||||
@ApiModelProperty(name = "menuIds", value = "菜单ID列表")
|
||||
private List<String> menuIds;
|
||||
|
||||
public String getMenuIds() {
|
||||
public List<String> getMenuIds() {
|
||||
if (menuIds == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return menuIds;
|
||||
}
|
||||
|
||||
public void setMenuIds(String menuIds) {
|
||||
public void setMenuIds(List<String> menuIds) {
|
||||
this.menuIds = menuIds;
|
||||
}
|
||||
|
@ -1,10 +1,12 @@
|
||||
package ink.wgink.service.role.pojo.vos;
|
||||
|
||||
import ink.wgink.annotation.CheckBooleanAnnotation;
|
||||
import ink.wgink.annotation.CheckEmptyAnnotation;
|
||||
import ink.wgink.annotation.CheckListAnnotation;
|
||||
import ink.wgink.service.role.service.IRolePermissionService;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -17,36 +19,39 @@ import java.util.List;
|
||||
@ApiModel
|
||||
public class RolePermissionVO {
|
||||
|
||||
@ApiModelProperty(name = "isChecked", value = "是否选中")
|
||||
@CheckBooleanAnnotation(name = "是否选中")
|
||||
private Boolean isChecked;
|
||||
@ApiModelProperty(name = "type", value = "类型")
|
||||
@CheckEmptyAnnotation(name = "类型", types = {IRolePermissionService.PERMISSION_INSERT, IRolePermissionService.PERMISSION_DELETE, IRolePermissionService.PERMISSION_UPDATE, IRolePermissionService.PERMISSION_QUERY})
|
||||
private String type;
|
||||
@ApiModelProperty(name = "permissionIdArray", value = "权限ID列表")
|
||||
@CheckListAnnotation(name = "权限ID列表")
|
||||
private List<String> permissionIdArray;
|
||||
private List<String> permissionIds;
|
||||
|
||||
public Boolean getChecked() {
|
||||
return isChecked;
|
||||
public String getType() {
|
||||
return type == null ? "" : type.trim();
|
||||
}
|
||||
|
||||
public void setChecked(Boolean checked) {
|
||||
isChecked = checked;
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public List<String> getPermissionIdArray() {
|
||||
return permissionIdArray;
|
||||
public List<String> getPermissionIds() {
|
||||
if (permissionIds == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return permissionIds;
|
||||
}
|
||||
|
||||
public void setPermissionIdArray(List<String> permissionIdArray) {
|
||||
this.permissionIdArray = permissionIdArray;
|
||||
public void setPermissionIds(List<String> permissionIds) {
|
||||
this.permissionIds = permissionIds;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuilder sb = new StringBuilder("{");
|
||||
sb.append("\"isChecked\":")
|
||||
.append(isChecked);
|
||||
sb.append(",\"permissionIdArray\":")
|
||||
.append(permissionIdArray);
|
||||
sb.append("\"type\":\"")
|
||||
.append(type).append('\"');
|
||||
sb.append(",\"permissionIds\":")
|
||||
.append(permissionIds);
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
|
@ -1,50 +0,0 @@
|
||||
package ink.wgink.service.role.pojo.vos;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: RoleUserAuthorityVO
|
||||
* @Description: 角色用户
|
||||
* @Author: WangGeng
|
||||
* @Date: 2019/11/23 8:14 下午
|
||||
* @Version: 1.0
|
||||
**/
|
||||
@ApiModel
|
||||
public class RoleUserAuthorityVO {
|
||||
|
||||
@ApiModelProperty(name = "departmentId", value = "部门ID")
|
||||
private String departmentId;
|
||||
@ApiModelProperty(name = "userId", value = "用户ID")
|
||||
private String userId;
|
||||
|
||||
public String getDepartmentId() {
|
||||
return departmentId == null ? "" : departmentId.trim();
|
||||
}
|
||||
|
||||
public void setDepartmentId(String departmentId) {
|
||||
this.departmentId = departmentId;
|
||||
}
|
||||
|
||||
public String getUserId() {
|
||||
return userId == null ? "" : userId.trim();
|
||||
}
|
||||
|
||||
public void setUserId(String userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuilder sb = new StringBuilder("{");
|
||||
sb.append("\"departmentId\":")
|
||||
.append("\"").append(departmentId).append("\"");
|
||||
sb.append(",\"userId\":")
|
||||
.append("\"").append(userId).append("\"");
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
package ink.wgink.service.role.service;
|
||||
|
||||
import ink.wgink.pojo.dtos.role.RoleDataRightDTO;
|
||||
import ink.wgink.pojo.dtos.role.RoleDataRightInfoDTO;
|
||||
import ink.wgink.service.role.pojo.vos.RoleDataRightVO;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: IRoleDataRightService
|
||||
* @Description: 角色数据权限
|
||||
* @Author: WangGeng
|
||||
* @Date: 2021/2/21 18:32
|
||||
* @Version: 1.0
|
||||
**/
|
||||
public interface IRoleDataRightService {
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param roleId
|
||||
* @param roleDataRightVO
|
||||
*/
|
||||
void update(String roleId, RoleDataRightVO roleDataRightVO);
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*
|
||||
* @param roleId
|
||||
* @return
|
||||
*/
|
||||
RoleDataRightInfoDTO get(String roleId);
|
||||
|
||||
/**
|
||||
* 数据权限列表
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
List<RoleDataRightDTO> list(Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 数据权限列表
|
||||
*
|
||||
* @param roleId
|
||||
* @return
|
||||
*/
|
||||
List<RoleDataRightDTO> list(String roleId);
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
package ink.wgink.service.role.service;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: IRoleGroupService
|
||||
* @Description: 角色组
|
||||
* @Author: wanggeng
|
||||
* @Date: 2021/2/5 8:55 上午
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public interface IRoleGroupService {
|
||||
|
||||
/**
|
||||
* 角色组列表
|
||||
*
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
// SuccessResultList<List<RoleGroupDTO>> listRoleGroup(ListPage page);
|
||||
|
||||
/**
|
||||
* 角色组选择列表
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
// List<RoleGroupDTO> listSelectRoleGroup(Map<String, Object> params);
|
||||
|
||||
}
|
@ -1,5 +1,10 @@
|
||||
package ink.wgink.service.role.service;
|
||||
|
||||
import ink.wgink.pojo.dtos.role.RoleMenuDTO;
|
||||
import ink.wgink.service.role.pojo.vos.RoleMenuVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
@ -11,4 +16,21 @@ package ink.wgink.service.role.service;
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public interface IRoleMenuService {
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param roleId
|
||||
* @param roleMenuVO
|
||||
*/
|
||||
void update(String roleId, RoleMenuVO roleMenuVO);
|
||||
|
||||
/**
|
||||
* 角色菜单列表
|
||||
*
|
||||
* @param roleId
|
||||
* @return
|
||||
*/
|
||||
List<RoleMenuDTO> list(String roleId);
|
||||
|
||||
}
|
||||
|
@ -1,11 +1,10 @@
|
||||
package ink.wgink.service.role.service;
|
||||
|
||||
import ink.wgink.exceptions.SearchException;
|
||||
import ink.wgink.exceptions.UpdateException;
|
||||
import ink.wgink.pojo.dtos.role.RolePermissionDTO;
|
||||
import ink.wgink.service.role.pojo.vos.RolePermissionVO;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
@ -20,24 +19,37 @@ import java.util.List;
|
||||
public interface IRolePermissionService {
|
||||
|
||||
/**
|
||||
* 修改权限(通过角色)
|
||||
* 新增权限
|
||||
*/
|
||||
String PERMISSION_INSERT = "insert";
|
||||
/**
|
||||
* 删除权限
|
||||
*/
|
||||
String PERMISSION_DELETE = "delete";
|
||||
/**
|
||||
* 修改权限
|
||||
*/
|
||||
String PERMISSION_UPDATE = "update";
|
||||
/**
|
||||
* 查询权限
|
||||
*/
|
||||
String PERMISSION_QUERY = "query";
|
||||
|
||||
/**
|
||||
* 更新权限
|
||||
*
|
||||
* @param roleId
|
||||
* @param rolePermissionVO
|
||||
* @return
|
||||
* @throws UpdateException
|
||||
*/
|
||||
void updateByRoleId(String roleId, RolePermissionVO rolePermissionVO);
|
||||
void update(String roleId, RolePermissionVO rolePermissionVO);
|
||||
|
||||
/**
|
||||
* 权限角色
|
||||
* 权限列表
|
||||
*
|
||||
* @param permissionId
|
||||
* @param roleId
|
||||
* @param params
|
||||
* @return
|
||||
* @throws SearchException
|
||||
*/
|
||||
RolePermissionDTO getByPermissionIdAndRoleId(String permissionId, String roleId);
|
||||
List<RolePermissionDTO> list(Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 权限列表
|
||||
@ -45,6 +57,15 @@ public interface IRolePermissionService {
|
||||
* @param roleId 角色ID
|
||||
* @return
|
||||
*/
|
||||
List<RolePermissionDTO> listByRoleId(String roleId);
|
||||
List<RolePermissionDTO> list(String roleId);
|
||||
|
||||
/**
|
||||
* 权限列表
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @param permissionType 权限类型
|
||||
* @return
|
||||
*/
|
||||
List<RolePermissionDTO> list(String roleId, String permissionType);
|
||||
|
||||
}
|
||||
|
@ -1,23 +1,12 @@
|
||||
package ink.wgink.service.role.service;
|
||||
|
||||
import ink.wgink.exceptions.RemoveException;
|
||||
import ink.wgink.exceptions.SaveException;
|
||||
import ink.wgink.exceptions.SearchException;
|
||||
import ink.wgink.exceptions.UpdateException;
|
||||
import ink.wgink.interfaces.role.IRoleBaseService;
|
||||
import ink.wgink.interfaces.role.IRoleCheckService;
|
||||
import ink.wgink.pojo.ListPage;
|
||||
import ink.wgink.pojo.bos.DepartmentBO;
|
||||
import ink.wgink.pojo.bos.GroupBO;
|
||||
import ink.wgink.pojo.bos.RoleBO;
|
||||
import ink.wgink.pojo.bos.RoleMenuBO;
|
||||
import ink.wgink.pojo.dtos.ZTreeDTO;
|
||||
import ink.wgink.pojo.dtos.role.RoleDTO;
|
||||
import ink.wgink.pojo.dtos.role.RoleDataAuthorityDTO;
|
||||
import ink.wgink.pojo.dtos.role.RoleDataAuthorityTypeDTO;
|
||||
import ink.wgink.pojo.result.SuccessResult;
|
||||
import ink.wgink.pojo.result.SuccessResultList;
|
||||
import ink.wgink.service.role.pojo.vos.RoleDataAuthorityVO;
|
||||
import ink.wgink.service.role.pojo.vos.RoleVO;
|
||||
|
||||
import java.util.List;
|
||||
@ -105,6 +94,14 @@ public interface IRoleService extends IRoleBaseService, IRoleCheckService {
|
||||
*/
|
||||
void update(String roleId, RoleVO roleVO);
|
||||
|
||||
/**
|
||||
* 修改角色数据权限
|
||||
*
|
||||
* @param roleId
|
||||
* @param roleDataRight
|
||||
*/
|
||||
void updateRoleDataRight(String roleId, String roleDataRight);
|
||||
|
||||
/**
|
||||
* 角色详情
|
||||
*
|
||||
|
@ -0,0 +1,35 @@
|
||||
package ink.wgink.service.role.service;
|
||||
|
||||
import ink.wgink.interfaces.role.IRoleUserBaseService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: IRoleUserService
|
||||
* @Description: 角色用户
|
||||
* @Author: WangGeng
|
||||
* @Date: 2021/2/18 11:24
|
||||
* @Version: 1.0
|
||||
**/
|
||||
public interface IRoleUserService extends IRoleUserBaseService {
|
||||
|
||||
/**
|
||||
* 更新用户组人员列表
|
||||
*
|
||||
* @param groupId 用户组ID
|
||||
* @param userIds 用户ID列表
|
||||
*/
|
||||
void update(String groupId, List<String> userIds);
|
||||
|
||||
/**
|
||||
* 用户组人员删除
|
||||
*
|
||||
* @param groupId 用户组ID
|
||||
* @param userIds 用户ID列表
|
||||
*/
|
||||
void delete(String groupId, List<String> userIds);
|
||||
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
package ink.wgink.service.role.service.impl;
|
||||
|
||||
import ink.wgink.common.base.DefaultBaseService;
|
||||
import ink.wgink.common.enums.RoleDataRightEnum;
|
||||
import ink.wgink.exceptions.SearchException;
|
||||
import ink.wgink.interfaces.department.IDepartmentUserBaseService;
|
||||
import ink.wgink.pojo.dtos.role.RoleDTO;
|
||||
import ink.wgink.pojo.dtos.role.RoleDataRightDTO;
|
||||
import ink.wgink.pojo.dtos.role.RoleDataRightInfoDTO;
|
||||
import ink.wgink.service.role.dao.IRoleDataRightDao;
|
||||
import ink.wgink.service.role.pojo.vos.RoleDataRightVO;
|
||||
import ink.wgink.service.role.service.IRoleDataRightService;
|
||||
import ink.wgink.service.role.service.IRoleService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: RoleDataRightServiceImpl
|
||||
* @Description: 角色数据权限
|
||||
* @Author: WangGeng
|
||||
* @Date: 2021/2/21 18:32
|
||||
* @Version: 1.0
|
||||
**/
|
||||
@Service
|
||||
public class RoleDataRightServiceImpl extends DefaultBaseService implements IRoleDataRightService {
|
||||
|
||||
@Autowired
|
||||
private IRoleDataRightDao roleDataRightDao;
|
||||
@Autowired
|
||||
private IRoleService roleService;
|
||||
|
||||
@Override
|
||||
public void update(String roleId, RoleDataRightVO roleDataRightVO) {
|
||||
roleService.updateRoleDataRight(roleId, roleDataRightVO.getRoleDataRight());
|
||||
// 删除角色数据权限
|
||||
Map<String, Object> params = getHashMap(4);
|
||||
params.put("roleId", roleId);
|
||||
roleDataRightDao.delete(params);
|
||||
if (StringUtils.equals(roleDataRightVO.getRoleDataRight(), RoleDataRightEnum.CUSTOM.getValue())) {
|
||||
// 更新自定义权限用户列表
|
||||
for (String userId : roleDataRightVO.getUserIds()) {
|
||||
params.put("userId", userId);
|
||||
roleDataRightDao.save(params);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleDataRightInfoDTO get(String roleId) {
|
||||
RoleDTO roleDTO = roleService.get(roleId);
|
||||
if (roleDTO == null) {
|
||||
throw new SearchException("角色不存在");
|
||||
}
|
||||
List<String> userIds = new ArrayList<>();
|
||||
if (StringUtils.equals(roleDTO.getRoleDataRight(), RoleDataRightEnum.CUSTOM.getValue())) {
|
||||
List<RoleDataRightDTO> roleDataRightDTOs = list(roleId);
|
||||
for (RoleDataRightDTO roleDataRightDTO : roleDataRightDTOs) {
|
||||
userIds.add(roleDataRightDTO.getUserId());
|
||||
}
|
||||
}
|
||||
RoleDataRightInfoDTO roleDataRightInfoDTO = new RoleDataRightInfoDTO();
|
||||
roleDataRightInfoDTO.setRoleDataRight(roleDTO.getRoleDataRight());
|
||||
roleDataRightInfoDTO.setUserIds(userIds);
|
||||
return roleDataRightInfoDTO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RoleDataRightDTO> list(Map<String, Object> params) {
|
||||
return roleDataRightDao.list(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RoleDataRightDTO> list(String roleId) {
|
||||
Map<String, Object> params = getHashMap(2);
|
||||
params.put("roleId", roleId);
|
||||
return list(params);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
package ink.wgink.service.role.service.impl;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: RoleGroupServiceImpl
|
||||
* @Description: 角色组
|
||||
* @Author: wanggeng
|
||||
* @Date: 2021/2/5 8:55 上午
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@Service
|
||||
public class RoleGroupServiceImpl {
|
||||
|
||||
// @Override
|
||||
// public SuccessResultList<List<RoleGroupDTO>> listRoleGroup(ListPage page) {
|
||||
// PageHelper.startPage(page.getPage(), page.getRows());
|
||||
// List<RoleGroupDTO> roleGroupDTOs = groupDao.listRoleGroups(page.getParams());
|
||||
// PageInfo<RoleGroupDTO> pageInfo = new PageInfo<>(roleGroupDTOs);
|
||||
// return new SuccessResultList<>(roleGroupDTOs, pageInfo.getPageNum(), pageInfo.getTotal());
|
||||
// }
|
||||
|
||||
// @Override
|
||||
// public List<RoleGroupDTO> listSelectRoleGroup(Map<String, Object> params) {
|
||||
// return groupDao.listRoleGroups(params);
|
||||
// }
|
||||
|
||||
}
|
@ -1,9 +1,16 @@
|
||||
package ink.wgink.service.role.service.impl;
|
||||
|
||||
import ink.wgink.common.base.DefaultBaseService;
|
||||
import ink.wgink.pojo.dtos.role.RoleMenuDTO;
|
||||
import ink.wgink.service.role.dao.IRoleMenuDao;
|
||||
import ink.wgink.service.role.pojo.vos.RoleMenuVO;
|
||||
import ink.wgink.service.role.service.IRoleMenuService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
@ -17,4 +24,24 @@ import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
public class RoleMenuServiceImpl extends DefaultBaseService implements IRoleMenuService {
|
||||
|
||||
@Autowired
|
||||
private IRoleMenuDao roleMenuDao;
|
||||
|
||||
@Override
|
||||
public void update(String roleId, RoleMenuVO roleMenuVO) {
|
||||
Map<String, Object> params = getHashMap(4);
|
||||
params.put("roleId", roleId);
|
||||
roleMenuDao.delete(params);
|
||||
for (String menuId : roleMenuVO.getMenuIds()) {
|
||||
params.put("menuId", menuId);
|
||||
roleMenuDao.save(params);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RoleMenuDTO> list(String roleId) {
|
||||
Map<String, Object> params = getHashMap(2);
|
||||
params.put("roleId", roleId);
|
||||
return roleMenuDao.list(params);
|
||||
}
|
||||
}
|
||||
|
@ -30,86 +30,41 @@ public class RolePermissionServiceImpl extends DefaultBaseService implements IRo
|
||||
|
||||
@Autowired
|
||||
private IRolePermissionDao rolePermissionDao;
|
||||
@Autowired
|
||||
private IPermissionService permissionService;
|
||||
|
||||
@Override
|
||||
public void updateByRoleId(String roleId, RolePermissionVO rolePermissionVO) {
|
||||
public void update(String roleId, RolePermissionVO rolePermissionVO) {
|
||||
// 清空原有内容
|
||||
Map<String, Object> params = getHashMap(4);
|
||||
params.put("roleId", roleId);
|
||||
params.put("permissionType", rolePermissionVO.getType());
|
||||
rolePermissionDao.delete(params);
|
||||
for (String permissionId : rolePermissionVO.getPermissionIds()) {
|
||||
String[] permissionIdArray = permissionId.split("\\_");
|
||||
params.put("apiTag", permissionIdArray[0]);
|
||||
params.put("permissionId", permissionIdArray[1]);
|
||||
rolePermissionDao.save(params);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RolePermissionDTO> list(Map<String, Object> params) {
|
||||
return rolePermissionDao.list(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RolePermissionDTO> list(String roleId) {
|
||||
Map<String, Object> params = getHashMap(2);
|
||||
params.put("roleId", roleId);
|
||||
if (rolePermissionVO.getChecked()) {
|
||||
LOG.debug("新增权限角色,roleId: {}", roleId);
|
||||
for (String permissionId : rolePermissionVO.getPermissionIdArray()) {
|
||||
if (getByPermissionIdAndRoleId(permissionId, roleId) != null) {
|
||||
continue;
|
||||
}
|
||||
params.put("permissionId", permissionId);
|
||||
rolePermissionDao.save(params);
|
||||
}
|
||||
} else {
|
||||
LOG.debug("删除权限角色,roleId: {}", roleId);
|
||||
params.put("permissionIds", rolePermissionVO.getPermissionIdArray());
|
||||
rolePermissionDao.delete(params);
|
||||
}
|
||||
return list(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RolePermissionDTO getByPermissionIdAndRoleId(String permissionId, String roleId) {
|
||||
PermissionDTO permissionDTO = permissionService.get(permissionId);
|
||||
if (permissionDTO == null) {
|
||||
return null;
|
||||
}
|
||||
Map<String, Object> params = getHashMap(2);
|
||||
params.put("permissionId", permissionId);
|
||||
public List<RolePermissionDTO> list(String roleId, String permissionType) {
|
||||
Map<String, Object> params = getHashMap(4);
|
||||
params.put("roleId", roleId);
|
||||
RolePermissionDTO rolePermissionDTO = rolePermissionDao.get(params);
|
||||
if (rolePermissionDTO == null) {
|
||||
return null;
|
||||
}
|
||||
rolePermissionDTO.setPermissionTitle(permissionDTO.getPermissionTitle());
|
||||
rolePermissionDTO.setPermissionType(permissionDTO.getPermissionType());
|
||||
rolePermissionDTO.setPermissionUrl(permissionDTO.getPermissionUrl());
|
||||
// rolePermissionDTO.setPermissionClientId(permissionDTO.getPermissionClientId());
|
||||
// rolePermissionDTO.setPermissionClientName(permissionDTO.getPermissionClientName());
|
||||
rolePermissionDTO.setIsPublic(permissionDTO.getIsPublic());
|
||||
return rolePermissionDTO;
|
||||
params.put("permissionType", permissionType);
|
||||
return list(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RolePermissionDTO> listByRoleId(String roleId) {
|
||||
List<RolePermissionDTO> rolePermissionDTOs = rolePermissionDao.listByRoleId(roleId);
|
||||
if (rolePermissionDTOs.isEmpty()) {
|
||||
return rolePermissionDTOs;
|
||||
}
|
||||
List<String> permissionIds = new ArrayList<>();
|
||||
for (RolePermissionDTO rolePermissionDTO : rolePermissionDTOs) {
|
||||
permissionIds.add(rolePermissionDTO.getPermissionId());
|
||||
}
|
||||
List<PermissionDTO> permissionDTOs = permissionService.listByIds(permissionIds);
|
||||
if (permissionDTOs.isEmpty()) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
for (int i = 0; i < rolePermissionDTOs.size(); i++) {
|
||||
RolePermissionDTO rolePermissionDTO = rolePermissionDTOs.get(i);
|
||||
boolean isExist = false;
|
||||
for (PermissionDTO permissionDTO : permissionDTOs) {
|
||||
if (StringUtils.equals(rolePermissionDTO.getPermissionId(), permissionDTO.getPermissionId())) {
|
||||
isExist = true;
|
||||
rolePermissionDTO.setPermissionTitle(permissionDTO.getPermissionTitle());
|
||||
rolePermissionDTO.setPermissionType(permissionDTO.getPermissionType());
|
||||
rolePermissionDTO.setPermissionUrl(permissionDTO.getPermissionUrl());
|
||||
// rolePermissionDTO.setPermissionClientId(permissionDTO.getPermissionClientId());
|
||||
// rolePermissionDTO.setPermissionClientName(permissionDTO.getPermissionClientName());
|
||||
rolePermissionDTO.setIsPublic(permissionDTO.getIsPublic());
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!isExist) {
|
||||
rolePermissionDTOs.remove(i);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
return rolePermissionDTOs;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -72,6 +72,15 @@ public class RoleServiceImpl extends DefaultBaseService implements IRoleService
|
||||
roleDao.update(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateRoleDataRight(String roleId, String roleDataRight) {
|
||||
Map<String, Object> params = getHashMap(4);
|
||||
params.put("roleId", roleId);
|
||||
params.put("roleDataRight", roleDataRight);
|
||||
setUpdateInfo(params);
|
||||
roleDao.update(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleDTO get(Map<String, Object> params) throws SearchException {
|
||||
return roleDao.get(params);
|
||||
|
@ -0,0 +1,122 @@
|
||||
package ink.wgink.service.role.service.impl;
|
||||
|
||||
import ink.wgink.common.base.DefaultBaseService;
|
||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||
import ink.wgink.interfaces.user.IUserBaseService;
|
||||
import ink.wgink.pojo.ListPage;
|
||||
import ink.wgink.pojo.dtos.role.RoleUserDTO;
|
||||
import ink.wgink.pojo.dtos.user.UserDTO;
|
||||
import ink.wgink.pojo.result.SuccessResultList;
|
||||
import ink.wgink.service.role.dao.IRoleUserDao;
|
||||
import ink.wgink.service.role.service.IRoleUserService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
* 当你想要放弃的时候,想想当初你为何开始
|
||||
*
|
||||
* @ClassName: RoleUserServiceImpl
|
||||
* @Description: 角色用户
|
||||
* @Author: WangGeng
|
||||
* @Date: 2021/2/18 11:24
|
||||
* @Version: 1.0
|
||||
**/
|
||||
@Service
|
||||
public class RoleUserServiceImpl extends DefaultBaseService implements IRoleUserService {
|
||||
|
||||
@Autowired
|
||||
private IRoleUserDao roleUserDao;
|
||||
@Autowired
|
||||
private IUserBaseService userBaseService;
|
||||
|
||||
@Override
|
||||
public void update(String roleId, List<String> userIds) {
|
||||
delete(roleId, userIds);
|
||||
if (!userIds.isEmpty()) {
|
||||
Map<String, Object> params = getHashMap(4);
|
||||
params.put("roleId", roleId);
|
||||
for (String userId : userIds) {
|
||||
params.put("userId", userId);
|
||||
roleUserDao.save(params);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(String roleId, List<String> userIds) {
|
||||
Map<String, Object> params = getHashMap(4);
|
||||
params.put("roleId", roleId);
|
||||
params.put("userIds", userIds);
|
||||
roleUserDao.delete(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> listUserId(String roleId) {
|
||||
Map<String, Object> params = getHashMap(2);
|
||||
params.put("roleId", roleId);
|
||||
return roleUserDao.listUserId(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> listUserId(List<String> roleIds) {
|
||||
Map<String, Object> params = getHashMap(2);
|
||||
params.put("roleIds", roleIds);
|
||||
return roleUserDao.listUserId(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuccessResultList<List<RoleUserDTO>> listPage(String roleId, ListPage page) {
|
||||
SuccessResultList<List<UserDTO>> successResultList;
|
||||
if (StringUtils.equals(roleId, ISystemConstant.TREE_BASE_ROOT_ID_VALUE)) {
|
||||
successResultList = listPageUserDTOByExcludeRole(page);
|
||||
} else {
|
||||
successResultList = listPageUser(roleId, page);
|
||||
}
|
||||
List<UserDTO> userDTOs = successResultList.getRows();
|
||||
List<RoleUserDTO> roleUserDTOs = new ArrayList<>();
|
||||
for (UserDTO userDTO : userDTOs) {
|
||||
RoleUserDTO roleUserDTO = new RoleUserDTO(userDTO);
|
||||
roleUserDTOs.add(roleUserDTO);
|
||||
}
|
||||
return new SuccessResultList<>(roleUserDTOs, successResultList.getPage(), successResultList.getTotal());
|
||||
}
|
||||
|
||||
|
||||
private List<String> listGroupUserId(Map<String, Object> params) {
|
||||
return roleUserDao.listGroupUserId(params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 没有用户组的用户分页列表
|
||||
*
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
private SuccessResultList<List<UserDTO>> listPageUserDTOByExcludeRole(ListPage page) {
|
||||
List<String> hasRoleUserIds = listGroupUserId(new HashMap<>(0));
|
||||
return userBaseService.listPageByExcludeIds(hasRoleUserIds, page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户组的用户分页列表
|
||||
*
|
||||
* @param roleId 用户组ID
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
private SuccessResultList<List<UserDTO>> listPageUser(String roleId, ListPage page) {
|
||||
List<String> userIds = listUserId(roleId);
|
||||
if (userIds.isEmpty()) {
|
||||
return new SuccessResultList<>(new ArrayList<>(), 1, 0L);
|
||||
}
|
||||
return userBaseService.listPageByIds(userIds, page);
|
||||
}
|
||||
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
package ink.wgink.service.role.startup;
|
||||
|
||||
import ink.wgink.pojo.dtos.user.UserDTO;
|
||||
import ink.wgink.service.role.dao.IRoleDao;
|
||||
import ink.wgink.service.role.dao.*;
|
||||
import ink.wgink.util.date.DateUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@ -29,6 +29,14 @@ public class ServiceRoleStartUp implements ApplicationRunner {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ServiceRoleStartUp.class);
|
||||
@Autowired
|
||||
private IRoleDao roleDao;
|
||||
@Autowired
|
||||
private IRoleUserDao roleUserDao;
|
||||
@Autowired
|
||||
private IRolePermissionDao rolePermissionDao;
|
||||
@Autowired
|
||||
private IRoleDataRightDao roleDataRightDao;
|
||||
@Autowired
|
||||
private IRoleMenuDao roleMenuDao;
|
||||
|
||||
@Override
|
||||
public void run(ApplicationArguments args) throws Exception {
|
||||
@ -41,6 +49,18 @@ public class ServiceRoleStartUp implements ApplicationRunner {
|
||||
private void initTable() {
|
||||
LOG.debug("创建 sys_role 表");
|
||||
roleDao.createTable();
|
||||
|
||||
LOG.debug("创建 sys_role_user 表");
|
||||
roleUserDao.createTable();
|
||||
|
||||
LOG.debug("创建 sys_role_permission 表");
|
||||
rolePermissionDao.createTable();
|
||||
|
||||
LOG.debug("创建 sys_role_data_right 表");
|
||||
roleDataRightDao.createTable();
|
||||
|
||||
LOG.debug("创建 sys_role_menu 表");
|
||||
roleMenuDao.createTable();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,57 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="ink.wgink.service.role.dao.IRoleDataRightDao">
|
||||
|
||||
<cache flushInterval="3600000"/>
|
||||
|
||||
<resultMap id="roleDataRightDTO" type="ink.wgink.pojo.dtos.role.RoleDataRightDTO">
|
||||
<result column="role_id" property="roleId"/>
|
||||
<result column="user_id" property="userId"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 建表 -->
|
||||
<update id="createTable">
|
||||
CREATE TABLE IF NOT EXISTS `sys_role_data_right` (
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`role_id` char(36) DEFAULT NULL COMMENT '角色ID',
|
||||
`user_id` char(36) DEFAULT NULL COMMENT '用户ID',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `role_id` (`role_id`) USING BTREE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
</update>
|
||||
|
||||
<!-- 新增 -->
|
||||
<insert id="save" parameterType="map" flushCache="true">
|
||||
INSERT INTO sys_role_data_right(
|
||||
role_id,
|
||||
user_id
|
||||
) VALUES(
|
||||
#{roleId},
|
||||
#{userId}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!-- 删除 -->
|
||||
<delete id="delete" parameterType="map" flushCache="true">
|
||||
DELETE FROM
|
||||
sys_role_data_right
|
||||
WHERE
|
||||
role_id = #{roleId}
|
||||
</delete>
|
||||
|
||||
<!-- 数据权限列表 -->
|
||||
<select id="list" parameterType="map" resultMap="roleDataRightDTO" useCache="true">
|
||||
SELECT
|
||||
role_id,
|
||||
user_id
|
||||
FROM
|
||||
sys_role_data_right
|
||||
WHERE
|
||||
1 = 1
|
||||
<if test="roleId != null and roleId != ''">
|
||||
AND
|
||||
role_id = #{roleId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -1,94 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.cm.serviceusercenter.dao.system.group.IGroupDao">
|
||||
|
||||
<!-- <resultMap id="roleGroupDTO" type="com.cm.serviceusercenter.pojo.dtos.RoleGroupDTO">-->
|
||||
<!-- <id property="groupId" column="group_id"/>-->
|
||||
<!-- <result property="groupName" column="group_name"/>-->
|
||||
<!-- <result property="groupSummary" column="group_summary"/>-->
|
||||
<!-- <result property="groupCode" column="group_code"/>-->
|
||||
<!-- <result property="roleId" column="role_id"/>-->
|
||||
<!-- <result property="roleName" column="role_name"/>-->
|
||||
<!-- </resultMap>-->
|
||||
|
||||
<!-- 添加角色人员 -->
|
||||
<!-- <insert id="saveRoleGroup" parameterType="map">-->
|
||||
<!-- INSERT INTO sys_role_group(-->
|
||||
<!-- group_id,-->
|
||||
<!-- role_id-->
|
||||
<!-- ) VALUES(-->
|
||||
<!-- #{groupId},-->
|
||||
<!-- #{roleId}-->
|
||||
<!-- )-->
|
||||
<!-- </insert>-->
|
||||
|
||||
<!-- 删除组人员 -->
|
||||
<!-- <delete id="removeRoleGroup" parameterType="map">-->
|
||||
<!-- delete from-->
|
||||
<!-- sys_role_group-->
|
||||
<!-- where-->
|
||||
<!-- 1 = 1-->
|
||||
<!-- <if test="roleId != null and roleId != ''">-->
|
||||
<!-- AND-->
|
||||
<!-- role_id = #{roleId}-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="groupId != null and groupId != ''">-->
|
||||
<!-- AND-->
|
||||
<!-- group_id = #{groupId}-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="groupIds != null and groupIds.size > 0">-->
|
||||
<!-- AND-->
|
||||
<!-- group_id IN-->
|
||||
<!-- <foreach collection="groupIds" index="index" open="(" separator="," close=")">-->
|
||||
<!-- #{groupIds[${index}]}-->
|
||||
<!-- </foreach>-->
|
||||
<!-- </if>-->
|
||||
<!-- </delete>-->
|
||||
|
||||
<!-- 角色组列表 -->
|
||||
<!-- <select id="listRoleGroups" parameterType="map" resultMap="roleGroupDTO">-->
|
||||
<!-- SELECT-->
|
||||
<!-- t2.group_id,-->
|
||||
<!-- t2.group_name,-->
|
||||
<!-- t2.group_summary,-->
|
||||
<!-- t2.group_code,-->
|
||||
<!-- t3.role_id,-->
|
||||
<!-- t3.role_name-->
|
||||
<!-- FROM-->
|
||||
<!-- sys_role_group t1-->
|
||||
<!-- INNER JOIN-->
|
||||
<!-- sys_group t2-->
|
||||
<!-- ON-->
|
||||
<!-- t1.group_id = t2.group_id-->
|
||||
<!-- INNER JOIN-->
|
||||
<!-- sys_role t3-->
|
||||
<!-- ON-->
|
||||
<!-- t1.role_id = t3.role_id-->
|
||||
<!-- WHERE-->
|
||||
<!-- t2.is_delete = 0 AND t3.is_delete = 0-->
|
||||
<!-- <if test="roleId != null and roleId != ''">-->
|
||||
<!-- AND-->
|
||||
<!-- t1.role_id = #{roleId}-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="keywords != null and keywords != ''">-->
|
||||
<!-- AND-->
|
||||
<!-- group_name LIKE CONCAT('%', #{keywords}, '%')-->
|
||||
<!-- </if>-->
|
||||
<!-- <choose>-->
|
||||
<!-- <when test="sort != null and (sort == 'groupName' or sort == 'groupCode')">-->
|
||||
<!-- ORDER BY-->
|
||||
<!-- <if test="sort == 'groupName'">-->
|
||||
<!-- group_name ${order}-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="sort == 'groupCode'">-->
|
||||
<!-- group_code ${order}-->
|
||||
<!-- </if>-->
|
||||
<!-- </when>-->
|
||||
<!-- <otherwise>-->
|
||||
<!-- ORDER BY-->
|
||||
<!-- t2.gmt_create desc-->
|
||||
<!-- </otherwise>-->
|
||||
<!-- </choose>-->
|
||||
<!-- </select>-->
|
||||
|
||||
</mapper>
|
@ -11,7 +11,7 @@
|
||||
<result property="roleName" column="role_name"/>
|
||||
<result property="roleSummary" column="role_summary"/>
|
||||
<result property="roleCode" column="role_code"/>
|
||||
<result property="roleDataAuthority" column="role_data_authority"/>
|
||||
<result property="roleDataRight" column="role_data_right"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="roleZTreeDTO" type="ink.wgink.pojo.dtos.ZTreeDTO">
|
||||
@ -29,7 +29,7 @@
|
||||
`role_name` varchar(255) DEFAULT NULL COMMENT '角色名称',
|
||||
`role_summary` varchar(255) DEFAULT NULL COMMENT '角色说明',
|
||||
`role_code` varchar(255) DEFAULT NULL COMMENT '角色编码',
|
||||
`role_data_authority` varchar(20) DEFAULT 'self' COMMENT '数据权限',
|
||||
`role_data_right` varchar(20) DEFAULT 'self' COMMENT '数据权限',
|
||||
`creator` char(36) DEFAULT NULL,
|
||||
`gmt_create` datetime DEFAULT NULL,
|
||||
`modifier` char(36) DEFAULT NULL,
|
||||
@ -38,8 +38,6 @@
|
||||
PRIMARY KEY (`id`,`role_id`),
|
||||
UNIQUE KEY `role_id` (`role_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
</update>
|
||||
|
||||
<!-- 新增角色 -->
|
||||
@ -98,8 +96,8 @@
|
||||
<if test="roleSummary != null">
|
||||
role_summary = #{roleSummary},
|
||||
</if>
|
||||
<if test="roleDataAuthority != null and roleDataAuthority != ''">
|
||||
role_data_authority = #{roleDataAuthority},
|
||||
<if test="roleDataRight != null and roleDataRight != ''">
|
||||
role_data_right = #{roleDataRight},
|
||||
</if>
|
||||
modifier = #{modifier},
|
||||
gmt_modified = #{gmtModified}
|
||||
|
@ -0,0 +1,57 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="ink.wgink.service.role.dao.IRoleMenuDao">
|
||||
|
||||
<cache flushInterval="3600000"/>
|
||||
|
||||
<resultMap id="roleMenuDTO" type="ink.wgink.pojo.dtos.role.RoleMenuDTO">
|
||||
<result column="role_id" property="roleId"/>
|
||||
<result column="menu_id" property="menuId"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 建表 -->
|
||||
<update id="createTable">
|
||||
CREATE TABLE IF NOT EXISTS `sys_role_menu` (
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`role_id` char(36) DEFAULT NULL COMMENT '角色ID',
|
||||
`menu_id` char(36) DEFAULT NULL COMMENT '菜单ID',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `role_id` (`role_id`) USING BTREE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
</update>
|
||||
|
||||
<!-- 新增 -->
|
||||
<insert id="save" parameterType="map" flushCache="true">
|
||||
INSERT INTO sys_role_menu(
|
||||
role_id,
|
||||
menu_id
|
||||
) VALUES(
|
||||
#{roleId},
|
||||
#{menuId}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!-- 删除 -->
|
||||
<delete id="delete" parameterType="map" flushCache="true">
|
||||
DELETE FROM
|
||||
sys_role_menu
|
||||
WHERE
|
||||
role_id = #{roleId}
|
||||
</delete>
|
||||
|
||||
<!-- 数据权限列表 -->
|
||||
<select id="list" parameterType="map" resultMap="roleMenuDTO" useCache="true">
|
||||
SELECT
|
||||
role_id,
|
||||
menu_id
|
||||
FROM
|
||||
sys_role_menu
|
||||
WHERE
|
||||
1 = 1
|
||||
<if test="roleId != null and roleId != ''">
|
||||
AND
|
||||
role_id = #{roleId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -2,62 +2,89 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="ink.wgink.service.role.dao.IRolePermissionDao">
|
||||
|
||||
<cache flushInterval="3600000"/>
|
||||
|
||||
<resultMap id="rolePermissionDTO" type="ink.wgink.pojo.dtos.role.RolePermissionDTO">
|
||||
<id column="permission_id" property="permissionId"/>
|
||||
<result column="role_id" property="roleId"/>
|
||||
<result column="api_tag" property="apiTag"/>
|
||||
<result column="permission_id" property="permissionId"/>
|
||||
<result column="permission_type" property="permissionType"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 建表 -->
|
||||
<update id="createTable">
|
||||
CREATE TABLE IF NOT EXISTS `sys_role_permission` (
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`role_id` char(36) DEFAULT NULL COMMENT '角色ID',
|
||||
`api_tag` varchar(255) DEFAULT NULL COMMENT '接口标识',
|
||||
`permission_id` char(36) DEFAULT NULL COMMENT '权限ID',
|
||||
`permission_type` char(36) DEFAULT NULL COMMENT '权限类型',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `role_id` (`role_id`),
|
||||
KEY `permission_type` (`permission_type`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
</update>
|
||||
|
||||
<!-- 新增权限角色 -->
|
||||
<insert id="save" parameterType="map">
|
||||
<insert id="save" parameterType="map" flushCache="true">
|
||||
INSERT INTO sys_role_permission (
|
||||
role_id,
|
||||
api_tag,
|
||||
permission_id,
|
||||
role_id
|
||||
permission_type
|
||||
) VALUES(
|
||||
#{roleId},
|
||||
#{apiTag},
|
||||
#{permissionId},
|
||||
#{roleId}
|
||||
#{permissionType}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!-- 删除权限角色 -->
|
||||
<delete id="delete" parameterType="map">
|
||||
<!-- 删除 -->
|
||||
<delete id="delete" parameterType="map" flushCache="true">
|
||||
DELETE FROM
|
||||
sys_role_permission
|
||||
WHERE
|
||||
role_id = #{roleId}
|
||||
<if test="permissionType != null and permissionType != ''">
|
||||
AND
|
||||
permission_type = #{permissionType}
|
||||
</if>
|
||||
<if test="permissionIds != null and permissionIds.size > 0">
|
||||
AND
|
||||
permission_id IN
|
||||
<foreach collection="permissionIds" index="index" open="(" separator="," close=")">
|
||||
#{permissionIds[${index}]}
|
||||
</foreach>
|
||||
<foreach collection="permissionIds" index="index" open="(" separator="," close=")">
|
||||
#{permissionType[${index}]}
|
||||
</foreach>
|
||||
</if>
|
||||
</delete>
|
||||
|
||||
<!-- 权限角色详情 -->
|
||||
<select id="get" parameterType="map" resultMap="rolePermissionDTO">
|
||||
<!-- 权限列表 -->
|
||||
<select id="list" parameterType="map" resultMap="rolePermissionDTO" useCache="true">
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
sys_role_permission
|
||||
WHERE
|
||||
permission_id = #{permissionId}
|
||||
AND
|
||||
role_id = #{roleId}
|
||||
</select>
|
||||
|
||||
<!-- 权限列表(通过角色ID) -->
|
||||
<select id="listByRoleId" parameterType="java.lang.String" resultMap="rolePermissionDTO">
|
||||
SELECT
|
||||
jt1.*,
|
||||
t1.role_id
|
||||
t1.role_id,
|
||||
t1.api_tag,
|
||||
t1.permission_id,
|
||||
t1.permission_type
|
||||
FROM
|
||||
sys_role_permission t1
|
||||
INNER JOIN
|
||||
sys_permission jt1
|
||||
ON
|
||||
t1.permission_id = jt1.permission_id
|
||||
AND
|
||||
jt1.is_delete = 0
|
||||
WHERE
|
||||
t1.role_id = #{_parameter}
|
||||
1 = 1
|
||||
<if test="roleId != null and roleId != ''">
|
||||
AND
|
||||
t1.role_id = #{roleId}
|
||||
</if>
|
||||
<if test="permissionType != null and permissionType != ''">
|
||||
AND
|
||||
t1.permission_type = #{permissionType}
|
||||
</if>
|
||||
<if test="permissionIds != null and permissionIds.size > 0">
|
||||
AND
|
||||
t1.permission_id IN
|
||||
<foreach collection="permissionIds" index="index" open="(" separator="," close=")">
|
||||
#{permissionType[${index}]}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,85 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="ink.wgink.service.role.dao.IRoleUserDao">
|
||||
|
||||
<cache flushInterval="3600000"/>
|
||||
|
||||
<!-- 建表 -->
|
||||
<update id="createTable">
|
||||
CREATE TABLE IF NOT EXISTS `sys_role_user` (
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`role_id` char(36) NOT NULL COMMENT '组ID',
|
||||
`user_id` char(36) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `user_id_idx` (`user_id`) USING BTREE,
|
||||
KEY `role_id_idx` (`role_id`) USING BTREE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
</update>
|
||||
|
||||
<!-- 新增 -->
|
||||
<insert id="save" parameterType="map" flushCache="true">
|
||||
INSERT INTO sys_role_user(
|
||||
role_id,
|
||||
user_id
|
||||
) VALUES(
|
||||
#{roleId},
|
||||
#{userId}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!-- 删除 -->
|
||||
<delete id="delete" parameterType="map" flushCache="true">
|
||||
DELETE FROM
|
||||
sys_role_user
|
||||
WHERE
|
||||
1 = 1
|
||||
<if test="roleId != null and roleId != ''">
|
||||
AND
|
||||
role_id = #{roleId}
|
||||
</if>
|
||||
<if test="userId != null and userId != ''">
|
||||
AND
|
||||
user_id = #{userId}
|
||||
</if>
|
||||
<if test="userIds != null and userIds.size > 0">
|
||||
AND
|
||||
user_id IN
|
||||
<foreach collection="userIds" index="index" open="(" separator="," close=")">
|
||||
#{userIds[${index}]}
|
||||
</foreach>
|
||||
</if>
|
||||
</delete>
|
||||
|
||||
<!-- 用户ID列表 -->
|
||||
<select id="listUserId" parameterType="map" resultType="java.lang.String" useCache="true">
|
||||
SELECT
|
||||
user_id
|
||||
FROM
|
||||
sys_role_user
|
||||
WHERE
|
||||
<if test="roleId != null and roleId != ''">
|
||||
role_id = #{roleId}
|
||||
</if>
|
||||
<if test="roleIds != null and roleIds.size > 0">
|
||||
role_id IN (
|
||||
<foreach collection="roleIds" index="index" open="(" separator="," close=")">
|
||||
#{roleIds[${index}]}
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 用户ID列表 -->
|
||||
<select id="listRoleUserId" parameterType="map" resultType="java.lang.String" useCache="true">
|
||||
SELECT
|
||||
user_id
|
||||
FROM
|
||||
sys_role_user
|
||||
WHERE
|
||||
1 = 1
|
||||
GROUP BY
|
||||
user_id
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
@ -1,7 +1,7 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<base href="/usercenter/">
|
||||
<base th:href="${#request.getContextPath() + '/'}">
|
||||
<meta charset="utf-8">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
@ -20,7 +20,7 @@
|
||||
<div class="layui-card-body" style="height:100%;padding: 15px;">
|
||||
<form class="layui-form" lay-filter="dataForm">
|
||||
<div class="layui-form-item">
|
||||
<select name="dataAuthorityType" lay-filter="dataAuthorityType">
|
||||
<select name="roleDataRight" lay-filter="roleDataRight">
|
||||
<option value="all">全部</option>
|
||||
<option value="department">部门</option>
|
||||
<option value="custom">自定义</option>
|
||||
@ -50,36 +50,33 @@
|
||||
var $ = layui.$;
|
||||
var form = layui.form;
|
||||
var roleId = top.restAjax.params(window.location.href).roleId;
|
||||
var roleUserAuthorityList = [];
|
||||
var roleDataRightUserIds = [];
|
||||
var roleUsers = [];
|
||||
function closeBox() {
|
||||
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
||||
}
|
||||
// 初始化角色人员
|
||||
function initCustomRoleUsers(selectedUsers) {
|
||||
roleUserAuthorityList.splice(0, roleUserAuthorityList.length);
|
||||
roleDataRightUserIds.splice(0, roleDataRightUserIds.length);
|
||||
roleUsers.splice(0, roleUsers.length);
|
||||
$('#customUserBox').empty();
|
||||
for (var i = 0, item; item = selectedUsers[i++];) {
|
||||
roleUserAuthorityList.push({
|
||||
departmentId: item.departmentId,
|
||||
userId: item.userId
|
||||
});
|
||||
roleDataRightUserIds.push(item.userId);
|
||||
roleUsers.push({
|
||||
userName: item.userName,
|
||||
userTitle: item.userTitle
|
||||
userTitle: item.userUsername
|
||||
});
|
||||
}
|
||||
}
|
||||
// 初始化
|
||||
function initCustomData(ids) {
|
||||
$('#customUserBox').show();
|
||||
if(!ids) {
|
||||
if(!ids || ids.length == 0) {
|
||||
return;
|
||||
}
|
||||
var loadLayerIndex;
|
||||
top.restAjax.post(top.restAjax.path('api/user/listdepartmentuserbyids', []), {
|
||||
selectedUserIds: ids
|
||||
top.restAjax.post(top.restAjax.path('api/user/listbyids', []), {
|
||||
ids: ids
|
||||
}, null, function(code, data) {
|
||||
initCustomRoleUsers(data);
|
||||
setCustomRoleUsers();
|
||||
@ -94,16 +91,16 @@
|
||||
// 初始化
|
||||
function initData() {
|
||||
var loadLayerIndex;
|
||||
top.restAjax.get(top.restAjax.path('api/role/getroledataauthoritytype/{roleId}', [roleId]), {}, null, function(code, data) {
|
||||
top.restAjax.get(top.restAjax.path('api/role/data-right/get/{roleId}', [roleId]), {}, null, function(code, data) {
|
||||
form.val('dataForm', {
|
||||
dataAuthorityType: data.roleDataAuthorityType
|
||||
roleDataRight: data.roleDataRight
|
||||
});
|
||||
form.render(null, 'dataForm');
|
||||
if(data.roleDataAuthorityType === 'custom') {
|
||||
initCustomData(data.roleDataAuthority);
|
||||
if(data.roleDataRight === 'custom') {
|
||||
initCustomData(data.userIds);
|
||||
}
|
||||
}, function(code, data) {
|
||||
top.DialogBox.msg(data.msg);
|
||||
top.dialog.msg(data.msg);
|
||||
}, function() {
|
||||
loadLayerIndex = top.dialog.msg(top.dataMessage.loading, {icon: 16, time: 0, shade: 0.3});
|
||||
}, function() {
|
||||
@ -119,17 +116,11 @@
|
||||
// 打开自定义角色用户
|
||||
function openCustomRoleUsers() {
|
||||
$('#customUserBox').show();
|
||||
var selectedUsers = [];
|
||||
for(var i = 0, item = roleUserAuthorityList[i]; item = roleUserAuthorityList[i++];) {
|
||||
selectedUsers.push({
|
||||
userId: item.userId,
|
||||
departmentId: item.departmentId
|
||||
});
|
||||
}
|
||||
top.dialog.dialogData.selectedUsers = selectedUsers;
|
||||
console.log(roleDataRightUserIds)
|
||||
top.dialog.dialogData.selectedUserIds = roleDataRightUserIds.toString().replaceAll(',', '\_');
|
||||
top.dialog.open({
|
||||
url: top.restAjax.path('route/system/user/select-department-and-user.html', []),
|
||||
title: '选择组织部门人员',
|
||||
url: top.restAjax.path('route/department/user/select-user', []),
|
||||
title: '选择人员',
|
||||
width: '500px',
|
||||
height: '500px',
|
||||
onClose: function() {
|
||||
@ -139,7 +130,7 @@
|
||||
initCustomRoleUsers(selectedUsers);
|
||||
setCustomRoleUsers();
|
||||
} else {
|
||||
roleUserAuthorityList.splice(0, roleUserAuthorityList.length);
|
||||
roleDataRightUserIds.splice(0, roleDataRightUserIds.length);
|
||||
roleUsers.splice(0, roleUsers.length);
|
||||
$('#customUserBox').empty();
|
||||
}
|
||||
@ -152,17 +143,14 @@
|
||||
form.on('submit(submitForm)', function(formData) {
|
||||
top.dialog.confirm(top.dataMessage.commit, function(index) {
|
||||
top.dialog.close(index);
|
||||
var roleUserAuthorities = [];
|
||||
var userIds = [];
|
||||
var loadLayerIndex;
|
||||
for(var i = 0, item = roleUserAuthorityList[i]; item = roleUserAuthorityList[i++];) {
|
||||
roleUserAuthorities.push({
|
||||
departmentId: item.departmentId,
|
||||
userId: item.userId
|
||||
})
|
||||
for(var i = 0, item = roleDataRightUserIds[i]; item = roleDataRightUserIds[i++];) {
|
||||
userIds.push(item)
|
||||
}
|
||||
top.restAjax.put(top.restAjax.path('api/role/updateroledataauthority/{roleId}', [roleId]), {
|
||||
dataAuthorityType: formData.field.dataAuthorityType,
|
||||
roleUserAuthorityList: roleUserAuthorities
|
||||
top.restAjax.put(top.restAjax.path('api/role/data-right/update/{roleId}', [roleId]), {
|
||||
roleDataRight: formData.field.roleDataRight,
|
||||
userIds: userIds
|
||||
}, null, function(code, data) {
|
||||
top.dialog.msg(top.dataMessage.commitSuccess, {
|
||||
time: 0,
|
||||
@ -185,9 +173,9 @@
|
||||
});
|
||||
return false;
|
||||
});
|
||||
form.on('select(dataAuthorityType)', function(data) {
|
||||
var dataAuthorityType = data.value;
|
||||
if(dataAuthorityType === 'custom') {
|
||||
form.on('select(roleDataRight)', function(data) {
|
||||
var roleDataRight = data.value;
|
||||
if(roleDataRight === 'custom') {
|
||||
openCustomRoleUsers();
|
||||
} else {
|
||||
$('#customUserBox').hide();
|
@ -68,7 +68,7 @@
|
||||
enable: true,
|
||||
autoLoad: false,
|
||||
type: 'get',
|
||||
url: top.restAjax.path('api/role/listztreerole', []),
|
||||
url: top.restAjax.path('api/role/listztree', []),
|
||||
autoParam: ['id'],
|
||||
otherParam: {},
|
||||
dataFilter: function (treeId, parentNode, childNodes) {
|
||||
|
@ -20,12 +20,14 @@
|
||||
<div class="layui-inline">
|
||||
<input type="text" id="keywords" class="layui-input search-item" placeholder="输入关键字">
|
||||
</div>
|
||||
<button type="button" id="search" class="layui-btn layui-btn-sm">
|
||||
<i class="fa fa-lg fa-search"></i> 搜索
|
||||
</button>
|
||||
<button type="button" id="adminMenu" class="layui-btn layui-btn-normal layui-btn-sm">
|
||||
<i class="fa fa-lg fa-list"></i> 管理员菜单
|
||||
</button>
|
||||
<div class="layui-btn-group">
|
||||
<button type="button" id="search" class="layui-btn layui-btn-sm">
|
||||
<i class="fa fa-lg fa-search"></i> 搜索
|
||||
</button>
|
||||
<button type="button" id="adminMenu" class="layui-btn layui-btn-normal layui-btn-sm">
|
||||
<i class="fa fa-lg fa-list"></i> 管理员菜单
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<table class="layui-hide" id="dataTable" lay-filter="dataTable"></table>
|
||||
<!-- 表头按钮组 -->
|
||||
@ -90,15 +92,10 @@
|
||||
return '<button type="button" class="layui-btn layui-btn-xs" lay-event="userEvent"><i class="fa fa-users"></i> 查看</button>';
|
||||
}
|
||||
},
|
||||
{field:'groups', width:100, title: '组列表', align:'center',
|
||||
templet: function(item) {
|
||||
return '<button type="button" class="layui-btn layui-btn-xs" lay-event="groupEvent"><i class="fa fa-users"></i> 查看</button>';
|
||||
}
|
||||
},
|
||||
{field:'roleName', width:170, title: '角色名称', align:'center',},
|
||||
{field:'roleSummary', width:170, title: '角色说明', align:'center',},
|
||||
{field:'roleCode', width:170, title: '角色编码', align:'center',},
|
||||
{field:'jurisdiction', width:200, title: '快捷权限', align:'center',
|
||||
{field:'jurisdiction', width:190, title: '接口权限', align:'center',
|
||||
templet: function(item) {
|
||||
return '<div class="layui-btn-group">' +
|
||||
'<button type="button" class="layui-btn layui-btn-xs" lay-event="saveEvent"><i class="fa fa-plus"></i> 增</button>' +
|
||||
@ -108,12 +105,11 @@
|
||||
'</div>'
|
||||
}
|
||||
},
|
||||
{field:'jurisdiction', width:200, title: '其他权限', align:'center',
|
||||
{field:'jurisdiction', width:140, title: '其他权限', align:'center',
|
||||
templet: function(item) {
|
||||
return '<div class="layui-btn-group">' +
|
||||
'<button type="button" class="layui-btn layui-btn-normal layui-btn-xs" lay-event="dataEvent"><i class="fa fa-database"></i> 数据</button>' +
|
||||
'<button type="button" class="layui-btn layui-btn-normal layui-btn-xs" lay-event="menuEvent"><i class="fa fa-list"></i> 菜单</button>'+
|
||||
'<button type="button" class="layui-btn layui-btn-normal layui-btn-xs" lay-event="permissionEvent"><i class="fa fa-link"></i> 接口</button>'+
|
||||
'</div>'
|
||||
}
|
||||
},
|
||||
@ -143,10 +139,6 @@
|
||||
height: $win.height() - 60,
|
||||
});
|
||||
}
|
||||
function refreshTable() {
|
||||
parent.common.refreshTree('leftTree');
|
||||
reloadTable();
|
||||
}
|
||||
// 初始化日期
|
||||
function initDate() {
|
||||
// 日期选择
|
||||
@ -169,9 +161,9 @@
|
||||
top.dialog.close(index);
|
||||
var layIndex;
|
||||
top.restAjax.delete(top.restAjax.path('api/role/remove/{ids}', [ids]), {}, null, function (code, data) {
|
||||
top.dialog.msg(top.dataMessage.deleteSuccess, {time: 1000}, function () {
|
||||
refreshTable();
|
||||
});
|
||||
top.dialog.msg(top.dataMessage.deleteSuccess, {time: 1000});
|
||||
parent.common.refreshTree('leftTree');
|
||||
reloadTable();
|
||||
}, function (code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function () {
|
||||
@ -195,7 +187,7 @@
|
||||
});
|
||||
// 事件 - 管理员菜单
|
||||
$(document).on('click', '#adminMenu', function() {
|
||||
roleAuth('admin', 5);
|
||||
roleMenu('admin', '管理员菜单(不设置显示全部)');
|
||||
});
|
||||
// 事件 - 增删改
|
||||
table.on('toolbar(dataTable)', function(obj) {
|
||||
@ -212,7 +204,7 @@
|
||||
anim: 2,
|
||||
content: top.restAjax.path('route/role/save?roleParentId={parentId}', [parentId]),
|
||||
end: function() {
|
||||
refreshTable();
|
||||
reloadTable();
|
||||
}
|
||||
});
|
||||
} else if(layEvent === 'update') {
|
||||
@ -230,7 +222,7 @@
|
||||
anim: 2,
|
||||
content: top.restAjax.path('route/role/update?roleId={roleId}', [checkDatas[0].roleId]),
|
||||
end: function() {
|
||||
refreshTable();
|
||||
reloadTable();
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -253,30 +245,47 @@
|
||||
// 角色权限
|
||||
function roleAuth(roleId, type) {
|
||||
var title;
|
||||
var permissionType;
|
||||
switch (type) {
|
||||
case 1:
|
||||
title = '新增';
|
||||
permissionType = 'permissionInsert';
|
||||
break;
|
||||
case 2:
|
||||
title = '删除';
|
||||
permissionType = 'permissionDelete';
|
||||
break;
|
||||
case 3:
|
||||
title = '修改';
|
||||
break;
|
||||
case 4:
|
||||
title = '查询';
|
||||
permissionType = 'permissionUpdate';
|
||||
break;
|
||||
default:
|
||||
title = '菜单';
|
||||
title = '查询';
|
||||
permissionType = 'permissionQuery';
|
||||
}
|
||||
top.dialog.open({
|
||||
url: top.restAjax.path('route/system/role/menu-tree.html?roleId={roleId}&type={type}', [roleId, type]),
|
||||
url: top.restAjax.path('route/role/permission/update?roleId={roleId}&permissionType={permissionType}', [roleId, permissionType]),
|
||||
title: title +'授权',
|
||||
width: '200px',
|
||||
height: '400px',
|
||||
width: '900px',
|
||||
height: '500px',
|
||||
onClose: function() {}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 角色菜单
|
||||
* @param roleId
|
||||
*/
|
||||
function roleMenu(roleId, title) {
|
||||
top.dialog.open({
|
||||
url: top.restAjax.path('route/role/menu/tree?roleId={roleId}', [roleId]),
|
||||
title: title,
|
||||
width: '300px',
|
||||
height: '500px',
|
||||
onClose: function() {}
|
||||
});
|
||||
}
|
||||
|
||||
table.on('tool(dataTable)', function(obj) {
|
||||
var data = obj.data;
|
||||
var layEvent = obj.event;
|
||||
@ -289,41 +298,24 @@
|
||||
} else if(layEvent === 'queryEvent') {
|
||||
roleAuth(data.roleId, 4);
|
||||
} else if(layEvent === 'menuEvent') {
|
||||
roleAuth(data.roleId, 5);
|
||||
roleMenu(data.roleId, '角色菜单');
|
||||
} else if(layEvent === 'userEvent') {
|
||||
top.dialog.open({
|
||||
url: top.restAjax.path('route/system/user/list-role-user.html?roleId={roleId}', [data.roleId]),
|
||||
title: '角色用户列表',
|
||||
width: '800px',
|
||||
height: '500px',
|
||||
onClose: function() {}
|
||||
});
|
||||
} else if(layEvent === 'groupEvent') {
|
||||
top.dialog.open({
|
||||
url: top.restAjax.path('route/system/group/list-role-group.html?roleId={roleId}', [data.roleId]),
|
||||
title: '角色用户组列表',
|
||||
url: top.restAjax.path('route/role/user/list?roleId={roleId}', [data.roleId]),
|
||||
title: '【'+ data.roleName +'】用户列表',
|
||||
width: '800px',
|
||||
height: '500px',
|
||||
onClose: function() {}
|
||||
});
|
||||
} else if(layEvent === 'dataEvent') {
|
||||
top.dialog.open({
|
||||
url: top.restAjax.path('route/system/role/list-data-authority.html?roleId={roleId}', [data.roleId]),
|
||||
title: '选择数据权限',
|
||||
url: top.restAjax.path('route/role/data-right/update?roleId={roleId}', [data.roleId]),
|
||||
title: '修改数据权限',
|
||||
width: '200px',
|
||||
height: '350px',
|
||||
onClose: function() {
|
||||
}
|
||||
});
|
||||
} else if(layEvent === 'permissionEvent') {
|
||||
top.dialog.open({
|
||||
url: top.restAjax.path('route/permission/list-permission-role.html?roleId={roleId}', [data.roleId]),
|
||||
title: '设置接口权限',
|
||||
width: '900px',
|
||||
height: '500px',
|
||||
onClose: function() {
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -1,7 +1,7 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<base href="/usercenter/">
|
||||
<base th:href="${#request.getContextPath() + '/'}">
|
||||
<meta charset="utf-8">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
@ -14,10 +14,10 @@
|
||||
<body>
|
||||
<div class="layui-fluid layui-anim layui-anim-fadein" style="padding: 0;">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body" style="padding: 0px;">
|
||||
<div class="layui-card-body">
|
||||
<form class="layui-form" lay-filter="dataForm">
|
||||
<div class="layui-form-item" style="overflow: auto;">
|
||||
<ul id="ztree" class="ztree" style="min-height: 250px;"></ul>
|
||||
<div class="layui-form-item" style="height: 368px; overflow: auto;">
|
||||
<ul id="ztree" class="ztree" style="min-height: 350px;"></ul>
|
||||
</div>
|
||||
<div class="layui-form-item layui-layout-admin">
|
||||
<div class="layui-input-block">
|
||||
@ -31,8 +31,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" id="roleId"/>
|
||||
<input type="hidden" id="type"/>
|
||||
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||
<script>
|
||||
layui.config({
|
||||
@ -43,15 +41,14 @@
|
||||
var $ = layui.$;
|
||||
var form = layui.form;
|
||||
var hrefParams = top.restAjax.params(window.location.href);
|
||||
$('#roleId').val(hrefParams.roleId);
|
||||
$('#type').val(hrefParams.type);
|
||||
var roleId = top.restAjax.params(window.location.href).roleId;
|
||||
var zTree;
|
||||
function closeBox() {
|
||||
top.dialog.closeBox();
|
||||
}
|
||||
function initData() {
|
||||
function initData(callback) {
|
||||
var layerIndex;
|
||||
top.restAjax.get(top.restAjax.path('api/role/listmenu/0/{roleId}/{type}', [$('#roleId').val(), $('#type').val()]), {}, null, function(code, data) {
|
||||
top.restAjax.get(top.restAjax.path('api/menu/listallbyparentid/0', []), {}, null, function(code, data) {
|
||||
var setting = {
|
||||
data: {
|
||||
key: {
|
||||
@ -67,7 +64,13 @@
|
||||
}
|
||||
};
|
||||
zTree = $.fn.zTree.init($("#ztree"), setting, data);
|
||||
// zTree.expandAll(true);
|
||||
var nodes = zTree.getNodesByParam('menuParentId', '0', null);
|
||||
if(nodes.length < 3) {
|
||||
for(var i = 0, node; node = nodes[i++];) {
|
||||
zTree.expandNode(node, true, false, false);
|
||||
}
|
||||
}
|
||||
callback();
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function() {
|
||||
@ -76,21 +79,32 @@
|
||||
top.dialog.close(layerIndex);
|
||||
});
|
||||
}
|
||||
initData();
|
||||
initData(function() {
|
||||
var layerIndex;
|
||||
top.restAjax.get(top.restAjax.path('api/role/menu/list/{roleId}', [roleId]), {}, null, function(code, data) {
|
||||
for(var i = 0, item; item = data[i++];) {
|
||||
zTree.checkNode(zTree.getNodeByParam('menuId', item.menuId, null), true, false);
|
||||
}
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function() {
|
||||
layerIndex = top.dialog.msg(top.dataMessage.loading, {icon: 16, time: 0, shade: 0.3});
|
||||
}, function() {
|
||||
top.dialog.close(layerIndex);
|
||||
});
|
||||
});
|
||||
|
||||
form.on('submit(submitForm)', function(formData) {
|
||||
var nodes = zTree.getCheckedNodes(true);
|
||||
var checkedNodes = '';
|
||||
var menuIds = [];
|
||||
for(var i = 0, item; item = nodes[i++];) {
|
||||
if('' != checkedNodes) {
|
||||
checkedNodes += '_';
|
||||
}
|
||||
checkedNodes += item.menuId;
|
||||
menuIds.push(item.menuId);
|
||||
}
|
||||
top.dialog.confirm(top.dataMessage.commit, function(index) {
|
||||
top.dialog.close(index);
|
||||
var layerIndex;
|
||||
top.restAjax.put(top.restAjax.path('api/role/authorization/{roleId}/{type}', [$('#roleId').val(), $('#type').val()]), {
|
||||
menuIds: checkedNodes
|
||||
top.restAjax.put(top.restAjax.path('api/role/menu/update/{roleId}', [roleId]), {
|
||||
menuIds: menuIds
|
||||
}, null, function(code, data) {
|
||||
top.dialog.msg(top.dataMessage.updateSuccess, {
|
||||
time: 0,
|
@ -1,247 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<base href="/usercenter/">
|
||||
<meta charset="utf-8">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
||||
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
|
||||
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
|
||||
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
|
||||
</head>
|
||||
<body>
|
||||
<div class="layui-anim layui-anim-fadein">
|
||||
<div class="layui-row">
|
||||
<div class="layui-col-md12">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body">
|
||||
<div class="test-table-reload-btn" style="margin-bottom: 10px;">
|
||||
<div class="layui-inline">
|
||||
<input type="text" id="keywords" class="layui-input search-item" placeholder="输入关键字">
|
||||
</div>
|
||||
<div class="layui-inline layui-form search-item">
|
||||
<select id="permissionType" name="permissionType">
|
||||
<option value="">选择权限</option>
|
||||
<option value="permissionInsert">新增权限</option>
|
||||
<option value="permissionDelete">删除权限</option>
|
||||
<option value="permissionUpdate">修改权限</option>
|
||||
<option value="permissionQuery">查询权限</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="layui-inline layui-form search-item">
|
||||
<select id="isPublic" name="isPublic">
|
||||
<option value="">公开类型</option>
|
||||
<option value="1">是</option>
|
||||
<option value="0">否</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="layui-inline layui-form search-item" id="permissionClientIdSelectTemplateBox" lay-filter="permissionClientIdSelectTemplateBox"></div>
|
||||
<script id="permissionClientIdSelectTemplate" type="text/html">
|
||||
<select id="permissionClientId" name="permissionClientId">
|
||||
<option value="">客户端</option>
|
||||
{{# for(var i = 0, item; item = d[i++];) { }}
|
||||
<option value="{{item.clientId}}">{{item.clientName}}</option>
|
||||
{{# } }}
|
||||
</select>
|
||||
</script>
|
||||
<button type="button" id="search" class="layui-btn layui-btn-sm">
|
||||
<i class="fa fa-lg fa-search"></i> 搜索
|
||||
</button>
|
||||
</div>
|
||||
<table class="layui-hide" id="dataTable" lay-filter="dataTable"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||
<script src="assets/js/vendor/viewer/viewer.min.js"></script>
|
||||
<script>
|
||||
layui.config({
|
||||
base: 'assets/layuiadmin/'
|
||||
}).extend({
|
||||
index: 'lib/index'
|
||||
}).use(['index', 'table', 'laydate', 'common'], function() {
|
||||
var $ = layui.$;
|
||||
var $win = $(window);
|
||||
var table = layui.table;
|
||||
var form = layui.form;
|
||||
var laytpl = layui.laytpl;
|
||||
var admin = layui.admin;
|
||||
var laydate = layui.laydate;
|
||||
var common = layui.common;
|
||||
var resizeTimeout = null;
|
||||
var roleId = top.restAjax.params(window.location.href).roleId;
|
||||
var tableUrl = 'api/permission/listpagepermissionwithroleid/'+ roleId;
|
||||
|
||||
// 初始化客户端下拉选择
|
||||
function initPermissionClientIdSelect() {
|
||||
top.restAjax.get(top.restAjax.path('api/oauthclient/listoauthclient', []), {}, null, function(code, data, args) {
|
||||
laytpl(document.getElementById('permissionClientIdSelectTemplate').innerHTML).render(data, function(html) {
|
||||
document.getElementById('permissionClientIdSelectTemplateBox').innerHTML = html;
|
||||
});
|
||||
form.render('select', 'permissionClientIdSelectTemplateBox');
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
});
|
||||
}
|
||||
initPermissionClientIdSelect();
|
||||
|
||||
// 初始化表格
|
||||
var tableData;
|
||||
function initTable() {
|
||||
$.extend(table, {config: {checkName: 'checked'}});
|
||||
table.render({
|
||||
elem: '#dataTable',
|
||||
id: 'dataTable',
|
||||
url: top.restAjax.path(tableUrl, []),
|
||||
width: admin.screen() > 1 ? '100%' : '',
|
||||
height: $win.height() - 60,
|
||||
limit: 20,
|
||||
limits: [20, 40, 60, 80, 100, 200],
|
||||
request: {
|
||||
pageName: 'page',
|
||||
limitName: 'rows'
|
||||
},
|
||||
cols: [[
|
||||
{type:'checkbox', fixed: 'left'},
|
||||
{field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
|
||||
{field: 'permissionUrl', width: 300, title: '权限路径', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field:'permissionTitle', width:200, title: '权限名称', align:'center'},
|
||||
{field: 'permissionType', width: 100, title: '权限类型', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
if(rowData == 'permissionInsert') {
|
||||
return '新增权限';
|
||||
} else if(rowData == 'permissionDelete') {
|
||||
return '删除权限';
|
||||
} else if(rowData == 'permissionUpdate') {
|
||||
return '更新权限';
|
||||
} else if(rowData == 'permissionQuery') {
|
||||
return '查询权限';
|
||||
}
|
||||
return '错误';
|
||||
}
|
||||
},
|
||||
{field: 'permissionClientName', width: 180, title: '客户端名称', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'isPublic', width: 100, title: '公共接口', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(rowData == '0') {
|
||||
return '否';
|
||||
} else if(rowData == '1') {
|
||||
return '是';
|
||||
}
|
||||
return '错误';
|
||||
}
|
||||
},
|
||||
]],
|
||||
page: true,
|
||||
parseData: function(data) {
|
||||
for(var i = 0, item; item = data.rows[i++];) {
|
||||
if(item.roleId) {
|
||||
item.checked = true;
|
||||
} else {
|
||||
item.checked = false;
|
||||
}
|
||||
}
|
||||
tableData = data.rows;
|
||||
return {
|
||||
'code': 0,
|
||||
'msg': '',
|
||||
'count': data.total,
|
||||
'data': data.rows
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function updateCheckStatus(checked, dataArray) {
|
||||
var permissionIdArray = [];
|
||||
for(var i = 0, item; item = dataArray[i++];) {
|
||||
permissionIdArray.push(item.permissionId);
|
||||
}
|
||||
top.restAjax.put(top.restAjax.path('api/permission/updatepermissionbyroleId/{roleId}', [roleId]), {
|
||||
checked: checked,
|
||||
permissionIdArray: permissionIdArray
|
||||
}, null, function(code, data) {
|
||||
top.dialog.msg('修改成功');
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
});
|
||||
}
|
||||
|
||||
table.on('checkbox(dataTable)', function(obj) {
|
||||
if(obj.type === 'all') {
|
||||
updateCheckStatus(obj.checked, tableData);
|
||||
} else {
|
||||
var dataArray = [];
|
||||
dataArray.push(obj.data);
|
||||
updateCheckStatus(obj.checked, dataArray);
|
||||
}
|
||||
});
|
||||
// 重载表格
|
||||
function reloadTable(currentPage) {
|
||||
table.reload('dataTable', {
|
||||
url: top.restAjax.path(tableUrl, []),
|
||||
where: {
|
||||
keywords: $('#keywords').val(),
|
||||
permissionType: $('#permissionType').val(),
|
||||
isPublic: $('#isPublic').val(),
|
||||
permissionClientId: $('#permissionClientId').val(),
|
||||
},
|
||||
page: {
|
||||
curr: currentPage
|
||||
},
|
||||
height: $win.height() - 60,
|
||||
});
|
||||
}
|
||||
// 初始化日期
|
||||
function initDate() {
|
||||
// 日期选择
|
||||
laydate.render({
|
||||
elem: '#startTime',
|
||||
format: 'yyyy-MM-dd'
|
||||
});
|
||||
laydate.render({
|
||||
elem: '#endTime',
|
||||
format: 'yyyy-MM-dd'
|
||||
});
|
||||
}
|
||||
initTable();
|
||||
initDate();
|
||||
// 事件 - 页面变化
|
||||
$win.on('resize', function() {
|
||||
clearTimeout(resizeTimeout);
|
||||
resizeTimeout = setTimeout(function() {
|
||||
reloadTable();
|
||||
}, 500);
|
||||
});
|
||||
// 事件 - 搜索
|
||||
$(document).on('click', '#search', function() {
|
||||
reloadTable(1);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,235 @@
|
||||
<!doctype html>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<base th:href="${#request.getContextPath() + '/'}">
|
||||
<meta charset="utf-8">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
||||
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
|
||||
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
|
||||
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
|
||||
<style>
|
||||
table+table {
|
||||
margin-top: 20px !important;
|
||||
}
|
||||
.api-tag {float: right}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="layui-anim layui-anim-fadein">
|
||||
<div class="layui-row">
|
||||
<div class="layui-col-md12">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body" style="min-height: 372px">
|
||||
<form class="layui-form" lay-filter="formData">
|
||||
<div id="permissionTemplateBox"></div>
|
||||
<script id="permissionTemplate" type="text/html">
|
||||
{{# if(d.length == 0) { }}
|
||||
<div style="text-align: center; padding-top: 116px;">
|
||||
<i class="layui-icon layui-icon-face-surprised" style="font-size: 200px;"></i>
|
||||
</div>
|
||||
<div style="text-align: center; margin-top: 74px; font-size: 20px;">请先添加各增、删、改、查接口权限</div>
|
||||
{{# } }}
|
||||
{{# for(var i = 0, item; item = d[i++];) { }}
|
||||
<fieldset class="layui-elem-field">
|
||||
<legend>{{item.systemTag}}</legend>
|
||||
<div class="layui-field-box">
|
||||
{{# for(var j = 0, jItem; jItem = item.permissionApis[j++];) { }}
|
||||
<table class="layui-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<input type="checkbox" id="{{jItem.apiTag}}" class="select-all" title="全选" lay-skin="primary" lay-filter="permissionAllFilter">
|
||||
<span class="api-tag">{{jItem.apiTag}}</span>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
{{# for(var x = 0, xItem; xItem = jItem.permissions[x++];) { }}
|
||||
<span title="{{xItem.permissionUrl}}">
|
||||
<input type="checkbox" name="{{jItem.apiTag}}[{{xItem.permissionId}}]" id="{{xItem.permissionId}}" title="{{xItem.permissionTitle}}" lay-skin="primary" lay-filter="permissionFilter">
|
||||
</span>
|
||||
{{# } }}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
{{# } }}
|
||||
</div>
|
||||
</fieldset>
|
||||
{{# } }}
|
||||
</script>
|
||||
<div class="layui-form-item layui-layout-admin">
|
||||
<div class="layui-input-block">
|
||||
<div class="layui-footer" style="left: 0;">
|
||||
<button type="button" class="layui-btn" lay-submit lay-filter="submitForm">提交</button>
|
||||
<button type="button" class="layui-btn layui-btn-primary close">关闭</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||
<script src="assets/js/vendor/viewer/viewer.min.js"></script>
|
||||
<script>
|
||||
layui.config({
|
||||
base: 'assets/layuiadmin/'
|
||||
}).extend({
|
||||
index: 'lib/index'
|
||||
}).use(['index', 'table', 'laydate', 'common'], function() {
|
||||
var $ = layui.$;
|
||||
var $win = $(window);
|
||||
var table = layui.table;
|
||||
var form = layui.form;
|
||||
var laytpl = layui.laytpl;
|
||||
var admin = layui.admin;
|
||||
var laydate = layui.laydate;
|
||||
var common = layui.common;
|
||||
var resizeTimeout = null;
|
||||
var roleId = top.restAjax.params(window.location.href).roleId;
|
||||
var permissionType = top.restAjax.params(window.location.href).permissionType;
|
||||
var type = 'query';
|
||||
if(permissionType === 'permissionInsert') {
|
||||
type = 'insert';
|
||||
} else if(permissionType === 'permissionDelete') {
|
||||
type = 'delete';
|
||||
} else if(permissionType === 'permissionUpdate') {
|
||||
type = 'update';
|
||||
}
|
||||
|
||||
function closeBox() {
|
||||
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
||||
}
|
||||
|
||||
// 初始化全选
|
||||
function initSelectAll(name) {
|
||||
var checkboxs = $('input[name^="'+ name +'"]');
|
||||
var isAllChecked = true;
|
||||
for(var i = 0, item; item = checkboxs[i++];) {
|
||||
if(!item.checked) {
|
||||
isAllChecked = false;
|
||||
}
|
||||
}
|
||||
if(isAllChecked) {
|
||||
$('#'+ name).prop('checked', true);
|
||||
} else {
|
||||
$('#'+ name).prop('checked', false);
|
||||
}
|
||||
form.render('checkbox');
|
||||
}
|
||||
|
||||
function initFormTable(callback) {
|
||||
var loadLayerIndex;
|
||||
top.restAjax.get(top.restAjax.path('api/permission/listgroup?permissionType={permissionType}', [permissionType]), {}, null, function(code, data) {
|
||||
laytpl(document.getElementById('permissionTemplate').innerHTML).render(data, function(html) {
|
||||
document.getElementById('permissionTemplateBox').innerHTML = html;
|
||||
form.render('checkbox');
|
||||
callback();
|
||||
});
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function() {
|
||||
loadLayerIndex = top.dialog.msg(top.dataMessage.committing, {icon: 16, time: 0, shade: 0.3});
|
||||
}, function() {
|
||||
top.dialog.close(loadLayerIndex);
|
||||
});
|
||||
}
|
||||
|
||||
initFormTable(function() {
|
||||
var loadLayerIndex;
|
||||
top.restAjax.get(top.restAjax.path('api/role/permission/list/{roleId}', [roleId]), {
|
||||
permissionType: type
|
||||
}, null, function(code, data) {
|
||||
var formData = {};
|
||||
for(var i = 0, item; item = data[i++];) {
|
||||
formData[item.apiTag +'['+ item.permissionId +']'] = true;
|
||||
}
|
||||
form.val("formData", formData);
|
||||
form.render('checkbox');
|
||||
|
||||
var selectAllCheckboxs = $('.select-all');
|
||||
for(var i = 0, item; item = selectAllCheckboxs[i++];) {
|
||||
initSelectAll(item.id);
|
||||
}
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function() {
|
||||
loadLayerIndex = top.dialog.msg(top.dataMessage.committing, {icon: 16, time: 0, shade: 0.3});
|
||||
}, function() {
|
||||
top.dialog.close(loadLayerIndex);
|
||||
});
|
||||
});
|
||||
|
||||
// 权限 checkbox 多选
|
||||
form.on('checkbox(permissionAllFilter)', function(data) {
|
||||
var checkboxs = $('input[name^="'+ data.elem.id +'"]');
|
||||
var formData = {};
|
||||
if(data.elem.checked) {
|
||||
for(var i = 0, item; item = checkboxs[i++];) {
|
||||
formData[item.name] = true;
|
||||
}
|
||||
} else {
|
||||
for(var i = 0, item; item = checkboxs[i++];) {
|
||||
formData[item.name] = false;
|
||||
}
|
||||
}
|
||||
form.val("formData", formData);
|
||||
form.render('checkbox');
|
||||
});
|
||||
|
||||
// 权限 checkbox 单选
|
||||
form.on('checkbox(permissionFilter)', function(data) {
|
||||
var name = data.elem.name.split('\[')[0];
|
||||
initSelectAll(name);
|
||||
});
|
||||
|
||||
// 提交表单
|
||||
form.on('submit(submitForm)', function(formData) {
|
||||
var permissionIds = [];
|
||||
for(var k in formData.field) {
|
||||
permissionIds.push(k.substr(0, k.length - 1).replace('[', '_'))
|
||||
}
|
||||
top.dialog.confirm(top.dataMessage.commit, function(index) {
|
||||
top.dialog.close(index);
|
||||
var loadLayerIndex;
|
||||
top.restAjax.put(top.restAjax.path('api/role/permission/update/{roleId}', [roleId]), {
|
||||
type: type,
|
||||
permissionIds: permissionIds
|
||||
}, null, function(code, data) {
|
||||
top.dialog.msg(top.dataMessage.updateSuccess, {
|
||||
time: 0,
|
||||
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
|
||||
shade: 0.3,
|
||||
yes: function(index) {
|
||||
top.dialog.close(index);
|
||||
window.location.reload();
|
||||
},
|
||||
btn2: function() {
|
||||
closeBox();
|
||||
}
|
||||
});
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function() {
|
||||
loadLayerIndex = top.dialog.msg(top.dataMessage.committing, {icon: 16, time: 0, shade: 0.3});
|
||||
}, function() {
|
||||
top.dialog.close(loadLayerIndex);
|
||||
});
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
$('.close').on('click', function() {
|
||||
closeBox();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -79,7 +79,7 @@
|
||||
return;
|
||||
}
|
||||
var loadLayerIndex;
|
||||
top.restAjax.get(top.restAjax.path('api/role/getrole/{roleParentId}', [roleParentId]), {}, null, function(code, data) {
|
||||
top.restAjax.get(top.restAjax.path('api/role/get/{roleParentId}', [roleParentId]), {}, null, function(code, data) {
|
||||
form.val('dataForm', {
|
||||
roleParentName: data.roleName
|
||||
});
|
||||
@ -99,7 +99,8 @@
|
||||
top.dialog.confirm(top.dataMessage.commit, function(index) {
|
||||
top.dialog.close(index);
|
||||
var loadLayerIndex;
|
||||
top.restAjax.post(top.restAjax.path('api/role/saverole', []), formData.field, null, function(code, data) {
|
||||
top.restAjax.post(top.restAjax.path('api/role/save', []), formData.field, null, function(code, data) {
|
||||
parent.parent.common.refreshTree('leftTree');
|
||||
var layerIndex = top.dialog.msg(top.dataMessage.commitSuccess, {
|
||||
time: 0,
|
||||
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
|
||||
|
@ -69,7 +69,7 @@
|
||||
// 初始化
|
||||
function initData() {
|
||||
var loadLayerIndex;
|
||||
top.restAjax.get(top.restAjax.path('api/role/getrole/{roleId}', [roleId]), {}, null, function(code, data) {
|
||||
top.restAjax.get(top.restAjax.path('api/role/get/{roleId}', [roleId]), {}, null, function(code, data) {
|
||||
form.val('dataForm', {
|
||||
roleParentName: data.roleParentName == '' ? '根节点' : data.roleParentName,
|
||||
roleParentId: data.roleParentId,
|
||||
@ -92,7 +92,8 @@
|
||||
top.dialog.confirm(top.dataMessage.commit, function(index) {
|
||||
top.dialog.close(index);
|
||||
var loadLayerIndex;
|
||||
top.restAjax.put(top.restAjax.path('api/role/updaterole/{roleId}', [roleId]), formData.field, null, function(code, data) {
|
||||
top.restAjax.put(top.restAjax.path('api/role/update/{roleId}', [roleId]), formData.field, null, function(code, data) {
|
||||
parent.parent.common.refreshTree('leftTree');
|
||||
var layerIndex = top.dialog.msg(top.dataMessage.commitSuccess, {
|
||||
time: 0,
|
||||
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
|
||||
|
273
service-role/src/main/resources/templates/role/user/list.html
Normal file
273
service-role/src/main/resources/templates/role/user/list.html
Normal file
@ -0,0 +1,273 @@
|
||||
<!doctype html>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<base th:href="${#request.getContextPath() + '/'}">
|
||||
<meta charset="utf-8">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
||||
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="assets/js/vendor/viewer/viewer.min.css">
|
||||
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
|
||||
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
|
||||
</head>
|
||||
<body>
|
||||
<div class="layui-fluid layui-anim layui-anim-fadein" style="padding: 0;">
|
||||
<div class="layui-row">
|
||||
<div class="layui-col-md12">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body">
|
||||
<div class="test-table-reload-btn" style="margin-bottom: 10px;">
|
||||
<div class="layui-inline">
|
||||
<input type="text" id="keywords" class="layui-input search-item" placeholder="输入关键字">
|
||||
</div>
|
||||
<button type="button" id="search" class="layui-btn layui-btn-sm">
|
||||
<i class="fa fa-lg fa-search"></i> 搜索
|
||||
</button>
|
||||
</div>
|
||||
<table class="layui-hide" id="dataTable" lay-filter="dataTable"></table>
|
||||
<!-- 表头按钮组 -->
|
||||
<script type="text/html" id="headerToolBar">
|
||||
<div class="layui-btn-group">
|
||||
<button type="button" class="layui-btn layui-btn-sm" lay-event="saveEvent">
|
||||
<i class="fa fa-lg fa-plus"></i> 新增
|
||||
</button>
|
||||
<button type="button" class="layui-btn layui-btn-danger layui-btn-sm" lay-event="removeEvent">
|
||||
<i class="fa fa-lg fa-trash"></i> 删除
|
||||
</button>
|
||||
</div>
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<input id="selectedUserIds" type="hidden"/>
|
||||
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||
<script>
|
||||
layui.config({
|
||||
base: 'assets/layuiadmin/'
|
||||
}).extend({
|
||||
index: 'lib/index'
|
||||
}).use(['index', 'table', 'common'], function() {
|
||||
var $ = layui.$;
|
||||
var $win = $(window);
|
||||
var table = layui.table;
|
||||
var admin = layui.admin;
|
||||
var common = layui.common;
|
||||
var roleId = top.restAjax.params(window.location.href).roleId;
|
||||
var resizeTimeout = null;
|
||||
var tableUrl = 'api/role/user/listpage/{roleId}';
|
||||
|
||||
// 初始化表格
|
||||
function initTable() {
|
||||
table.render({
|
||||
elem: '#dataTable',
|
||||
id: 'dataTable',
|
||||
url: top.restAjax.path(tableUrl, [roleId]),
|
||||
width: admin.screen() > 1 ? '100%' : '',
|
||||
height: $win.height() - 60,
|
||||
limit: 20,
|
||||
limits: [20, 40, 60, 80, 100, 200],
|
||||
toolbar: '#headerToolBar',
|
||||
request: {
|
||||
pageName: 'page',
|
||||
limitName: 'rows'
|
||||
},
|
||||
cols: [
|
||||
[
|
||||
{type:'checkbox', fixed: 'left'},
|
||||
{field:'rowNum', width:80, title: '序号', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
|
||||
{field:'userUsername', width:140, title: '用户名', align:'center'},
|
||||
{field:'userName', width:140, title: '昵称', align:'center'},
|
||||
{field:'userPhone', width:140, title: '手机', align:'center',
|
||||
templet: function(item) {
|
||||
if(!item.userPhone) {
|
||||
return '-';
|
||||
}
|
||||
return item.userPhone;
|
||||
}
|
||||
},
|
||||
{field:'userEmail', width: 160, title: '邮箱', align:'center',
|
||||
templet: function(item) {
|
||||
if(!item.userEmail) {
|
||||
return '-';
|
||||
}
|
||||
return item.userEmail;
|
||||
}
|
||||
},
|
||||
{field:'userState', width:80, title: '状态', align:'center',
|
||||
templet: function(item) {
|
||||
var value;
|
||||
switch (item.userState) {
|
||||
case 1:
|
||||
value = '冻结';
|
||||
break;
|
||||
case 2:
|
||||
value = '锁定';
|
||||
break;
|
||||
default:
|
||||
value = '正常';
|
||||
}
|
||||
return value;
|
||||
}
|
||||
},
|
||||
{field:'roleName', width:200, title: '角色', align:'center',
|
||||
templet: function(item) {
|
||||
if(!item.roleName) {
|
||||
return '-';
|
||||
}
|
||||
return item.roleName;
|
||||
}
|
||||
},
|
||||
]
|
||||
],
|
||||
page: true,
|
||||
parseData: function(data) {
|
||||
return {
|
||||
'code': 0,
|
||||
'msg': '',
|
||||
'count': data.total,
|
||||
'data': data.rows
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
// 重载表格
|
||||
function reloadTable(currentPage) {
|
||||
table.reload('dataTable', {
|
||||
url: top.restAjax.path(tableUrl, [roleId]),
|
||||
where: {
|
||||
keywords: $('#keywords').val(),
|
||||
},
|
||||
page: {
|
||||
curr: currentPage
|
||||
},
|
||||
height: $win.height() - 60,
|
||||
});
|
||||
}
|
||||
// 删除
|
||||
function removeData(ids) {
|
||||
top.dialog.msg(top.dataMessage.delete, {
|
||||
time: 0,
|
||||
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
|
||||
shade: 0.3,
|
||||
yes: function(index) {
|
||||
top.dialog.close(index);
|
||||
var layIndex;
|
||||
top.restAjax.delete(top.restAjax.path('api/role/user/remove/{roleId}/{ids}', [roleId, ids]), {}, null, function(code, data) {
|
||||
top.dialog.msg(top.dataMessage.deleteSuccess);
|
||||
var deleteUserIds = ids.split('_');
|
||||
var selectedUserIds = $('#selectedUserIds').val().split('_');
|
||||
var tempIds = common.resultIdsOfDeleteIds(deleteUserIds, selectedUserIds);
|
||||
$('#selectedUserIds').val(tempIds);
|
||||
reloadTable();
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function() {
|
||||
layIndex = top.dialog.msg(top.dataMessage.deleting, {icon: 16, time: 0, shade: 0.3});
|
||||
}, function() {
|
||||
top.dialog.close(layIndex);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
// 初始化角色用户ID列表
|
||||
function initSelectUserIds() {
|
||||
var layIndex;
|
||||
top.restAjax.get(top.restAjax.path('api/role/user/listuserid/{roleId}', [roleId]), {}, null, function(code, data) {
|
||||
var selectedUserIds = '';
|
||||
for(var i = 0, item; item = data[i++]; ) {
|
||||
if('' != selectedUserIds) {
|
||||
selectedUserIds += '_';
|
||||
}
|
||||
selectedUserIds += item;
|
||||
}
|
||||
$('#selectedUserIds').val(selectedUserIds);
|
||||
initTable();
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function() {
|
||||
layIndex = top.dialog.msg(top.dataMessage.loading, {icon: 16, time: 0, shade: 0.3});
|
||||
}, function() {
|
||||
top.dialog.close(layIndex);
|
||||
});
|
||||
}
|
||||
initSelectUserIds();
|
||||
|
||||
// 事件 - 页面变化
|
||||
$win.on('resize', function() {
|
||||
clearTimeout(resizeTimeout);
|
||||
resizeTimeout = setTimeout(function() {
|
||||
reloadTable();
|
||||
}, 500);
|
||||
});
|
||||
// 事件 - 搜索
|
||||
$(document).on('click', '#search', function() {
|
||||
reloadTable(1);
|
||||
});
|
||||
// 事件 - 增删
|
||||
table.on('toolbar(dataTable)', function(obj) {
|
||||
var layEvent = obj.event;
|
||||
var checkStatus = table.checkStatus('dataTable');
|
||||
var checkDatas = checkStatus.data;
|
||||
if(layEvent === 'saveEvent') {
|
||||
top.dialog.dialogData.selectedUserIds = $('#selectedUserIds').val();
|
||||
top.dialog.open({
|
||||
url: top.restAjax.path('route/department/user/select-user', []),
|
||||
title: '选择用户',
|
||||
width: '500px',
|
||||
height: '500px',
|
||||
onClose: function() {
|
||||
var selectedUsers = top.dialog.dialogData.selectedDepartmentUsers;
|
||||
if(selectedUsers != null && selectedUsers.length > 0) {
|
||||
var ids = [];
|
||||
for (var i = 0, item; item = selectedUsers[i++];) {
|
||||
ids.push(item.userId);
|
||||
}
|
||||
top.dialog.msg(top.dataMessage.update, {
|
||||
time: 0,
|
||||
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
|
||||
yes: function (index) {
|
||||
top.dialog.close(index);
|
||||
var loadLayerIndex;
|
||||
top.restAjax.put(top.restAjax.path('api/role/user/update/{roleId}', [roleId]), {
|
||||
ids: ids
|
||||
}, null, function (code, data) {
|
||||
top.dialog.msg(top.dataMessage.updated);
|
||||
initSelectUserIds();
|
||||
}, function (code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function () {
|
||||
loadLayerIndex = top.dialog.msg(top.dataMessage.updating, {
|
||||
icon: 16,
|
||||
time: 0,
|
||||
shade: 0.3
|
||||
});
|
||||
}, function () {
|
||||
top.dialog.close(loadLayerIndex);
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
} else if(layEvent === 'removeEvent') {
|
||||
if(checkDatas.length === 0) {
|
||||
top.dialog.msg(top.dataMessage.table.selectDelete);
|
||||
} else {
|
||||
var ids = '';
|
||||
for(var i = 0, item; item = checkDatas[i++];) {
|
||||
if(i > 1) {
|
||||
ids += '_';
|
||||
}
|
||||
ids += item.userId;
|
||||
}
|
||||
removeData(ids);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -47,7 +47,7 @@ public class UserController extends DefaultBaseController {
|
||||
@Autowired
|
||||
private IUserService userService;
|
||||
|
||||
@ApiOperation(value = "用户新增", notes = "用户新增接口")
|
||||
@ApiOperation(value = "新增用户", notes = "新增用户接口")
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@PostMapping("save")
|
||||
public SuccessResult save(@RequestBody UserVO userVO) {
|
||||
@ -56,7 +56,7 @@ public class UserController extends DefaultBaseController {
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "用户删除", notes = "用户删除接口")
|
||||
@ApiOperation(value = "删除用户", notes = "删除用户接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "ids", value = "用户ID列表,用下划线分隔", paramType = "path")
|
||||
})
|
||||
@ -67,7 +67,7 @@ public class UserController extends DefaultBaseController {
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "用户修改", notes = "用户修改接口")
|
||||
@ApiOperation(value = "修改用户", notes = "修改用户接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "userId", value = "用户ID", paramType = "path"),
|
||||
})
|
||||
@ -94,7 +94,7 @@ public class UserController extends DefaultBaseController {
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation(value = "重置密码", notes = "重置密码接口")
|
||||
@ApiOperation(value = "用户重置密码", notes = "用户重置密码接口")
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@PutMapping("resetpassword/{userId}")
|
||||
@CheckRequestBodyAnnotation
|
||||
@ -103,7 +103,7 @@ public class UserController extends DefaultBaseController {
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改用户名", notes = "修改用户名密码接口")
|
||||
@ApiOperation(value = "用户修改用户名", notes = "用户修改用户名接口")
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@PutMapping("updateusername/{userId}")
|
||||
@CheckRequestBodyAnnotation
|
||||
@ -112,7 +112,7 @@ public class UserController extends DefaultBaseController {
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "导入Excel", notes = "导入Excel接口")
|
||||
@ApiOperation(value = "用户导入Excel", notes = "用户导入Excel接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "excel", value = "文件名称", paramType = "query"),
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user