1. system 提供新的 Resource 相关接口

2. admin-web 接入新的 Resource 相关接口
This commit is contained in:
YunaiV
2020-04-27 19:48:58 +08:00
parent caf605063c
commit f7157d283c
34 changed files with 684 additions and 368 deletions

View File

@@ -1,36 +0,0 @@
package cn.iocoder.mall.system.api;
import cn.iocoder.mall.system.api.bo.resource.ResourceBO;
import cn.iocoder.mall.system.api.dto.resource.ResourceAddDTO;
import cn.iocoder.mall.system.api.dto.resource.ResourceUpdateDTO;
import org.springframework.lang.Nullable;
import java.util.List;
import java.util.Set;
public interface ResourceService {
/**
* 查询指定类型 + 指定角色的资源列表
*
* @param type 指定类型。可以为空,此时不作为过滤条件
* @param roleIds 指定角色的数组。
* @return 资源列表
*/
List<ResourceBO> getResourcesByTypeAndRoleIds(@Nullable Integer type, Set<Integer> roleIds);
/**
* 查询指定类型的资源列表
*
* @param type 指定类型。可以为空,此时不做为过滤条件
* @return 资源列表
*/
List<ResourceBO> getResourcesByType(@Nullable Integer type);
ResourceBO addResource(Integer adminId, ResourceAddDTO resourceAddDTO);
Boolean updateResource(Integer adminId, ResourceUpdateDTO resourceUpdateDTO);
Boolean deleteResource(Integer adminId, Integer resourceId);
}

View File

@@ -1,46 +0,0 @@
package cn.iocoder.mall.system.api.dto.resource;
import cn.iocoder.common.framework.validator.InEnum;
import cn.iocoder.mall.system.api.constant.ResourceTypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;
@ApiModel("资源添加 DTO")
@Data
@Accessors(chain = true)
public class ResourceAddDTO implements Serializable {
@ApiModelProperty(value = "资源类型。1 代表【菜单】2 代表【按钮】", required = true, example = "1")
@NotNull(message = "类型不能为空")
@InEnum(value = ResourceTypeEnum.class, message = "资源类型必须是 {value}")
private Integer type;
@ApiModelProperty(value = "排序", required = true, example = "1")
@NotNull(message = "类型不能为空")
private Integer sort;
@ApiModelProperty(value = "菜单展示名", required = true, example = "商品管理")
@NotEmpty(message = "资源名字不能为空")
private String displayName;
@ApiModelProperty(value = "父级资源编号", required = true, example = "1")
@NotNull(message = "父级资源编号不能为空")
private Integer pid;
@ApiModelProperty(value = "操作", example = "/order/list")
private String handler;
@ApiModelProperty(value = "图标", example = "add")
private String icon;
@ApiModelProperty(value = "权限标识数组", example = "system.order.add,system.order.update")
private List<String> permissions;
}

View File

@@ -1,50 +0,0 @@
package cn.iocoder.mall.system.api.dto.resource;
import cn.iocoder.common.framework.validator.InEnum;
import cn.iocoder.mall.system.api.constant.ResourceTypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;
@ApiModel("资源更新 DTO")
@Data
@Accessors(chain = true)
public class ResourceUpdateDTO implements Serializable {
@ApiModelProperty(value = "资源编号", required = true, example = "1")
@NotNull(message = "资源编号不能为空")
private Integer id;
@ApiModelProperty(value = "资源类型。1 代表【菜单】2 代表【按钮】", required = true, example = "1")
@NotNull(message = "类型不能为空")
@InEnum(value = ResourceTypeEnum.class, message = "资源类型必须是 {value}")
private Integer type;
@ApiModelProperty(value = "排序", required = true, example = "1")
@NotNull(message = "类型不能为空")
private Integer sort;
@ApiModelProperty(value = "菜单展示名", required = true, example = "商品管理")
@NotEmpty(message = "资源名字不能为空")
private String displayName;
@ApiModelProperty(value = "父级资源编号", required = true, example = "1")
@NotNull(message = "父级资源编号不能为空")
private Integer pid;
@ApiModelProperty(value = "操作", example = "/order/list")
private String handler;
@ApiModelProperty(value = "图标", example = "add")
private String icon;
@ApiModelProperty(value = "权限标识数组", example = "system.order.add,system.order.update")
private List<String> permissions;
}