删除已迁移的代码
This commit is contained in:
parent
846510c309
commit
f8cfb32b13
@ -1,46 +0,0 @@
|
|||||||
package cn.iocoder.mall.system.rest.controller.admin;
|
|
||||||
|
|
||||||
import cn.iocoder.common.framework.enums.MallConstants;
|
|
||||||
import cn.iocoder.common.framework.vo.CommonResult;
|
|
||||||
import cn.iocoder.common.framework.vo.PageResult;
|
|
||||||
import cn.iocoder.mall.security.core.annotation.RequiresPermissions;
|
|
||||||
import cn.iocoder.mall.system.biz.bo.admin.AdminBO;
|
|
||||||
import cn.iocoder.mall.system.biz.dto.admin.AdminPageDTO;
|
|
||||||
import cn.iocoder.mall.system.biz.service.admin.AdminService;
|
|
||||||
import cn.iocoder.mall.system.rest.convert.admin.AdminsAdminConvert;
|
|
||||||
import cn.iocoder.mall.system.rest.request.admin.AdminsAdminPageRequest;
|
|
||||||
import cn.iocoder.mall.system.rest.response.admin.AdminsAdminPageResponse;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
@RestController
|
|
||||||
@RequestMapping(MallConstants.ROOT_PATH_ADMIN + "/admin")
|
|
||||||
@Api(tags = "管理员 - 管理员 API")
|
|
||||||
public class AdminsAdminController {
|
|
||||||
|
|
||||||
// @GetMapping("/role_list")
|
|
||||||
// @ApiOperation(value = "指定管理员拥有的角色列表")
|
|
||||||
// @ApiImplicitParam(name = "id", value = "管理员编号", required = true, example = "1")
|
|
||||||
// public CommonResult<List<AdminRoleVO>> roleList(@RequestParam("id") Integer id) {
|
|
||||||
// // 获得所有角色列表
|
|
||||||
// List<RoleBO> allRoleList = roleService.getRoleList();
|
|
||||||
// // 获得管理员的角色数组
|
|
||||||
// Set<Integer> adminRoleIdSet = CollectionUtil.convertSet(adminService.getRoleList(id), RoleBO::getId);
|
|
||||||
// // 转换出返回结果
|
|
||||||
// List<AdminRoleVO> result = AdminConvert.INSTANCE.convert(allRoleList);
|
|
||||||
// // 设置每个角色是否赋予给改管理员
|
|
||||||
// result.forEach(adminRoleVO -> adminRoleVO.setAssigned(adminRoleIdSet.contains(adminRoleVO.getId())));
|
|
||||||
// return success(result);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// @PostMapping("/assign_role")
|
|
||||||
// @ApiOperation(value = "分配给管理员角色")
|
|
||||||
// public CommonResult<Boolean> assignRole(AdminAssignRoleDTO adminAssignRoleDTO) {
|
|
||||||
// return success(adminService.assignAdminRole(AdminSecurityContextHolder.getContext().getAdminId(), adminAssignRoleDTO));
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
|
@ -1,67 +0,0 @@
|
|||||||
package cn.iocoder.mall.system.rest.controller.authorization;
|
|
||||||
|
|
||||||
import cn.iocoder.common.framework.enums.MallConstants;
|
|
||||||
import cn.iocoder.common.framework.vo.CommonResult;
|
|
||||||
import cn.iocoder.mall.security.core.annotation.RequiresPermissions;
|
|
||||||
import cn.iocoder.mall.security.core.context.AdminSecurityContextHolder;
|
|
||||||
import cn.iocoder.mall.system.biz.bo.authorization.ResourceBO;
|
|
||||||
import cn.iocoder.mall.system.biz.bo.authorization.ResourceTreeNodeBO;
|
|
||||||
import cn.iocoder.mall.system.biz.dto.authorization.AuthorizationAssignRoleResourceDTO;
|
|
||||||
import cn.iocoder.mall.system.biz.dto.authorization.AuthorizationGetResourcesByAccountIdDTO;
|
|
||||||
import cn.iocoder.mall.system.biz.dto.authorization.AuthorizationGetRoleResourcesDTO;
|
|
||||||
import cn.iocoder.mall.system.biz.dto.authorization.ResourceGetTreeDTO;
|
|
||||||
import cn.iocoder.mall.system.biz.enums.authorization.ResourceTypeEnum;
|
|
||||||
import cn.iocoder.mall.system.biz.service.authorization.AuthorizationService;
|
|
||||||
import cn.iocoder.mall.system.biz.service.authorization.ResourceService;
|
|
||||||
import cn.iocoder.mall.system.biz.service.authorization.RoleService;
|
|
||||||
import cn.iocoder.mall.system.rest.convert.authorization.AdminsAuthorizationConvert;
|
|
||||||
import cn.iocoder.mall.system.rest.request.authorization.AdminsAuthorizationAssignRoleResourceRequest;
|
|
||||||
import cn.iocoder.mall.system.rest.response.authorization.AdminsAuthorizationMenuTreeResponse;
|
|
||||||
import cn.iocoder.mall.system.rest.response.authorization.AdminsAuthorizationRoleResourceTreeResponse;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
@RestController
|
|
||||||
@RequestMapping(MallConstants.ROOT_PATH_ADMIN + "/authorization")
|
|
||||||
@Api(tags = "管理员 - 授权 API")
|
|
||||||
@Slf4j
|
|
||||||
public class AdminsAuthorizationController {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private AuthorizationService authorizationService;
|
|
||||||
@Autowired
|
|
||||||
private ResourceService resourceService;
|
|
||||||
@Autowired
|
|
||||||
private RoleService roleService;
|
|
||||||
|
|
||||||
// @GetMapping("/role_list")
|
|
||||||
// @ApiOperation(value = "指定账号拥有的角色列表")
|
|
||||||
// @ApiImplicitParam(name = "accountId", value = "账号编号", required = true, example = "1")
|
|
||||||
// public CommonResult<List<AdminRoleVO>> roleList(@RequestParam("accountId") Integer accountId) {
|
|
||||||
// // 获得所有角色列表
|
|
||||||
// List<RoleBO> allRoleList = roleService.getRoleList();
|
|
||||||
// // 获得管理员的角色数组
|
|
||||||
// Set<Integer> adminRoleIdSet = CollectionUtil.convertSet(adminService.getRoleList(id), RoleBO::getId);
|
|
||||||
// // 转换出返回结果
|
|
||||||
// List<AdminRoleVO> result = AdminConvert.INSTANCE.convert(allRoleList);
|
|
||||||
// // 设置每个角色是否赋予给改管理员
|
|
||||||
// result.forEach(adminRoleVO -> adminRoleVO.setAssigned(adminRoleIdSet.contains(adminRoleVO.getId())));
|
|
||||||
// return success(result);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @PostMapping("/assign_role")
|
|
||||||
// @ApiOperation(value = "分配给管理员角色")
|
|
||||||
// public CommonResult<Boolean> assignRole(AdminAssignRoleDTO adminAssignRoleDTO) {
|
|
||||||
// return success(adminService.assignAdminRole(AdminSecurityContextHolder.getContext().getAdminId(), adminAssignRoleDTO));
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,24 +0,0 @@
|
|||||||
package cn.iocoder.mall.system.rest.convert.admin;
|
|
||||||
|
|
||||||
import cn.iocoder.common.framework.vo.PageResult;
|
|
||||||
import cn.iocoder.mall.system.biz.bo.account.AccountUsernameAuthorizeBO;
|
|
||||||
import cn.iocoder.mall.system.biz.bo.admin.AdminBO;
|
|
||||||
import cn.iocoder.mall.system.biz.dto.admin.AdminPageDTO;
|
|
||||||
import cn.iocoder.mall.system.rest.request.admin.AdminsAdminPageRequest;
|
|
||||||
import cn.iocoder.mall.system.rest.request.oauth2.AdminsOAuth2UsernameAuthenticateRequest;
|
|
||||||
import cn.iocoder.mall.system.rest.response.admin.AdminsAdminPageResponse;
|
|
||||||
import org.mapstruct.Mapper;
|
|
||||||
import org.mapstruct.factory.Mappers;
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface AdminsAdminConvert {
|
|
||||||
|
|
||||||
AdminsAdminConvert INSTANCE = Mappers.getMapper(AdminsAdminConvert.class);
|
|
||||||
|
|
||||||
AccountUsernameAuthorizeBO convert(AdminsOAuth2UsernameAuthenticateRequest bean);
|
|
||||||
|
|
||||||
AdminPageDTO convert(AdminsAdminPageRequest bean);
|
|
||||||
|
|
||||||
PageResult<AdminsAdminPageResponse> convertPage(PageResult<AdminBO> bean);
|
|
||||||
|
|
||||||
}
|
|
@ -1,55 +0,0 @@
|
|||||||
package cn.iocoder.mall.system.rest.convert.authorization;
|
|
||||||
|
|
||||||
import cn.iocoder.mall.system.biz.bo.authorization.ResourceBO;
|
|
||||||
import cn.iocoder.mall.system.biz.bo.authorization.ResourceTreeNodeBO;
|
|
||||||
import cn.iocoder.mall.system.biz.dto.authorization.AuthorizationAssignRoleResourceDTO;
|
|
||||||
import cn.iocoder.mall.system.rest.request.authorization.AdminsAuthorizationAssignRoleResourceRequest;
|
|
||||||
import cn.iocoder.mall.system.rest.response.authorization.AdminsAuthorizationMenuTreeResponse;
|
|
||||||
import cn.iocoder.mall.system.rest.response.authorization.AdminsAuthorizationRoleResourceTreeResponse;
|
|
||||||
import org.mapstruct.Mapper;
|
|
||||||
import org.mapstruct.Mapping;
|
|
||||||
import org.mapstruct.factory.Mappers;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface AdminsAuthorizationConvert {
|
|
||||||
|
|
||||||
AdminsAuthorizationConvert INSTANCE = Mappers.getMapper(AdminsAuthorizationConvert.class);
|
|
||||||
|
|
||||||
AdminsAuthorizationMenuTreeResponse convert(ResourceBO bean);
|
|
||||||
|
|
||||||
@Mapping(source = "node.id", target = "id")
|
|
||||||
@Mapping(source = "node.name", target = "name")
|
|
||||||
@Mapping(source = "node.route", target = "route")
|
|
||||||
@Mapping(source = "node.icon", target = "icon")
|
|
||||||
AdminsAuthorizationMenuTreeResponse convert(ResourceTreeNodeBO bean);
|
|
||||||
|
|
||||||
@Mapping(source = "node.id", target = "id")
|
|
||||||
@Mapping(source = "node.name", target = "name")
|
|
||||||
AdminsAuthorizationRoleResourceTreeResponse convert2(ResourceTreeNodeBO bean);
|
|
||||||
|
|
||||||
List<AdminsAuthorizationMenuTreeResponse> convertList(List<ResourceTreeNodeBO> beans);
|
|
||||||
|
|
||||||
default List<AdminsAuthorizationRoleResourceTreeResponse> convertList(List<ResourceTreeNodeBO> beans, Set<Integer> roleResourceIds) {
|
|
||||||
if (beans == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
List<AdminsAuthorizationRoleResourceTreeResponse> responses = new ArrayList<>(beans.size());
|
|
||||||
for (ResourceTreeNodeBO bean : beans) {
|
|
||||||
// 转换
|
|
||||||
AdminsAuthorizationRoleResourceTreeResponse response = this.convert2(bean);
|
|
||||||
response.setAssigned(roleResourceIds.contains(bean.getNode().getId()));
|
|
||||||
// 递归子节点
|
|
||||||
response.setChildren(this.convertList(bean.getChildren(), roleResourceIds));
|
|
||||||
// 添加到结果
|
|
||||||
responses.add(response);
|
|
||||||
}
|
|
||||||
return responses;
|
|
||||||
}
|
|
||||||
|
|
||||||
AuthorizationAssignRoleResourceDTO convert(AdminsAuthorizationAssignRoleResourceRequest request);
|
|
||||||
|
|
||||||
}
|
|
@ -1,36 +0,0 @@
|
|||||||
package cn.iocoder.mall.system.rest.convert.authorization;
|
|
||||||
|
|
||||||
import cn.iocoder.mall.system.biz.bo.authorization.ResourceTreeNodeBO;
|
|
||||||
import cn.iocoder.mall.system.biz.dto.authorization.ResourceAddDTO;
|
|
||||||
import cn.iocoder.mall.system.biz.dto.authorization.ResourceUpdateDTO;
|
|
||||||
import cn.iocoder.mall.system.rest.request.authorization.AdminsResourceAddRequest;
|
|
||||||
import cn.iocoder.mall.system.rest.request.authorization.AdminsResourceUpdateRequest;
|
|
||||||
import cn.iocoder.mall.system.rest.response.authorization.AdminsResourceTreeResponse;
|
|
||||||
import org.mapstruct.Mapper;
|
|
||||||
import org.mapstruct.Mapping;
|
|
||||||
import org.mapstruct.factory.Mappers;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface AdminsResourceConvert {
|
|
||||||
|
|
||||||
AdminsResourceConvert INSTANCE = Mappers.getMapper(AdminsResourceConvert.class);
|
|
||||||
|
|
||||||
@Mapping(source = "node.id", target = "id")
|
|
||||||
@Mapping(source = "node.name", target = "name")
|
|
||||||
@Mapping(source = "node.permission", target = "permission")
|
|
||||||
@Mapping(source = "node.type", target = "type")
|
|
||||||
@Mapping(source = "node.sort", target = "sort")
|
|
||||||
@Mapping(source = "node.pid", target = "pid")
|
|
||||||
@Mapping(source = "node.route", target = "route")
|
|
||||||
@Mapping(source = "node.icon", target = "icon")
|
|
||||||
AdminsResourceTreeResponse convert(ResourceTreeNodeBO bean);
|
|
||||||
|
|
||||||
List<AdminsResourceTreeResponse> convertList(List<ResourceTreeNodeBO> beans);
|
|
||||||
|
|
||||||
ResourceAddDTO convert(AdminsResourceAddRequest bean);
|
|
||||||
|
|
||||||
ResourceUpdateDTO convert(AdminsResourceUpdateRequest bean);
|
|
||||||
|
|
||||||
}
|
|
@ -1,7 +0,0 @@
|
|||||||
package cn.iocoder.mall.system.rest.convert.user;
|
|
||||||
|
|
||||||
import org.mapstruct.Mapper;
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface UsersUserConvert {
|
|
||||||
}
|
|
@ -1,23 +0,0 @@
|
|||||||
package cn.iocoder.mall.system.rest.request.authorization;
|
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.experimental.Accessors;
|
|
||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
@ApiModel(value = "管理员 - 授权模块 - 分配角色资源 Request")
|
|
||||||
@Data
|
|
||||||
@Accessors(chain = true)
|
|
||||||
public class AdminsAuthorizationAssignRoleResourceRequest {
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "角色编号", required = true, example = "1")
|
|
||||||
@NotNull(message = "角色编号不能为空")
|
|
||||||
private Integer roleId;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "资源编号数组", example = "1,2")
|
|
||||||
private Set<Integer> resourceIds;
|
|
||||||
|
|
||||||
}
|
|
@ -1,44 +0,0 @@
|
|||||||
package cn.iocoder.mall.system.rest.request.authorization;
|
|
||||||
|
|
||||||
import cn.iocoder.common.framework.validator.InEnum;
|
|
||||||
import cn.iocoder.mall.system.biz.enums.authorization.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;
|
|
||||||
|
|
||||||
@ApiModel("管理员 - 资源模块 - 添加资源 Request")
|
|
||||||
@Data
|
|
||||||
@Accessors(chain = true)
|
|
||||||
public class AdminsResourceAddRequest {
|
|
||||||
|
|
||||||
@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 name;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "父级资源编号", required = true, example = "1")
|
|
||||||
@NotNull(message = "父级资源编号不能为空")
|
|
||||||
private Integer pid;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "前端路由", example = "/order/list")
|
|
||||||
private String route;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "图标", example = "add")
|
|
||||||
private String icon;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "权限标识", example = "permission")
|
|
||||||
private String permission;
|
|
||||||
|
|
||||||
}
|
|
@ -1,48 +0,0 @@
|
|||||||
package cn.iocoder.mall.system.rest.request.authorization;
|
|
||||||
|
|
||||||
import cn.iocoder.common.framework.validator.InEnum;
|
|
||||||
import cn.iocoder.mall.system.biz.enums.authorization.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;
|
|
||||||
|
|
||||||
@ApiModel("管理员 - 资源模块 - 更新资源 Request")
|
|
||||||
@Data
|
|
||||||
@Accessors(chain = true)
|
|
||||||
public class AdminsResourceUpdateRequest {
|
|
||||||
|
|
||||||
@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 name;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "父级资源编号", required = true, example = "1")
|
|
||||||
@NotNull(message = "父级资源编号不能为空")
|
|
||||||
private Integer pid;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "前端路由", example = "/order/list")
|
|
||||||
private String route;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "图标", example = "add")
|
|
||||||
private String icon;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "权限标识", example = "permission")
|
|
||||||
private String permission;
|
|
||||||
|
|
||||||
}
|
|
@ -1,22 +0,0 @@
|
|||||||
package cn.iocoder.mall.system.rest.request.authorization;
|
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.experimental.Accessors;
|
|
||||||
|
|
||||||
import javax.validation.constraints.NotEmpty;
|
|
||||||
|
|
||||||
@ApiModel("管理员 - 角色模块 - 添加角色 Request")
|
|
||||||
@Data
|
|
||||||
@Accessors(chain = true)
|
|
||||||
public class AdminsRoleAddRequest {
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "角色名字", required = true, example = "系统管理员")
|
|
||||||
@NotEmpty(message = "角色名字不能为空")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "角色编码", example = "SUPER_ADMIN")
|
|
||||||
private String code;
|
|
||||||
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
package cn.iocoder.mall.system.rest.request.authorization;
|
|
||||||
|
|
||||||
import cn.iocoder.common.framework.vo.PageParam;
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
import lombok.experimental.Accessors;
|
|
||||||
|
|
||||||
@ApiModel("管理员 - 角色模块 - 分页列表 Request")
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@Accessors(chain = true)
|
|
||||||
public class AdminsRolePageRequest extends PageParam {
|
|
||||||
|
|
||||||
@ApiModelProperty( value = "角色名,模糊匹配", example = "系统管理员")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,27 +0,0 @@
|
|||||||
package cn.iocoder.mall.system.rest.request.authorization;
|
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
@ApiModel("管理员 - 角色模块 - 修改角色 Request")
|
|
||||||
@Data
|
|
||||||
@Accessors(chain = true)
|
|
||||||
public class AdminsRoleUpdateRequest {
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "角色编号", required = true, example = "1")
|
|
||||||
@NotNull(message = "角色编号不能为空")
|
|
||||||
private Integer id;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "角色名字", required = true, example = "系统管理员")
|
|
||||||
@NotEmpty(message = "角色名字不能为空")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "角色编码", example = "SUPER_ADMIN")
|
|
||||||
private String code;
|
|
||||||
|
|
||||||
}
|
|
@ -1,4 +0,0 @@
|
|||||||
/**
|
|
||||||
* 提供 system 服务的 RPC 接口的定义,提供内部调用
|
|
||||||
*/
|
|
||||||
package cn.iocoder.mall.system.rpc;
|
|
@ -1,15 +0,0 @@
|
|||||||
package cn.iocoder.mall.system.rpc.convert.admn;
|
|
||||||
|
|
||||||
import cn.iocoder.mall.system.biz.bo.admin.AdminBO;
|
|
||||||
import cn.iocoder.mall.system.rpc.response.admin.AdminResponse;
|
|
||||||
import org.mapstruct.Mapper;
|
|
||||||
import org.mapstruct.factory.Mappers;
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface AdminCovert {
|
|
||||||
|
|
||||||
AdminCovert INSTANCE = Mappers.getMapper(AdminCovert.class);
|
|
||||||
|
|
||||||
AdminResponse convert(AdminBO bean);
|
|
||||||
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
package cn.iocoder.mall.system.rpc.convert.authorization;
|
|
||||||
|
|
||||||
import cn.iocoder.mall.system.biz.dto.authorization.AuthorizationCheckPermissionsDTO;
|
|
||||||
import cn.iocoder.mall.system.rpc.request.authorization.AuthorizationCheckPermissionsRequest;
|
|
||||||
import org.mapstruct.Mapper;
|
|
||||||
import org.mapstruct.factory.Mappers;
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface AuthorizationConvert {
|
|
||||||
|
|
||||||
AuthorizationConvert INSTANCE = Mappers.getMapper(AuthorizationConvert.class);
|
|
||||||
|
|
||||||
AuthorizationCheckPermissionsDTO convert(AuthorizationCheckPermissionsRequest bean);
|
|
||||||
|
|
||||||
}
|
|
@ -1,19 +0,0 @@
|
|||||||
package cn.iocoder.mall.system.rpc.convert.oauth2;
|
|
||||||
|
|
||||||
import cn.iocoder.mall.system.biz.bo.ouath2.OAuth2AuthenticateBO;
|
|
||||||
import cn.iocoder.mall.system.biz.dto.oatuh2.OAuth2AccessTokenAuthenticateDTO;
|
|
||||||
import cn.iocoder.mall.system.rpc.request.oauth2.OAuth2AccessTokenAuthenticateRequest;
|
|
||||||
import cn.iocoder.mall.system.rpc.response.oauth2.OAuth2AccessTokenResponse;
|
|
||||||
import org.mapstruct.Mapper;
|
|
||||||
import org.mapstruct.factory.Mappers;
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface OAuth2Convert {
|
|
||||||
|
|
||||||
OAuth2Convert INSTANCE = Mappers.getMapper(OAuth2Convert.class);
|
|
||||||
|
|
||||||
OAuth2AccessTokenAuthenticateDTO convert(OAuth2AccessTokenAuthenticateRequest authenticateRequest);
|
|
||||||
|
|
||||||
OAuth2AccessTokenResponse convert(OAuth2AuthenticateBO bean);
|
|
||||||
|
|
||||||
}
|
|
@ -1,25 +0,0 @@
|
|||||||
package cn.iocoder.mall.system.rpc.rpc.authorization;
|
|
||||||
|
|
||||||
import cn.iocoder.common.framework.vo.CommonResult;
|
|
||||||
import cn.iocoder.mall.system.biz.dto.authorization.AuthorizationCheckPermissionsDTO;
|
|
||||||
import cn.iocoder.mall.system.biz.service.authorization.AuthorizationService;
|
|
||||||
import cn.iocoder.mall.system.rpc.api.authorization.AuthorizationRPC;
|
|
||||||
import cn.iocoder.mall.system.rpc.convert.authorization.AuthorizationConvert;
|
|
||||||
import cn.iocoder.mall.system.rpc.request.authorization.AuthorizationCheckPermissionsRequest;
|
|
||||||
import org.apache.dubbo.config.annotation.Service;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
|
|
||||||
@Service(version = "${dubbo.provider.AuthorizationRPC.version}", validation = "true")
|
|
||||||
public class AuthorizationRPCImpl implements AuthorizationRPC {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private AuthorizationService authorizationService;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public CommonResult<Boolean> checkPermissions(AuthorizationCheckPermissionsRequest checkPermissionsRequest) {
|
|
||||||
AuthorizationCheckPermissionsDTO checkPermissionsDTO = AuthorizationConvert.INSTANCE.convert(checkPermissionsRequest);
|
|
||||||
authorizationService.checkPermissions(checkPermissionsDTO);
|
|
||||||
return CommonResult.success(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,31 +0,0 @@
|
|||||||
package cn.iocoder.mall.system.api;
|
|
||||||
|
|
||||||
import cn.iocoder.common.framework.vo.PageResult;
|
|
||||||
import cn.iocoder.mall.system.api.bo.deptment.DeptmentBO;
|
|
||||||
import cn.iocoder.mall.system.api.dto.depetment.DeptmentAddDTO;
|
|
||||||
import cn.iocoder.mall.system.api.dto.depetment.DeptmentPageDTO;
|
|
||||||
import cn.iocoder.mall.system.api.dto.depetment.DeptmentUpdateDTO;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Description:
|
|
||||||
*
|
|
||||||
* @author: zhenxianyimeng
|
|
||||||
* @date: 2019-06-14
|
|
||||||
* @time: 19:35
|
|
||||||
*/
|
|
||||||
public interface DeptmentService {
|
|
||||||
|
|
||||||
DeptmentBO addDeptment(Integer adminId, DeptmentAddDTO deptmentAddDTO);
|
|
||||||
|
|
||||||
Boolean deleteDeptment(Integer adminId, Integer deptmentId);
|
|
||||||
|
|
||||||
Boolean updateDeptment(Integer adminId, DeptmentUpdateDTO deptmentUpdateDTO);
|
|
||||||
|
|
||||||
PageResult<DeptmentBO> getPageRootDeptment(DeptmentPageDTO deptmentPageDTO);
|
|
||||||
|
|
||||||
List<DeptmentBO> getAllDeptments();
|
|
||||||
|
|
||||||
List<DeptmentBO> getAllNotRootDeptment();
|
|
||||||
}
|
|
@ -1,44 +0,0 @@
|
|||||||
package cn.iocoder.mall.system.api.bo.deptment;
|
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Description:
|
|
||||||
*
|
|
||||||
* @author: zhenxianyimeng
|
|
||||||
* @date: 2019-06-14
|
|
||||||
* @time: 19:49
|
|
||||||
*/
|
|
||||||
@ApiModel("部门 BO")
|
|
||||||
@Data
|
|
||||||
public class DeptmentBO implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 7656901281539594453L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 部门编号
|
|
||||||
*/
|
|
||||||
private Integer id;
|
|
||||||
/**
|
|
||||||
* 部门名称
|
|
||||||
*/
|
|
||||||
private String name;
|
|
||||||
/**
|
|
||||||
* 部门排序字段
|
|
||||||
*/
|
|
||||||
private Integer sort;
|
|
||||||
/**
|
|
||||||
* 父级部门id
|
|
||||||
*/
|
|
||||||
private Integer pid;
|
|
||||||
|
|
||||||
private Date createTime;
|
|
||||||
|
|
||||||
private Date updateTime;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,35 +0,0 @@
|
|||||||
package cn.iocoder.mall.system.api.dto.depetment;
|
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import javax.validation.constraints.Min;
|
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Description:
|
|
||||||
*
|
|
||||||
* @author: zhenxianyimeng
|
|
||||||
* @date: 2019-06-14
|
|
||||||
* @time: 19:55
|
|
||||||
*/
|
|
||||||
@ApiModel("添加部门 DTO")
|
|
||||||
@Data
|
|
||||||
public class DeptmentAddDTO {
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "名字", required = true, example = "销售一组")
|
|
||||||
@NotNull(message = "不能为空")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "排序", required = true, example = "1")
|
|
||||||
@NotNull(message = "不能为空")
|
|
||||||
private Integer sort;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "父级id", required = true, example = "1")
|
|
||||||
@NotNull(message = "可以为空,默认0,顶层")
|
|
||||||
@Min(value = 0,message = "父id不能小于0")
|
|
||||||
private Integer pid = 0;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,23 +0,0 @@
|
|||||||
package cn.iocoder.mall.system.api.dto.depetment;
|
|
||||||
|
|
||||||
import cn.iocoder.common.framework.vo.PageParam;
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.experimental.Accessors;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Description:
|
|
||||||
*
|
|
||||||
* @author: zhenxianyimeng
|
|
||||||
* @date: 2019-06-21
|
|
||||||
* @time: 00:22
|
|
||||||
*/
|
|
||||||
@ApiModel(value = "部门分页 DTO")
|
|
||||||
@Data
|
|
||||||
@Accessors(chain = true)
|
|
||||||
public class DeptmentPageDTO extends PageParam {
|
|
||||||
@ApiModelProperty(value = "根部门名字", example = "研发部")
|
|
||||||
private String name;
|
|
||||||
}
|
|
@ -1,39 +0,0 @@
|
|||||||
package cn.iocoder.mall.system.api.dto.depetment;
|
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import javax.validation.constraints.NotEmpty;
|
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Description:
|
|
||||||
*
|
|
||||||
* @author: zhenxianyimeng
|
|
||||||
* @date: 2019-06-26
|
|
||||||
* @time: 22:37
|
|
||||||
*/
|
|
||||||
@ApiModel("部门更新DTO")
|
|
||||||
@Data
|
|
||||||
public class DeptmentUpdateDTO implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 8905970407110374395L;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "部门id", required = true, example = "1")
|
|
||||||
@NotNull(message = "部门id不能为空")
|
|
||||||
private Integer id;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "部门名字", required = true, example = "销售部")
|
|
||||||
@NotEmpty(message = "部门名字不为空")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "部门排序", required = true, example = "1")
|
|
||||||
@NotNull(message = "部门排序不为空")
|
|
||||||
private Integer sort;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "父级部门id", required = true, example = "1")
|
|
||||||
private Integer pid;
|
|
||||||
|
|
||||||
}
|
|
@ -1,50 +0,0 @@
|
|||||||
package cn.iocoder.mall.admin.dao;
|
|
||||||
|
|
||||||
import cn.iocoder.common.framework.mybatis.QueryWrapperX;
|
|
||||||
import cn.iocoder.mall.system.api.dto.depetment.DeptmentPageDTO;
|
|
||||||
import cn.iocoder.mall.admin.dataobject.DeptmentDO;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Description:
|
|
||||||
*
|
|
||||||
* @author: zhenxianyimeng
|
|
||||||
* @date: 2019-06-14
|
|
||||||
* @time: 19:26
|
|
||||||
*/
|
|
||||||
public interface DeptmentMapper extends BaseMapper<DeptmentDO> {
|
|
||||||
|
|
||||||
default DeptmentDO findDeptByNameAndPid(String name, Integer pid){
|
|
||||||
return selectOne(new QueryWrapper<DeptmentDO>()
|
|
||||||
.eq("name", name)
|
|
||||||
.eq("pid", pid)
|
|
||||||
.eq("deleted", false)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
default IPage<DeptmentDO> selectDeptPage(DeptmentPageDTO deptmentPageDTO, Integer pid){
|
|
||||||
return selectPage(new Page<>(deptmentPageDTO.getPageNo(), deptmentPageDTO.getPageSize()),
|
|
||||||
new QueryWrapperX<DeptmentDO>()
|
|
||||||
.likeIfPresent("name", deptmentPageDTO.getName())
|
|
||||||
.eqIfPresent("pid", pid)
|
|
||||||
.eq("deleted", false));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
default List<DeptmentDO> getDeptByPid(Integer pid){
|
|
||||||
return selectList(new QueryWrapperX<DeptmentDO>()
|
|
||||||
.eqIfPresent("pid", pid)
|
|
||||||
.eq("deleted", false));
|
|
||||||
}
|
|
||||||
|
|
||||||
default List<DeptmentDO> getDeptExcudePid(Integer pid){
|
|
||||||
return selectList(new QueryWrapper<DeptmentDO>()
|
|
||||||
.ne("pid",pid)
|
|
||||||
.eq("deleted",false));
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,24 +0,0 @@
|
|||||||
package cn.iocoder.mall.admin.dao;
|
|
||||||
|
|
||||||
import cn.iocoder.mall.admin.dataobject.DeptmentRoleDO;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Description:
|
|
||||||
*
|
|
||||||
* @author: zhenxianyimeng
|
|
||||||
* @date: 2019-06-14
|
|
||||||
* @time: 19:27
|
|
||||||
*/
|
|
||||||
public interface DeptmentRoleMapper extends BaseMapper<DeptmentRoleDO> {
|
|
||||||
|
|
||||||
default int deleteByDeptmentId(Integer deptmentId){
|
|
||||||
return delete(new QueryWrapper<DeptmentRoleDO>().eq("deptment_id", deptmentId));
|
|
||||||
}
|
|
||||||
|
|
||||||
default int deleteByRoleId(Integer roleId){
|
|
||||||
return delete(new QueryWrapper<DeptmentRoleDO>().eq("role_id", roleId));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,122 +0,0 @@
|
|||||||
package cn.iocoder.mall.admin.service;
|
|
||||||
|
|
||||||
import cn.iocoder.common.framework.util.ServiceExceptionUtil;
|
|
||||||
import cn.iocoder.common.framework.vo.PageResult;
|
|
||||||
import cn.iocoder.mall.system.api.DeptmentService;
|
|
||||||
import cn.iocoder.mall.system.api.bo.deptment.DeptmentBO;
|
|
||||||
import cn.iocoder.mall.system.api.constant.AdminErrorCodeEnum;
|
|
||||||
import cn.iocoder.mall.system.api.constant.DeptmentConstants;
|
|
||||||
import cn.iocoder.mall.system.api.dto.depetment.DeptmentAddDTO;
|
|
||||||
import cn.iocoder.mall.system.api.dto.depetment.DeptmentPageDTO;
|
|
||||||
import cn.iocoder.mall.system.api.dto.depetment.DeptmentUpdateDTO;
|
|
||||||
import cn.iocoder.mall.admin.convert.DeptmentConvert;
|
|
||||||
import cn.iocoder.mall.admin.dao.AdminMapper;
|
|
||||||
import cn.iocoder.mall.admin.dao.DeptmentMapper;
|
|
||||||
import cn.iocoder.mall.admin.dao.DeptmentRoleMapper;
|
|
||||||
import cn.iocoder.mall.admin.dataobject.DeptmentDO;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
import org.springframework.util.CollectionUtils;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Description:
|
|
||||||
*
|
|
||||||
* @author: zhenxianyimeng
|
|
||||||
* @date: 2019-06-14
|
|
||||||
* @time: 19:30
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class DeptmentServiceImpl implements DeptmentService {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private DeptmentMapper deptmentMapper;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private DeptmentRoleMapper deptmentRoleMapper;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private AdminMapper adminMapper;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public DeptmentBO addDeptment(Integer adminId, DeptmentAddDTO deptmentAddDTO) {
|
|
||||||
if (deptmentAddDTO.getPid() != 0 &&
|
|
||||||
deptmentMapper.selectById(deptmentAddDTO.getPid()) == null) {
|
|
||||||
throw ServiceExceptionUtil.exception(AdminErrorCodeEnum.DEPT_PARENT_NOT_EXITS.getCode());
|
|
||||||
}
|
|
||||||
//不同的大部门下好像可以小部门名字一样,验证同级别部门名字
|
|
||||||
if (null != deptmentMapper.findDeptByNameAndPid(deptmentAddDTO.getName(), deptmentAddDTO.getPid())) {
|
|
||||||
throw ServiceExceptionUtil.exception(AdminErrorCodeEnum.DEPT_SAME_LEVEL_NAME_EXITS.getCode());
|
|
||||||
}
|
|
||||||
DeptmentDO deptmentDO = DeptmentConvert.INSTANCE.convert(deptmentAddDTO);
|
|
||||||
deptmentMapper.insert(deptmentDO);
|
|
||||||
return DeptmentConvert.INSTANCE.convert(deptmentDO);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public Boolean deleteDeptment(Integer adminId, Integer deptmentId) {
|
|
||||||
if(deptmentMapper.selectById(deptmentId) == null){
|
|
||||||
throw ServiceExceptionUtil.exception(AdminErrorCodeEnum.DEPT_NOT_EXITS.getCode());
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!CollectionUtils.isEmpty(deptmentMapper.getDeptByPid(deptmentId))){
|
|
||||||
throw ServiceExceptionUtil.exception(AdminErrorCodeEnum.DEPT_EXITS_CHILDREN.getCode());
|
|
||||||
}
|
|
||||||
|
|
||||||
deptmentMapper.deleteById(deptmentId);
|
|
||||||
|
|
||||||
deptmentRoleMapper.deleteByDeptmentId(deptmentId);
|
|
||||||
|
|
||||||
//将改部门下所有员工的DeptmentID设置为0
|
|
||||||
adminMapper.updateDeptByDeptId(deptmentId, 0);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Transactional
|
|
||||||
public Boolean updateDeptment(Integer adminId, DeptmentUpdateDTO deptmentUpdateDTO) {
|
|
||||||
//判断需要更新的部门是否存在
|
|
||||||
if(deptmentMapper.selectById(deptmentUpdateDTO.getId()) == null){
|
|
||||||
throw ServiceExceptionUtil.exception(AdminErrorCodeEnum.DEPT_NOT_EXITS.getCode());
|
|
||||||
}
|
|
||||||
|
|
||||||
//不能选择当前部门作为自己的父级部门
|
|
||||||
if(deptmentUpdateDTO.getId().equals(deptmentUpdateDTO.getPid())){
|
|
||||||
throw ServiceExceptionUtil.exception(AdminErrorCodeEnum.DEPT_PARENT_NOT_LEGAL.getCode());
|
|
||||||
}
|
|
||||||
|
|
||||||
if(deptmentUpdateDTO.getPid()!=null &&
|
|
||||||
!DeptmentConstants.PID_ROOT.equals(deptmentUpdateDTO.getPid())
|
|
||||||
&& deptmentMapper.selectById(deptmentUpdateDTO.getPid())==null){
|
|
||||||
throw ServiceExceptionUtil.exception(AdminErrorCodeEnum.DEPT_PARENT_NOT_EXITS.getCode());
|
|
||||||
}
|
|
||||||
|
|
||||||
DeptmentDO deptmentDO = DeptmentConvert.INSTANCE.convert(deptmentUpdateDTO);
|
|
||||||
deptmentMapper.updateById(deptmentDO);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PageResult<DeptmentBO> getPageRootDeptment(DeptmentPageDTO deptmentPageDTO) {
|
|
||||||
IPage<DeptmentDO> page = deptmentMapper.selectDeptPage(deptmentPageDTO, DeptmentConstants.PID_ROOT);
|
|
||||||
return DeptmentConvert.INSTANCE.convert(page);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<DeptmentBO> getAllDeptments() {
|
|
||||||
List<DeptmentDO> list = deptmentMapper.getDeptByPid(null);
|
|
||||||
return DeptmentConvert.INSTANCE.convert(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<DeptmentBO> getAllNotRootDeptment() {
|
|
||||||
List<DeptmentDO> list = deptmentMapper.getDeptExcudePid(DeptmentConstants.PID_ROOT);
|
|
||||||
return DeptmentConvert.INSTANCE.convert(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,30 +0,0 @@
|
|||||||
package cn.iocoder.mall.system.application.convert;
|
|
||||||
|
|
||||||
import cn.iocoder.common.framework.vo.PageResult;
|
|
||||||
import cn.iocoder.mall.system.api.bo.deptment.DeptmentBO;
|
|
||||||
import cn.iocoder.mall.system.application.vo.deptment.DeptmentVO;
|
|
||||||
import org.mapstruct.Mapper;
|
|
||||||
import org.mapstruct.Mapping;
|
|
||||||
import org.mapstruct.Mappings;
|
|
||||||
import org.mapstruct.factory.Mappers;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Description:
|
|
||||||
*
|
|
||||||
* @author: zhenxianyimeng
|
|
||||||
* @date: 2019-06-22
|
|
||||||
* @time: 00:23
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface DeptmentConvert {
|
|
||||||
|
|
||||||
DeptmentConvert INSTANCE = Mappers.getMapper(DeptmentConvert.class);
|
|
||||||
|
|
||||||
@Mappings({@Mapping(source = "list", target = "list")})
|
|
||||||
PageResult<DeptmentVO> convert(PageResult<DeptmentBO> pageResult);
|
|
||||||
|
|
||||||
@Mappings({})
|
|
||||||
List<DeptmentVO> convert(List<DeptmentBO> list);
|
|
||||||
}
|
|
@ -1,33 +0,0 @@
|
|||||||
package cn.iocoder.mall.system.application.convert;
|
|
||||||
|
|
||||||
import cn.iocoder.common.framework.vo.CommonResult;
|
|
||||||
import cn.iocoder.mall.system.api.bo.resource.ResourceBO;
|
|
||||||
import cn.iocoder.mall.system.application.vo.admin.AdminMenuTreeNodeVO;
|
|
||||||
import cn.iocoder.mall.system.application.vo.resource.ResourceTreeNodeVO;
|
|
||||||
import cn.iocoder.mall.system.application.vo.resource.ResourceVO;
|
|
||||||
import cn.iocoder.mall.system.application.vo.role.RoleResourceTreeNodeVO;
|
|
||||||
import org.mapstruct.Mapper;
|
|
||||||
import org.mapstruct.Mappings;
|
|
||||||
import org.mapstruct.factory.Mappers;
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface ResourceConvert {
|
|
||||||
|
|
||||||
ResourceConvert INSTANCE = Mappers.getMapper(ResourceConvert.class);
|
|
||||||
|
|
||||||
@Mappings({})
|
|
||||||
AdminMenuTreeNodeVO convert(ResourceBO resourceBO);
|
|
||||||
|
|
||||||
@Mappings({})
|
|
||||||
ResourceTreeNodeVO convert2(ResourceBO resourceBO);
|
|
||||||
|
|
||||||
@Mappings({})
|
|
||||||
RoleResourceTreeNodeVO convert4(ResourceBO resourceBO);
|
|
||||||
|
|
||||||
@Mappings({})
|
|
||||||
ResourceVO convert3(ResourceBO resourceBO);
|
|
||||||
|
|
||||||
@Mappings({})
|
|
||||||
CommonResult<ResourceVO> convert3(CommonResult<ResourceBO> resourceBO);
|
|
||||||
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
package cn.iocoder.mall.system.application.convert;
|
|
||||||
|
|
||||||
import org.mapstruct.Mapper;
|
|
||||||
import org.mapstruct.factory.Mappers;
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface RoleConvert {
|
|
||||||
|
|
||||||
RoleConvert INSTANCE = Mappers.getMapper(RoleConvert.class);
|
|
||||||
|
|
||||||
}
|
|
@ -1,22 +0,0 @@
|
|||||||
package cn.iocoder.mall.system.application.vo.deptment;
|
|
||||||
|
|
||||||
import cn.iocoder.mall.system.api.bo.deptment.DeptmentBO;
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Description:
|
|
||||||
*
|
|
||||||
* @author: zhenxianyimeng
|
|
||||||
* @date: 2019-06-15
|
|
||||||
* @time: 16:57
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@ApiModel("部门VO")
|
|
||||||
public class DeptmentVO extends DeptmentBO {
|
|
||||||
@ApiModelProperty("子部门数组")
|
|
||||||
private List<DeptmentVO> children;
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user