完全权限模块的权限注册的添加
This commit is contained in:
@@ -1,55 +0,0 @@
|
||||
package cn.iocoder.mall.system.application.controller.admins;
|
||||
|
||||
import cn.iocoder.common.framework.enums.MallConstants;
|
||||
import cn.iocoder.common.framework.util.CollectionUtil;
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.common.framework.vo.PageResult;
|
||||
import cn.iocoder.mall.system.api.AdminService;
|
||||
import cn.iocoder.mall.system.api.DeptmentService;
|
||||
import cn.iocoder.mall.system.api.ResourceService;
|
||||
import cn.iocoder.mall.system.api.RoleService;
|
||||
import cn.iocoder.mall.system.api.bo.deptment.DeptmentBO;
|
||||
import cn.iocoder.mall.system.api.bo.resource.ResourceBO;
|
||||
import cn.iocoder.mall.system.api.bo.role.RoleBO;
|
||||
import cn.iocoder.mall.system.api.bo.admin.AdminBO;
|
||||
import cn.iocoder.mall.system.api.constant.ResourceConstants;
|
||||
import cn.iocoder.mall.system.api.dto.admin.*;
|
||||
import cn.iocoder.mall.system.application.convert.AdminConvert;
|
||||
import cn.iocoder.mall.system.application.convert.ResourceConvert;
|
||||
import cn.iocoder.mall.system.application.vo.admin.AdminMenuTreeNodeVO;
|
||||
import cn.iocoder.mall.system.application.vo.admin.AdminRoleVO;
|
||||
import cn.iocoder.mall.system.application.vo.admin.AdminVO;
|
||||
import cn.iocoder.mall.system.sdk.annotation.RequiresPermissions;
|
||||
import cn.iocoder.mall.system.sdk.context.AdminSecurityContextHolder;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.dubbo.config.annotation.Reference;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.common.framework.vo.CommonResult.success;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(MallConstants.ROOT_PATH_ADMIN + "/admin")
|
||||
@Api("管理员模块")
|
||||
public class AdminController {
|
||||
|
||||
@Reference(validation = "true", version = "${dubbo.provider.ResourceService.version}")
|
||||
private ResourceService resourceService;
|
||||
|
||||
@Reference(validation = "true", version = "${dubbo.provider.AdminService.version}")
|
||||
private AdminService adminService;
|
||||
|
||||
@Reference(validation = "true", version = "${dubbo.provider.RoleService.version}")
|
||||
private RoleService roleService;
|
||||
|
||||
@Autowired
|
||||
private DeptmentService deptmentService;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
package cn.iocoder.mall.system.application.convert;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.common.framework.vo.PageResult;
|
||||
import cn.iocoder.mall.system.api.bo.role.RoleBO;
|
||||
import cn.iocoder.mall.system.api.bo.admin.AdminBO;
|
||||
import cn.iocoder.mall.system.application.vo.admin.AdminInfoVO;
|
||||
import cn.iocoder.mall.system.application.vo.admin.AdminRoleVO;
|
||||
import cn.iocoder.mall.system.application.vo.admin.AdminVO;
|
||||
import cn.iocoder.mall.system.sdk.context.AdminSecurityContext;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mappings;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface AdminConvert {
|
||||
|
||||
AdminConvert INSTANCE = Mappers.getMapper(AdminConvert.class);
|
||||
|
||||
@Mappings({})
|
||||
AdminInfoVO convert(AdminSecurityContext adminSecurityContext);
|
||||
|
||||
@Mappings({})
|
||||
AdminVO convert(AdminBO adminBO);
|
||||
|
||||
@Mappings({})
|
||||
CommonResult<AdminVO> convert2(CommonResult<AdminBO> result);
|
||||
|
||||
@Mappings({})
|
||||
List<AdminRoleVO> convert(List<RoleBO> roleList);
|
||||
|
||||
@Mappings({})
|
||||
PageResult<AdminVO> convertAdminVOPage(PageResult<AdminBO> page);
|
||||
|
||||
List<AdminVO.Role> convertAdminVORoleList(Collection<RoleBO> list);
|
||||
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
/**
|
||||
* @author Sin
|
||||
* @time 2019/5/26 12:36 PM
|
||||
*/
|
||||
package cn.iocoder.mall.system.application.po;
|
||||
@@ -1,19 +0,0 @@
|
||||
package cn.iocoder.mall.system.application.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@ApiModel("登陆结果 VO")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class PassportLoginVO {
|
||||
|
||||
@ApiModelProperty(value = "访问令牌", required = true, example = "2e3d7635c15e47e997611707a237859f")
|
||||
private String accessToken;
|
||||
@ApiModelProperty(value = "刷新令牌", required = true, example = "d091e7c35bbb4313b0f557a6ef23d033")
|
||||
private String refreshToken;
|
||||
@ApiModelProperty(value = "过期时间,单位:秒", required = true, example = "2879")
|
||||
private Integer expiresIn;
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package cn.iocoder.mall.system.application.vo.admin;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@ApiModel("管理员信息 VO")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class AdminInfoVO {
|
||||
|
||||
@ApiModelProperty(value = "管理员编号", required = true, example = "1")
|
||||
private Integer adminId;
|
||||
@ApiModelProperty(value = "角色编号的数组", required = true, example = "[1, 2]")
|
||||
private Set<Integer> roleIds;
|
||||
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package cn.iocoder.mall.system.application.vo.admin;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@ApiModel("管理员拥有的角色 VO")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class AdminRoleVO {
|
||||
|
||||
@ApiModelProperty(value = "角色编号", required = true, example = "1")
|
||||
private Integer id;
|
||||
@ApiModelProperty(value = "角色名字", required = true, example = "系统管理员")
|
||||
private String name;
|
||||
@ApiModelProperty(value = "是否授权", required = true, example = "true")
|
||||
private Boolean assigned;
|
||||
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
package cn.iocoder.mall.system.application.vo.admin;
|
||||
|
||||
import cn.iocoder.mall.system.api.bo.admin.AdminBO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel("管理员 VO")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class AdminVO extends AdminBO {
|
||||
|
||||
private List<Role> roles;
|
||||
|
||||
private Deptment deptment;
|
||||
|
||||
@ApiModel("管理员 VO - 角色")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public static class Role {
|
||||
|
||||
@ApiModelProperty(value = "角色编号", required = true, example = "1")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "角色名", required = true, example = "码神")
|
||||
private String name;
|
||||
|
||||
}
|
||||
|
||||
@ApiModel("管理员 VO - 部门")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@AllArgsConstructor
|
||||
public static class Deptment {
|
||||
|
||||
@ApiModelProperty(value = "部门编号", required = true, example = "1")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "部门名称", required = true, example = "研发部")
|
||||
private String name;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
package cn.iocoder.mall.system.application.vo.resource;
|
||||
|
||||
import cn.iocoder.mall.system.api.bo.resource.ResourceBO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel("资源树结构 VO")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ResourceTreeNodeVO extends ResourceBO {
|
||||
|
||||
@ApiModelProperty(value = "子节点数组")
|
||||
private List<ResourceTreeNodeVO> children;
|
||||
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
package cn.iocoder.mall.system.application.vo.resource;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@ApiModel("资源 VO")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ResourceVO {
|
||||
|
||||
@ApiModelProperty(value = "资源编号", required = true, example = "1")
|
||||
private Integer id;
|
||||
@ApiModelProperty(value = "资源名字(标识)", required = true, example = "商品管理")
|
||||
private String name;
|
||||
@ApiModelProperty(value = "资源类型", required = true, example = "1")
|
||||
private Integer type;
|
||||
@ApiModelProperty(value = "排序", required = true, example = "1")
|
||||
private Integer sort;
|
||||
@ApiModelProperty(value = "菜单展示名", required = true, example = "商品管理")
|
||||
private String displayName;
|
||||
@ApiModelProperty(value = "创建时间", required = true, example = "时间戳格式")
|
||||
private Date createTime;
|
||||
@ApiModelProperty(value = "父级资源编号", required = true, example = "1", notes = "如果无父资源,则值为 0")
|
||||
private Integer pid;
|
||||
@ApiModelProperty(value = "操作", required = true, example = "/order/list")
|
||||
private String handler;
|
||||
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
package cn.iocoder.mall.system.application.vo.role;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel("角色拥有的资源 VO")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class RoleResourceTreeNodeVO {
|
||||
|
||||
@ApiModelProperty(value = "菜单编号", required = true, example = "1")
|
||||
private Integer id;
|
||||
// @ApiModelProperty(value = "菜单名", required = true, example = "商品管理")
|
||||
// private String name;
|
||||
@ApiModelProperty(value = "菜单操作", required = true, example = "/order/list")
|
||||
private String handler;
|
||||
@ApiModelProperty(value = "父菜单编号", required = true, example = "1", notes = "如果无父菜单,则值为 0")
|
||||
private Integer pid;
|
||||
@ApiModelProperty(value = "排序", required = true, example = "1")
|
||||
private Integer sort;
|
||||
@ApiModelProperty(value = "菜单展示名", required = true, example = "商品管理")
|
||||
private String displayName;
|
||||
@ApiModelProperty(value = "子节点数组")
|
||||
private List<RoleResourceTreeNodeVO> children;
|
||||
|
||||
@ApiModelProperty(value = "是否授权", required = true, example = "true")
|
||||
private Boolean assigned;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user