diff --git a/system/system-rest/src/main/java/cn/iocoder/mall/system/rest/controller/admin/AdminsAdminController.java b/system/system-rest/src/main/java/cn/iocoder/mall/system/rest/controller/admin/AdminsAdminController.java deleted file mode 100644 index 766c57b15..000000000 --- a/system/system-rest/src/main/java/cn/iocoder/mall/system/rest/controller/admin/AdminsAdminController.java +++ /dev/null @@ -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> roleList(@RequestParam("id") Integer id) { -// // 获得所有角色列表 -// List allRoleList = roleService.getRoleList(); -// // 获得管理员的角色数组 -// Set adminRoleIdSet = CollectionUtil.convertSet(adminService.getRoleList(id), RoleBO::getId); -// // 转换出返回结果 -// List result = AdminConvert.INSTANCE.convert(allRoleList); -// // 设置每个角色是否赋予给改管理员 -// result.forEach(adminRoleVO -> adminRoleVO.setAssigned(adminRoleIdSet.contains(adminRoleVO.getId()))); -// return success(result); -// } - -// @PostMapping("/assign_role") -// @ApiOperation(value = "分配给管理员角色") -// public CommonResult assignRole(AdminAssignRoleDTO adminAssignRoleDTO) { -// return success(adminService.assignAdminRole(AdminSecurityContextHolder.getContext().getAdminId(), adminAssignRoleDTO)); -// } - -} diff --git a/system/system-rest/src/main/java/cn/iocoder/mall/system/rest/controller/authorization/AdminsAuthorizationController.java b/system/system-rest/src/main/java/cn/iocoder/mall/system/rest/controller/authorization/AdminsAuthorizationController.java deleted file mode 100644 index 6a3cb2eaf..000000000 --- a/system/system-rest/src/main/java/cn/iocoder/mall/system/rest/controller/authorization/AdminsAuthorizationController.java +++ /dev/null @@ -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> roleList(@RequestParam("accountId") Integer accountId) { -// // 获得所有角色列表 -// List allRoleList = roleService.getRoleList(); -// // 获得管理员的角色数组 -// Set adminRoleIdSet = CollectionUtil.convertSet(adminService.getRoleList(id), RoleBO::getId); -// // 转换出返回结果 -// List result = AdminConvert.INSTANCE.convert(allRoleList); -// // 设置每个角色是否赋予给改管理员 -// result.forEach(adminRoleVO -> adminRoleVO.setAssigned(adminRoleIdSet.contains(adminRoleVO.getId()))); -// return success(result); -// } -// -// @PostMapping("/assign_role") -// @ApiOperation(value = "分配给管理员角色") -// public CommonResult assignRole(AdminAssignRoleDTO adminAssignRoleDTO) { -// return success(adminService.assignAdminRole(AdminSecurityContextHolder.getContext().getAdminId(), adminAssignRoleDTO)); -// } - - -} diff --git a/system/system-rest/src/main/java/cn/iocoder/mall/system/rest/convert/admin/AdminsAdminConvert.java b/system/system-rest/src/main/java/cn/iocoder/mall/system/rest/convert/admin/AdminsAdminConvert.java deleted file mode 100644 index 7e3fae0fb..000000000 --- a/system/system-rest/src/main/java/cn/iocoder/mall/system/rest/convert/admin/AdminsAdminConvert.java +++ /dev/null @@ -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 convertPage(PageResult bean); - -} diff --git a/system/system-rest/src/main/java/cn/iocoder/mall/system/rest/convert/authorization/AdminsAuthorizationConvert.java b/system/system-rest/src/main/java/cn/iocoder/mall/system/rest/convert/authorization/AdminsAuthorizationConvert.java deleted file mode 100644 index dcc935700..000000000 --- a/system/system-rest/src/main/java/cn/iocoder/mall/system/rest/convert/authorization/AdminsAuthorizationConvert.java +++ /dev/null @@ -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 convertList(List beans); - - default List convertList(List beans, Set roleResourceIds) { - if (beans == null) { - return null; - } - List 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); - -} diff --git a/system/system-rest/src/main/java/cn/iocoder/mall/system/rest/convert/authorization/AdminsResourceConvert.java b/system/system-rest/src/main/java/cn/iocoder/mall/system/rest/convert/authorization/AdminsResourceConvert.java deleted file mode 100644 index 6e6b5939e..000000000 --- a/system/system-rest/src/main/java/cn/iocoder/mall/system/rest/convert/authorization/AdminsResourceConvert.java +++ /dev/null @@ -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 convertList(List beans); - - ResourceAddDTO convert(AdminsResourceAddRequest bean); - - ResourceUpdateDTO convert(AdminsResourceUpdateRequest bean); - -} diff --git a/system/system-rest/src/main/java/cn/iocoder/mall/system/rest/convert/user/UsersUserConvert.java b/system/system-rest/src/main/java/cn/iocoder/mall/system/rest/convert/user/UsersUserConvert.java deleted file mode 100644 index 467568b40..000000000 --- a/system/system-rest/src/main/java/cn/iocoder/mall/system/rest/convert/user/UsersUserConvert.java +++ /dev/null @@ -1,7 +0,0 @@ -package cn.iocoder.mall.system.rest.convert.user; - -import org.mapstruct.Mapper; - -@Mapper -public interface UsersUserConvert { -} diff --git a/system/system-rest/src/main/java/cn/iocoder/mall/system/rest/request/authorization/AdminsAuthorizationAssignRoleResourceRequest.java b/system/system-rest/src/main/java/cn/iocoder/mall/system/rest/request/authorization/AdminsAuthorizationAssignRoleResourceRequest.java deleted file mode 100644 index 7ecfa5714..000000000 --- a/system/system-rest/src/main/java/cn/iocoder/mall/system/rest/request/authorization/AdminsAuthorizationAssignRoleResourceRequest.java +++ /dev/null @@ -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 resourceIds; - -} diff --git a/system/system-rest/src/main/java/cn/iocoder/mall/system/rest/request/authorization/AdminsResourceAddRequest.java b/system/system-rest/src/main/java/cn/iocoder/mall/system/rest/request/authorization/AdminsResourceAddRequest.java deleted file mode 100644 index 0c740e0ea..000000000 --- a/system/system-rest/src/main/java/cn/iocoder/mall/system/rest/request/authorization/AdminsResourceAddRequest.java +++ /dev/null @@ -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; - -} diff --git a/system/system-rest/src/main/java/cn/iocoder/mall/system/rest/request/authorization/AdminsResourceUpdateRequest.java b/system/system-rest/src/main/java/cn/iocoder/mall/system/rest/request/authorization/AdminsResourceUpdateRequest.java deleted file mode 100644 index e33af44a8..000000000 --- a/system/system-rest/src/main/java/cn/iocoder/mall/system/rest/request/authorization/AdminsResourceUpdateRequest.java +++ /dev/null @@ -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; - -} diff --git a/system/system-rest/src/main/java/cn/iocoder/mall/system/rest/request/authorization/AdminsRoleAddRequest.java b/system/system-rest/src/main/java/cn/iocoder/mall/system/rest/request/authorization/AdminsRoleAddRequest.java deleted file mode 100644 index 5230b78a2..000000000 --- a/system/system-rest/src/main/java/cn/iocoder/mall/system/rest/request/authorization/AdminsRoleAddRequest.java +++ /dev/null @@ -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; - -} diff --git a/system/system-rest/src/main/java/cn/iocoder/mall/system/rest/request/authorization/AdminsRolePageRequest.java b/system/system-rest/src/main/java/cn/iocoder/mall/system/rest/request/authorization/AdminsRolePageRequest.java deleted file mode 100644 index 34a34719a..000000000 --- a/system/system-rest/src/main/java/cn/iocoder/mall/system/rest/request/authorization/AdminsRolePageRequest.java +++ /dev/null @@ -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; - - -} diff --git a/system/system-rest/src/main/java/cn/iocoder/mall/system/rest/request/authorization/AdminsRoleUpdateRequest.java b/system/system-rest/src/main/java/cn/iocoder/mall/system/rest/request/authorization/AdminsRoleUpdateRequest.java deleted file mode 100644 index efc54581a..000000000 --- a/system/system-rest/src/main/java/cn/iocoder/mall/system/rest/request/authorization/AdminsRoleUpdateRequest.java +++ /dev/null @@ -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; - -} diff --git a/system/system-rpc-api/src/main/java/cn/iocoder/mall/system/rpc/package-info.java b/system/system-rpc-api/src/main/java/cn/iocoder/mall/system/rpc/package-info.java deleted file mode 100644 index 92296b181..000000000 --- a/system/system-rpc-api/src/main/java/cn/iocoder/mall/system/rpc/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -/** - * 提供 system 服务的 RPC 接口的定义,提供内部调用 - */ -package cn.iocoder.mall.system.rpc; diff --git a/system/system-rpc/src/main/java/cn/iocoder/mall/system/rpc/convert/admn/AdminCovert.java b/system/system-rpc/src/main/java/cn/iocoder/mall/system/rpc/convert/admn/AdminCovert.java deleted file mode 100644 index b89905ead..000000000 --- a/system/system-rpc/src/main/java/cn/iocoder/mall/system/rpc/convert/admn/AdminCovert.java +++ /dev/null @@ -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); - -} diff --git a/system/system-rpc/src/main/java/cn/iocoder/mall/system/rpc/convert/authorization/AuthorizationConvert.java b/system/system-rpc/src/main/java/cn/iocoder/mall/system/rpc/convert/authorization/AuthorizationConvert.java deleted file mode 100644 index 4dcd729df..000000000 --- a/system/system-rpc/src/main/java/cn/iocoder/mall/system/rpc/convert/authorization/AuthorizationConvert.java +++ /dev/null @@ -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); - -} diff --git a/system/system-rpc/src/main/java/cn/iocoder/mall/system/rpc/convert/oauth2/OAuth2Convert.java b/system/system-rpc/src/main/java/cn/iocoder/mall/system/rpc/convert/oauth2/OAuth2Convert.java deleted file mode 100644 index 824281f1a..000000000 --- a/system/system-rpc/src/main/java/cn/iocoder/mall/system/rpc/convert/oauth2/OAuth2Convert.java +++ /dev/null @@ -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); - -} diff --git a/system/system-rpc/src/main/java/cn/iocoder/mall/system/rpc/rpc/authorization/AuthorizationRPCImpl.java b/system/system-rpc/src/main/java/cn/iocoder/mall/system/rpc/rpc/authorization/AuthorizationRPCImpl.java deleted file mode 100644 index afedb4ca2..000000000 --- a/system/system-rpc/src/main/java/cn/iocoder/mall/system/rpc/rpc/authorization/AuthorizationRPCImpl.java +++ /dev/null @@ -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 checkPermissions(AuthorizationCheckPermissionsRequest checkPermissionsRequest) { - AuthorizationCheckPermissionsDTO checkPermissionsDTO = AuthorizationConvert.INSTANCE.convert(checkPermissionsRequest); - authorizationService.checkPermissions(checkPermissionsDTO); - return CommonResult.success(true); - } - -} diff --git a/system/system-service-api/src/main/java/cn/iocoder/mall/system/api/DeptmentService.java b/system/system-service-api/src/main/java/cn/iocoder/mall/system/api/DeptmentService.java deleted file mode 100644 index 8fc87aa1e..000000000 --- a/system/system-service-api/src/main/java/cn/iocoder/mall/system/api/DeptmentService.java +++ /dev/null @@ -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 getPageRootDeptment(DeptmentPageDTO deptmentPageDTO); - - List getAllDeptments(); - - List getAllNotRootDeptment(); -} diff --git a/system/system-service-api/src/main/java/cn/iocoder/mall/system/api/bo/deptment/DeptmentBO.java b/system/system-service-api/src/main/java/cn/iocoder/mall/system/api/bo/deptment/DeptmentBO.java deleted file mode 100644 index d5258edad..000000000 --- a/system/system-service-api/src/main/java/cn/iocoder/mall/system/api/bo/deptment/DeptmentBO.java +++ /dev/null @@ -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; - - -} diff --git a/system/system-service-api/src/main/java/cn/iocoder/mall/system/api/dto/depetment/DeptmentAddDTO.java b/system/system-service-api/src/main/java/cn/iocoder/mall/system/api/dto/depetment/DeptmentAddDTO.java deleted file mode 100644 index 611059bec..000000000 --- a/system/system-service-api/src/main/java/cn/iocoder/mall/system/api/dto/depetment/DeptmentAddDTO.java +++ /dev/null @@ -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; - - -} diff --git a/system/system-service-api/src/main/java/cn/iocoder/mall/system/api/dto/depetment/DeptmentPageDTO.java b/system/system-service-api/src/main/java/cn/iocoder/mall/system/api/dto/depetment/DeptmentPageDTO.java deleted file mode 100644 index df3f48c1e..000000000 --- a/system/system-service-api/src/main/java/cn/iocoder/mall/system/api/dto/depetment/DeptmentPageDTO.java +++ /dev/null @@ -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; -} diff --git a/system/system-service-api/src/main/java/cn/iocoder/mall/system/api/dto/depetment/DeptmentUpdateDTO.java b/system/system-service-api/src/main/java/cn/iocoder/mall/system/api/dto/depetment/DeptmentUpdateDTO.java deleted file mode 100644 index b094fb64d..000000000 --- a/system/system-service-api/src/main/java/cn/iocoder/mall/system/api/dto/depetment/DeptmentUpdateDTO.java +++ /dev/null @@ -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; - -} diff --git a/system/system-service-impl/src/main/java/cn/iocoder/mall/admin/dao/DeptmentMapper.java b/system/system-service-impl/src/main/java/cn/iocoder/mall/admin/dao/DeptmentMapper.java deleted file mode 100644 index 8a783ef74..000000000 --- a/system/system-service-impl/src/main/java/cn/iocoder/mall/admin/dao/DeptmentMapper.java +++ /dev/null @@ -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 { - - default DeptmentDO findDeptByNameAndPid(String name, Integer pid){ - return selectOne(new QueryWrapper() - .eq("name", name) - .eq("pid", pid) - .eq("deleted", false) - ); - } - - default IPage selectDeptPage(DeptmentPageDTO deptmentPageDTO, Integer pid){ - return selectPage(new Page<>(deptmentPageDTO.getPageNo(), deptmentPageDTO.getPageSize()), - new QueryWrapperX() - .likeIfPresent("name", deptmentPageDTO.getName()) - .eqIfPresent("pid", pid) - .eq("deleted", false)); - - } - - default List getDeptByPid(Integer pid){ - return selectList(new QueryWrapperX() - .eqIfPresent("pid", pid) - .eq("deleted", false)); - } - - default List getDeptExcudePid(Integer pid){ - return selectList(new QueryWrapper() - .ne("pid",pid) - .eq("deleted",false)); - } -} diff --git a/system/system-service-impl/src/main/java/cn/iocoder/mall/admin/dao/DeptmentRoleMapper.java b/system/system-service-impl/src/main/java/cn/iocoder/mall/admin/dao/DeptmentRoleMapper.java deleted file mode 100644 index d02e72311..000000000 --- a/system/system-service-impl/src/main/java/cn/iocoder/mall/admin/dao/DeptmentRoleMapper.java +++ /dev/null @@ -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 { - - default int deleteByDeptmentId(Integer deptmentId){ - return delete(new QueryWrapper().eq("deptment_id", deptmentId)); - } - - default int deleteByRoleId(Integer roleId){ - return delete(new QueryWrapper().eq("role_id", roleId)); - } - -} diff --git a/system/system-service-impl/src/main/java/cn/iocoder/mall/admin/service/DeptmentServiceImpl.java b/system/system-service-impl/src/main/java/cn/iocoder/mall/admin/service/DeptmentServiceImpl.java deleted file mode 100644 index f1050c5ce..000000000 --- a/system/system-service-impl/src/main/java/cn/iocoder/mall/admin/service/DeptmentServiceImpl.java +++ /dev/null @@ -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 getPageRootDeptment(DeptmentPageDTO deptmentPageDTO) { - IPage page = deptmentMapper.selectDeptPage(deptmentPageDTO, DeptmentConstants.PID_ROOT); - return DeptmentConvert.INSTANCE.convert(page); - } - - @Override - public List getAllDeptments() { - List list = deptmentMapper.getDeptByPid(null); - return DeptmentConvert.INSTANCE.convert(list); - } - - @Override - public List getAllNotRootDeptment() { - List list = deptmentMapper.getDeptExcudePid(DeptmentConstants.PID_ROOT); - return DeptmentConvert.INSTANCE.convert(list); - } - -} diff --git a/system/system-start/src/main/java/cn/iocoder/mall/system/application/convert/DeptmentConvert.java b/system/system-start/src/main/java/cn/iocoder/mall/system/application/convert/DeptmentConvert.java deleted file mode 100644 index cf5553d4a..000000000 --- a/system/system-start/src/main/java/cn/iocoder/mall/system/application/convert/DeptmentConvert.java +++ /dev/null @@ -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 convert(PageResult pageResult); - - @Mappings({}) - List convert(List list); -} diff --git a/system/system-start/src/main/java/cn/iocoder/mall/system/application/convert/ResourceConvert.java b/system/system-start/src/main/java/cn/iocoder/mall/system/application/convert/ResourceConvert.java deleted file mode 100644 index db70dd56f..000000000 --- a/system/system-start/src/main/java/cn/iocoder/mall/system/application/convert/ResourceConvert.java +++ /dev/null @@ -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 convert3(CommonResult resourceBO); - -} diff --git a/system/system-start/src/main/java/cn/iocoder/mall/system/application/convert/RoleConvert.java b/system/system-start/src/main/java/cn/iocoder/mall/system/application/convert/RoleConvert.java deleted file mode 100644 index 787134556..000000000 --- a/system/system-start/src/main/java/cn/iocoder/mall/system/application/convert/RoleConvert.java +++ /dev/null @@ -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); - -} diff --git a/system/system-start/src/main/java/cn/iocoder/mall/system/application/vo/deptment/DeptmentVO.java b/system/system-start/src/main/java/cn/iocoder/mall/system/application/vo/deptment/DeptmentVO.java deleted file mode 100644 index 03878376b..000000000 --- a/system/system-start/src/main/java/cn/iocoder/mall/system/application/vo/deptment/DeptmentVO.java +++ /dev/null @@ -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 children; -}