部门模块的迁移
This commit is contained in:
@@ -62,11 +62,12 @@ public enum SystemErrorCodeEnum implements ServiceExceptionUtil.Enumerable<Syste
|
||||
SMS_NOT_SEND_CLIENT(1002006030, "短信没有发送的client"),
|
||||
|
||||
// ========== 部门模块 1002007000 ==========
|
||||
// DEPT_SAME_LEVEL_NAME_EXITS(1002007001,"当前级别部门名字已存在"),
|
||||
// DEPT_PARENT_NOT_EXITS(1002007002,"父级部门不存在"),
|
||||
// DEPT_NOT_EXITS(1002007003, "当前部门不存在"),
|
||||
// DEPT_EXITS_CHILDREN(1002007004, "当前部门存在子部门"),
|
||||
// DEPT_PARENT_NOT_LEGAL(1002007005, "父级部门不合法"),
|
||||
DEPARTMENT_NAME_DUPLICATE(1002007001, "已经存在该名字的部门"),
|
||||
DEPARTMENT_PARENT_NOT_EXITS(1002007002,"父级部门不存在"),
|
||||
DEPARTMENT_NOT_FOUND(1002007003, "当前部门不存在"),
|
||||
DEPARTMENT_EXITS_CHILDREN(1002007004, "存在子部门,无法删除"),
|
||||
DEPARTMENT_PARENT_ERROR(1002007005, "不能设置自己为父资源"),
|
||||
DEPARTMENT_EXISTS_ADMIN(1002007006, "部门中存在员工,无法删除"),
|
||||
|
||||
// ========== 授权模块 1002008000 ==========
|
||||
AUTHORIZATION_PERMISSION_DENY(1002008001, "没有该操作权限"),
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package cn.iocoder.mall.systemservice.enums.admin;
|
||||
|
||||
/**
|
||||
* 部门的编号枚举
|
||||
*/
|
||||
public enum DepartmentIdEnum {
|
||||
|
||||
/**
|
||||
* 根节点
|
||||
*/
|
||||
ROOT(0);
|
||||
|
||||
private final Integer id;
|
||||
|
||||
DepartmentIdEnum(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package cn.iocoder.mall.systemservice.rpc.admin;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.systemservice.rpc.admin.dto.DepartmentCreateDTO;
|
||||
import cn.iocoder.mall.systemservice.rpc.admin.dto.DepartmentUpdateDTO;
|
||||
import cn.iocoder.mall.systemservice.rpc.admin.vo.DepartmentVO;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 部门 Rpc 接口
|
||||
*/
|
||||
public interface DepartmentRpc {
|
||||
|
||||
/**
|
||||
* 创建部门
|
||||
*
|
||||
* @param createDTO 创建部门 DTO
|
||||
* @return 部门编号
|
||||
*/
|
||||
CommonResult<Integer> createDepartment(DepartmentCreateDTO createDTO);
|
||||
|
||||
/**
|
||||
* 更新部门
|
||||
*
|
||||
* @param updateDTO 更新部门 DTO
|
||||
*/
|
||||
CommonResult<Boolean> updateDepartment(DepartmentUpdateDTO updateDTO);
|
||||
|
||||
/**
|
||||
* 删除部门
|
||||
*
|
||||
* @param departmentId 部门编号
|
||||
*/
|
||||
CommonResult<Boolean> deleteDepartment(Integer departmentId);
|
||||
|
||||
/**
|
||||
* 获得部门
|
||||
*
|
||||
* @param departmentId 部门编号
|
||||
* @return 部门
|
||||
*/
|
||||
CommonResult<DepartmentVO> getDepartment(Integer departmentId);
|
||||
|
||||
/**
|
||||
* 获得部门列表
|
||||
*
|
||||
* @param departmentIds 部门编号列表
|
||||
* @return 部门列表
|
||||
*/
|
||||
CommonResult<List<DepartmentVO>> listDepartments(Collection<Integer> departmentIds);
|
||||
|
||||
/**
|
||||
* 获得部门全列表
|
||||
*
|
||||
* @return 资源列表
|
||||
*/
|
||||
CommonResult<List<DepartmentVO>> listDepartments();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package cn.iocoder.mall.systemservice.rpc.admin.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 部门创建 DTO
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class DepartmentCreateDTO implements Serializable {
|
||||
|
||||
/**
|
||||
* 部门名称
|
||||
*/
|
||||
@NotEmpty(message = "部门名称不能为空")
|
||||
private String name;
|
||||
/**
|
||||
* 排序字段
|
||||
*/
|
||||
@NotNull(message = "排序字段不能为空")
|
||||
private Integer sort;
|
||||
/**
|
||||
* 父级部门编号
|
||||
*/
|
||||
@NotNull(message = "父级部门编号不能为空")
|
||||
private Integer pid;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package cn.iocoder.mall.systemservice.rpc.admin.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 部门更新 DTO
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class DepartmentUpdateDTO implements Serializable {
|
||||
|
||||
/**
|
||||
* 部门编号
|
||||
*/
|
||||
@NotNull(message = "部门编号不能为空")
|
||||
private Integer id;
|
||||
/**
|
||||
* 部门名称
|
||||
*/
|
||||
@NotEmpty(message = "部门名称不能为空")
|
||||
private String name;
|
||||
/**
|
||||
* 排序字段
|
||||
*/
|
||||
@NotNull(message = "排序字段不能为空")
|
||||
private Integer sort;
|
||||
/**
|
||||
* 父级部门编号
|
||||
*/
|
||||
@NotNull(message = "父级部门编号不能为空")
|
||||
private Integer pid;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package cn.iocoder.mall.systemservice.rpc.admin.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 部门 VO
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class DepartmentVO implements Serializable {
|
||||
|
||||
/**
|
||||
* 部门编号
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 部门名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 排序字段
|
||||
*/
|
||||
private Integer sort;
|
||||
/**
|
||||
* 父级部门编号
|
||||
*/
|
||||
private Integer pid;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
}
|
||||
@@ -5,6 +5,8 @@ import cn.iocoder.mall.systemservice.rpc.permission.dto.PermissionAssignAdminRol
|
||||
import cn.iocoder.mall.systemservice.rpc.permission.dto.PermissionAssignRoleResourceDTO;
|
||||
import cn.iocoder.mall.systemservice.rpc.permission.dto.PermissionCheckDTO;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
@@ -36,6 +38,15 @@ public interface PermissionRpc {
|
||||
*/
|
||||
CommonResult<Set<Integer>> listAdminRoleIds(Integer adminId);
|
||||
|
||||
/**
|
||||
* 获得每个管理员拥有的角色编号
|
||||
* 返回的结果,key 为管理员编号
|
||||
*
|
||||
* @param adminIds 管理员编号列表
|
||||
* @return 每个管理员拥有的角色编号
|
||||
*/
|
||||
CommonResult<Map<Integer, Set<Integer>>> mapAdminRoleIds(Collection<Integer> adminIds);
|
||||
|
||||
/**
|
||||
* 赋予管理员角色
|
||||
*
|
||||
|
||||
@@ -7,6 +7,7 @@ import cn.iocoder.mall.systemservice.rpc.permission.dto.RoleUpdateDTO;
|
||||
import cn.iocoder.mall.systemservice.rpc.permission.vo.RoleCreateDTO;
|
||||
import cn.iocoder.mall.systemservice.rpc.permission.vo.RoleVO;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -58,7 +59,7 @@ public interface RoleRpc {
|
||||
* @param roleIds 角色编号列表
|
||||
* @return 角色列表
|
||||
*/
|
||||
CommonResult<List<RoleVO>> listRoles(List<Integer> roleIds);
|
||||
CommonResult<List<RoleVO>> listRoles(Collection<Integer> roleIds);
|
||||
|
||||
/**
|
||||
* 获得角色分页
|
||||
|
||||
Reference in New Issue
Block a user