diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/constant/PermissionConstants.java b/eiam-common/src/main/java/cn/topiam/employee/common/constant/PermissionConstants.java new file mode 100644 index 00000000..2db4880b --- /dev/null +++ b/eiam-common/src/main/java/cn/topiam/employee/common/constant/PermissionConstants.java @@ -0,0 +1,27 @@ +package cn.topiam.employee.common.constant; + +import static cn.topiam.employee.support.constant.EiamConstants.COLON; +import static cn.topiam.employee.support.constant.EiamConstants.V1_API_PATH; + +/** + * + * @author SanLi + * Created by qinggang.zuo@gmail.com / 2689170096@qq.com on 2023/9/18 14:35 + */ +public class PermissionConstants { + + /** + * 权限管理API路径 + */ + public final static String PERMISSION_PATH = V1_API_PATH + "/permission"; + + /** + * 组名称 + */ + public static final String PERMISSION_GROUP_NAME = "应用管理"; + + /** + * 权限管理配置缓存前缀 + */ + public static final String PERMISSION_CACHE_NAME_PREFIX = "permission" + COLON; +} diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppPermissionActionEntity.java b/eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/PermissionActionEntity.java similarity index 92% rename from eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppPermissionActionEntity.java rename to eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/PermissionActionEntity.java index 7a224a82..8655e58b 100644 --- a/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppPermissionActionEntity.java +++ b/eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/PermissionActionEntity.java @@ -15,7 +15,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.common.entity.app; +package cn.topiam.employee.common.entity.permission; import java.io.Serial; @@ -48,7 +48,7 @@ import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOF @Table(name = "app_permission_action") @SQLDelete(sql = "update app_permission_action set " + SOFT_DELETE_SET + " where id_ = ?") @Where(clause = SOFT_DELETE_WHERE) -public class AppPermissionActionEntity extends LogicDeleteEntity { +public class PermissionActionEntity extends LogicDeleteEntity { @Serial private static final long serialVersionUID = -3954680915360748087L; @@ -75,5 +75,5 @@ public class AppPermissionActionEntity extends LogicDeleteEntity { */ @ManyToOne @JoinColumn(name = "resource_id") - private AppPermissionResourceEntity resource; + private PermissionResourceEntity resource; } diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppPermissionPolicyEntity.java b/eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/PermissionPolicyEntity.java similarity index 95% rename from eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppPermissionPolicyEntity.java rename to eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/PermissionPolicyEntity.java index 42ed8177..8ca2d8f8 100644 --- a/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppPermissionPolicyEntity.java +++ b/eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/PermissionPolicyEntity.java @@ -15,7 +15,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.common.entity.app; +package cn.topiam.employee.common.entity.permission; import org.hibernate.annotations.SQLDelete; import org.hibernate.annotations.Where; @@ -50,7 +50,7 @@ import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOF @Table(name = "app_permission_policy") @SQLDelete(sql = "update app_permission_policy set " + SOFT_DELETE_SET + " where id_ = ?") @Where(clause = SOFT_DELETE_WHERE) -public class AppPermissionPolicyEntity extends LogicDeleteEntity { +public class PermissionPolicyEntity extends LogicDeleteEntity { /** * 应用id diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppPermissionResourceEntity.java b/eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/PermissionResourceEntity.java similarity index 93% rename from eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppPermissionResourceEntity.java rename to eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/PermissionResourceEntity.java index 888891ed..99fbf8a3 100644 --- a/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppPermissionResourceEntity.java +++ b/eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/PermissionResourceEntity.java @@ -15,7 +15,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.common.entity.app; +package cn.topiam.employee.common.entity.permission; import java.io.Serial; import java.util.List; @@ -52,7 +52,7 @@ import static jakarta.persistence.FetchType.LAZY; @Table(name = "app_permission_resource") @SQLDelete(sql = "update app_permission_resource set " + SOFT_DELETE_SET + " where id_ = ?") @Where(clause = SOFT_DELETE_WHERE) -public class AppPermissionResourceEntity extends LogicDeleteEntity { +public class PermissionResourceEntity extends LogicDeleteEntity { @Serial private static final long serialVersionUID = 7342074686605139968L; @@ -93,5 +93,5 @@ public class AppPermissionResourceEntity extends LogicDeleteEntity { @ToString.Exclude @OneToMany(mappedBy = "resource", fetch = LAZY, cascade = { CascadeType.PERSIST, CascadeType.REMOVE }) - private List actions; + private List actions; } diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppPermissionRoleEntity.java b/eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/PermissionRoleEntity.java similarity index 94% rename from eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppPermissionRoleEntity.java rename to eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/PermissionRoleEntity.java index 0c307428..5e3055ae 100644 --- a/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/AppPermissionRoleEntity.java +++ b/eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/PermissionRoleEntity.java @@ -15,7 +15,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.common.entity.app; +package cn.topiam.employee.common.entity.permission; import java.io.Serial; @@ -51,7 +51,7 @@ import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOF @Table(name = "app_permission_role") @SQLDelete(sql = "update app_permission_role set " + SOFT_DELETE_SET + " where id_ = ?") @Where(clause = SOFT_DELETE_WHERE) -public class AppPermissionRoleEntity extends LogicDeleteEntity { +public class PermissionRoleEntity extends LogicDeleteEntity { @Serial private static final long serialVersionUID = -7761332532995424593L; diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/po/AppPermissionPolicyPO.java b/eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/po/PermissionPolicyPO.java similarity index 95% rename from eiam-common/src/main/java/cn/topiam/employee/common/entity/app/po/AppPermissionPolicyPO.java rename to eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/po/PermissionPolicyPO.java index 48fdd6d4..662d7991 100644 --- a/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/po/AppPermissionPolicyPO.java +++ b/eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/po/PermissionPolicyPO.java @@ -15,7 +15,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.common.entity.app.po; +package cn.topiam.employee.common.entity.permission.po; import java.io.Serial; import java.io.Serializable; @@ -38,7 +38,7 @@ import io.swagger.v3.oas.annotations.media.Schema; @Data @Accessors(chain = true) @Schema(description = "分页查询策略响应") -public class AppPermissionPolicyPO implements Serializable { +public class PermissionPolicyPO implements Serializable { @Serial private static final long serialVersionUID = 3320953184046791392L; diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/impl/AppPermissionPolicyRepositoryCustomizedImpl.java b/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/impl/AppPermissionPolicyRepositoryCustomizedImpl.java index 3f7c883f..fcdd0f8e 100644 --- a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/impl/AppPermissionPolicyRepositoryCustomizedImpl.java +++ b/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/impl/AppPermissionPolicyRepositoryCustomizedImpl.java @@ -19,6 +19,7 @@ package cn.topiam.employee.common.repository.app.impl; import java.util.List; +import cn.topiam.employee.common.entity.permission.po.PermissionPolicyPO; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageImpl; import org.springframework.data.domain.Pageable; @@ -28,10 +29,9 @@ import org.springframework.util.ObjectUtils; import com.google.common.collect.Lists; -import cn.topiam.employee.common.entity.app.po.AppPermissionPolicyPO; import cn.topiam.employee.common.entity.app.query.AppPolicyQuery; -import cn.topiam.employee.common.repository.app.AppPermissionPolicyRepositoryCustomized; import cn.topiam.employee.common.repository.app.impl.mapper.AppPermissionPolicyPoMapper; +import cn.topiam.employee.common.repository.permission.AppPermissionPolicyRepositoryCustomized; import lombok.RequiredArgsConstructor; @@ -49,7 +49,7 @@ public class AppPermissionPolicyRepositoryCustomizedImpl implements } @Override - public Page findPage(AppPolicyQuery query, Pageable pageable) { + public Page findPage(AppPolicyQuery query, Pageable pageable) { //查询条件 //@formatter:off // 所属应用 @@ -111,7 +111,7 @@ public class AppPermissionPolicyRepositoryCustomizedImpl implements .append(" FROM app_permission_policy policy ").append(subjectJoin).append(objectJoin); // @formatter:off - List list = jdbcTemplate + List list = jdbcTemplate .query( selectSql.append(" LIMIT ").append(pageable.getPageNumber() * pageable.getPageSize()) .append(",").append(pageable.getPageSize()).toString(), diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/impl/mapper/AppPermissionPolicyPoMapper.java b/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/impl/mapper/AppPermissionPolicyPoMapper.java index cffe006f..54863c41 100644 --- a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/impl/mapper/AppPermissionPolicyPoMapper.java +++ b/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/impl/mapper/AppPermissionPolicyPoMapper.java @@ -20,9 +20,9 @@ package cn.topiam.employee.common.repository.app.impl.mapper; import java.sql.ResultSet; import java.sql.SQLException; +import cn.topiam.employee.common.entity.permission.po.PermissionPolicyPO; import org.springframework.jdbc.core.RowMapper; -import cn.topiam.employee.common.entity.app.po.AppPermissionPolicyPO; import cn.topiam.employee.common.enums.app.AppPolicyEffect; import cn.topiam.employee.common.enums.app.AppPolicyObjectType; import cn.topiam.employee.common.enums.app.AppPolicySubjectType; @@ -31,7 +31,7 @@ import cn.topiam.employee.common.enums.app.AppPolicySubjectType; * @author TopIAM * Created by support@topiam.cn on 2022/2/13 23:25 */ -public class AppPermissionPolicyPoMapper implements RowMapper { +public class AppPermissionPolicyPoMapper implements RowMapper { /** * Implementations must implement this method to map each row of data @@ -46,18 +46,18 @@ public class AppPermissionPolicyPoMapper implements RowMapper. */ -package cn.topiam.employee.common.repository.app; +package cn.topiam.employee.common.repository.permission; import java.util.List; +import cn.topiam.employee.common.entity.permission.PermissionActionEntity; +import cn.topiam.employee.common.entity.permission.PermissionResourceEntity; import org.springframework.data.querydsl.QuerydslPredicateExecutor; import org.springframework.stereotype.Repository; -import cn.topiam.employee.common.entity.app.AppPermissionActionEntity; -import cn.topiam.employee.common.entity.app.AppPermissionResourceEntity; import cn.topiam.employee.support.repository.LogicDeleteRepository; /** @@ -32,13 +32,13 @@ import cn.topiam.employee.support.repository.LogicDeleteRepository; */ @Repository public interface AppPermissionActionRepository extends - LogicDeleteRepository, - QuerydslPredicateExecutor { + LogicDeleteRepository, + QuerydslPredicateExecutor { /** * findAllByResource * - * @param resource {@link AppPermissionResourceEntity} + * @param resource {@link PermissionResourceEntity} * @return {@link List} */ - List findAllByResource(AppPermissionResourceEntity resource); + List findAllByResource(PermissionResourceEntity resource); } diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppPermissionPolicyRepository.java b/eiam-common/src/main/java/cn/topiam/employee/common/repository/permission/AppPermissionPolicyRepository.java similarity index 91% rename from eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppPermissionPolicyRepository.java rename to eiam-common/src/main/java/cn/topiam/employee/common/repository/permission/AppPermissionPolicyRepository.java index 22720693..4bea3303 100644 --- a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppPermissionPolicyRepository.java +++ b/eiam-common/src/main/java/cn/topiam/employee/common/repository/permission/AppPermissionPolicyRepository.java @@ -15,11 +15,12 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.common.repository.app; +package cn.topiam.employee.common.repository.permission; import java.io.Serializable; import java.util.Collection; +import cn.topiam.employee.common.entity.permission.PermissionPolicyEntity; import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; import org.springframework.data.querydsl.QuerydslPredicateExecutor; @@ -27,7 +28,6 @@ import org.springframework.data.repository.query.Param; import org.springframework.stereotype.Repository; import org.springframework.transaction.annotation.Transactional; -import cn.topiam.employee.common.entity.app.AppPermissionPolicyEntity; import cn.topiam.employee.support.repository.LogicDeleteRepository; import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_SET; @@ -37,8 +37,8 @@ import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOF */ @Repository public interface AppPermissionPolicyRepository extends AppPermissionPolicyRepositoryCustomized, - LogicDeleteRepository, - QuerydslPredicateExecutor { + LogicDeleteRepository, + QuerydslPredicateExecutor { /** * 按主体 ID 删除所有 * @@ -81,6 +81,6 @@ public interface AppPermissionPolicyRepository extends AppPermissionPolicyReposi */ @Transactional(rollbackFor = Exception.class) @Modifying - @Query(value = "UPDATE AppPermissionResourceEntity set enabled =:status WHERE id =:id") + @Query(value = "UPDATE PermissionResourceEntity set enabled =:status WHERE id =:id") Integer updateStatus(@Param(value = "id") Long id, @Param(value = "status") Boolean status); } diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppPermissionPolicyRepositoryCustomized.java b/eiam-common/src/main/java/cn/topiam/employee/common/repository/permission/AppPermissionPolicyRepositoryCustomized.java similarity index 83% rename from eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppPermissionPolicyRepositoryCustomized.java rename to eiam-common/src/main/java/cn/topiam/employee/common/repository/permission/AppPermissionPolicyRepositoryCustomized.java index c1b05ffc..c65c1ee0 100644 --- a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppPermissionPolicyRepositoryCustomized.java +++ b/eiam-common/src/main/java/cn/topiam/employee/common/repository/permission/AppPermissionPolicyRepositoryCustomized.java @@ -15,12 +15,12 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.common.repository.app; +package cn.topiam.employee.common.repository.permission; +import cn.topiam.employee.common.entity.permission.po.PermissionPolicyPO; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; -import cn.topiam.employee.common.entity.app.po.AppPermissionPolicyPO; import cn.topiam.employee.common.entity.app.query.AppPolicyQuery; /** @@ -33,7 +33,7 @@ public interface AppPermissionPolicyRepositoryCustomized { * * @param query {@link AppPolicyQuery} * @param request {@link Pageable} - * @return {@link AppPermissionPolicyPO} + * @return {@link PermissionPolicyPO} */ - Page findPage(AppPolicyQuery query, Pageable request); + Page findPage(AppPolicyQuery query, Pageable request); } diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppPermissionResourceRepository.java b/eiam-common/src/main/java/cn/topiam/employee/common/repository/permission/AppPermissionResourceRepository.java similarity index 82% rename from eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppPermissionResourceRepository.java rename to eiam-common/src/main/java/cn/topiam/employee/common/repository/permission/AppPermissionResourceRepository.java index 39e9eeed..169e5293 100644 --- a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppPermissionResourceRepository.java +++ b/eiam-common/src/main/java/cn/topiam/employee/common/repository/permission/AppPermissionResourceRepository.java @@ -15,17 +15,17 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.common.repository.app; +package cn.topiam.employee.common.repository.permission; import java.util.Optional; +import cn.topiam.employee.common.entity.permission.PermissionResourceEntity; import org.jetbrains.annotations.NotNull; import org.springframework.data.jpa.repository.Query; import org.springframework.data.querydsl.QuerydslPredicateExecutor; import org.springframework.data.repository.query.Param; import org.springframework.stereotype.Repository; -import cn.topiam.employee.common.entity.app.AppPermissionResourceEntity; import cn.topiam.employee.support.repository.LogicDeleteRepository; /** @@ -38,16 +38,16 @@ import cn.topiam.employee.support.repository.LogicDeleteRepository; */ @Repository public interface AppPermissionResourceRepository extends - LogicDeleteRepository, - QuerydslPredicateExecutor { + LogicDeleteRepository, + QuerydslPredicateExecutor { /** * findByIdContainsDeleted * * @param id must not be {@literal null}. - * @return {@link AppPermissionResourceEntity} + * @return {@link PermissionResourceEntity} */ @NotNull @Query(value = "SELECT * FROM app_permission_resource WHERE id_ = :id", nativeQuery = true) - Optional findByIdContainsDeleted(@NotNull @Param(value = "id") Long id); + Optional findByIdContainsDeleted(@NotNull @Param(value = "id") Long id); } diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppPermissionRoleRepository.java b/eiam-common/src/main/java/cn/topiam/employee/common/repository/permission/AppPermissionRoleRepository.java similarity index 87% rename from eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppPermissionRoleRepository.java rename to eiam-common/src/main/java/cn/topiam/employee/common/repository/permission/AppPermissionRoleRepository.java index 583e3135..c545d62d 100644 --- a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppPermissionRoleRepository.java +++ b/eiam-common/src/main/java/cn/topiam/employee/common/repository/permission/AppPermissionRoleRepository.java @@ -15,10 +15,11 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.common.repository.app; +package cn.topiam.employee.common.repository.permission; import java.util.Optional; +import cn.topiam.employee.common.entity.permission.PermissionRoleEntity; import org.jetbrains.annotations.NotNull; import org.springframework.cache.annotation.Cacheable; import org.springframework.data.jpa.repository.Modifying; @@ -28,7 +29,6 @@ import org.springframework.data.repository.query.Param; import org.springframework.stereotype.Repository; import org.springframework.transaction.annotation.Transactional; -import cn.topiam.employee.common.entity.app.AppPermissionRoleEntity; import cn.topiam.employee.support.repository.LogicDeleteRepository; /** @@ -41,8 +41,8 @@ import cn.topiam.employee.support.repository.LogicDeleteRepository; */ @Repository public interface AppPermissionRoleRepository extends - LogicDeleteRepository, - QuerydslPredicateExecutor { + LogicDeleteRepository, + QuerydslPredicateExecutor { /** * 更新角色状态 * @@ -58,10 +58,10 @@ public interface AppPermissionRoleRepository extends * findByIdContainsDeleted * * @param id must not be {@literal null}. - * @return {@link AppPermissionRoleEntity} + * @return {@link PermissionRoleEntity} */ @NotNull @Cacheable @Query(value = "SELECT * FROM app_permission_role WHERE id_ = :id", nativeQuery = true) - Optional findByIdContainsDeleted(@NotNull @Param(value = "id") Long id); + Optional findByIdContainsDeleted(@NotNull @Param(value = "id") Long id); } diff --git a/eiam-console/src/main/console-fe/src/pages/permission/Role/index.tsx b/eiam-console/src/main/console-fe/src/pages/permission/Role/index.tsx new file mode 100644 index 00000000..ca28800c --- /dev/null +++ b/eiam-console/src/main/console-fe/src/pages/permission/Role/index.tsx @@ -0,0 +1,22 @@ +/* + * eiam-console - Employee Identity and Access Management + * Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +import Role from './Role'; + +export default () => { + return ; +}; diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/controller/app/AppPermissionActionController.java b/eiam-console/src/main/java/cn/topiam/employee/console/controller/permission/PermissionActionController.java similarity index 65% rename from eiam-console/src/main/java/cn/topiam/employee/console/controller/app/AppPermissionActionController.java rename to eiam-console/src/main/java/cn/topiam/employee/console/controller/permission/PermissionActionController.java index 85c36945..93c6de53 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/controller/app/AppPermissionActionController.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/controller/permission/PermissionActionController.java @@ -15,10 +15,11 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.console.controller.app; +package cn.topiam.employee.console.controller.permission; import java.util.List; +import cn.topiam.employee.console.pojo.result.permission.PermissionActionListResult; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.MediaType; @@ -28,16 +29,16 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import cn.topiam.employee.console.pojo.query.app.AppPermissionActionListQuery; -import cn.topiam.employee.console.pojo.result.app.AppPermissionActionListResult; -import cn.topiam.employee.console.service.app.AppPermissionActionService; +import cn.topiam.employee.console.pojo.query.permission.PermissionActionListQuery; +import cn.topiam.employee.console.service.permission.PermissionActionService; import cn.topiam.employee.support.result.ApiRestResult; import lombok.RequiredArgsConstructor; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; -import static cn.topiam.employee.common.constant.AppConstants.APP_PATH; + +import static cn.topiam.employee.common.constant.PermissionConstants.PERMISSION_PATH; /** * 应用权限-权限 @@ -48,29 +49,29 @@ import static cn.topiam.employee.common.constant.AppConstants.APP_PATH; @RequiredArgsConstructor @Validated @Tag(name = "应用权限-权限项") -@RequestMapping(value = APP_PATH - + "/permission/action", produces = MediaType.APPLICATION_JSON_VALUE) +@RequestMapping(value = PERMISSION_PATH + + "/action", produces = MediaType.APPLICATION_JSON_VALUE) @RestController -public class AppPermissionActionController { +public class PermissionActionController { /** * logger */ - private final Logger logger = LoggerFactory.getLogger(AppPermissionActionController.class); + private final Logger logger = LoggerFactory.getLogger(PermissionActionController.class); /** * 获取所有权限 * - * @return {@link AppPermissionActionListResult} + * @return {@link PermissionActionListResult} */ @Operation(summary = "获取权限项列表") @GetMapping(value = "/list") @PreAuthorize(value = "authenticated and @sae.hasAuthority(T(cn.topiam.employee.support.security.userdetails.UserType).ADMIN)") - public ApiRestResult> getPermissionActionList(@Validated AppPermissionActionListQuery query) { - List list = appPermissionActionService + public ApiRestResult> getPermissionActionList(@Validated PermissionActionListQuery query) { + List list = permissionActionService .getPermissionActionList(query); - return ApiRestResult.> builder().result(list).build(); + return ApiRestResult.> builder().result(list).build(); } - private final AppPermissionActionService appPermissionActionService; + private final PermissionActionService permissionActionService; } diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/controller/app/AppPermissionPolicyController.java b/eiam-console/src/main/java/cn/topiam/employee/console/controller/permission/PermissionPolicyController.java similarity index 70% rename from eiam-console/src/main/java/cn/topiam/employee/console/controller/app/AppPermissionPolicyController.java rename to eiam-console/src/main/java/cn/topiam/employee/console/controller/permission/PermissionPolicyController.java index 26280923..34af7aeb 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/controller/app/AppPermissionPolicyController.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/controller/permission/PermissionPolicyController.java @@ -15,22 +15,22 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.console.controller.app; +package cn.topiam.employee.console.controller.permission; +import cn.topiam.employee.console.pojo.result.permission.PermissionPolicyListResult; +import cn.topiam.employee.console.pojo.result.permission.PermissionRoleListResult; +import cn.topiam.employee.console.pojo.update.permission.PermissionPolicyUpdateParam; import org.springframework.http.MediaType; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import cn.topiam.employee.common.entity.app.query.AppPolicyQuery; -import cn.topiam.employee.console.pojo.result.app.AppPermissionPolicyGetResult; -import cn.topiam.employee.console.pojo.result.app.AppPermissionPolicyListResult; -import cn.topiam.employee.console.pojo.result.app.AppPermissionRoleListResult; -import cn.topiam.employee.console.pojo.save.app.AppPermissionPolicyCreateParam; -import cn.topiam.employee.console.pojo.save.app.AppPermissionRoleCreateParam; -import cn.topiam.employee.console.pojo.update.app.AppPermissionPolicyUpdateParam; -import cn.topiam.employee.console.pojo.update.app.PermissionRoleUpdateParam; -import cn.topiam.employee.console.service.app.AppPermissionPolicyService; +import cn.topiam.employee.console.pojo.result.permission.PermissionPolicyGetResult; +import cn.topiam.employee.console.pojo.save.permission.PermissionPolicyCreateParam; +import cn.topiam.employee.console.pojo.save.permission.PermissionRoleCreateParam; +import cn.topiam.employee.console.pojo.update.permission.PermissionRoleUpdateParam; +import cn.topiam.employee.console.service.permission.PermissionPolicyService; import cn.topiam.employee.support.lock.Lock; import cn.topiam.employee.support.preview.Preview; import cn.topiam.employee.support.repository.page.domain.Page; @@ -41,7 +41,8 @@ import lombok.RequiredArgsConstructor; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; -import static cn.topiam.employee.common.constant.AppConstants.APP_PATH; + +import static cn.topiam.employee.common.constant.PermissionConstants.PERMISSION_PATH; /** * 应用权限 @@ -51,32 +52,32 @@ import static cn.topiam.employee.common.constant.AppConstants.APP_PATH; */ @Validated @Tag(name = "应用权限-授权策略") -@RequestMapping(value = APP_PATH - + "/permission/policy", produces = MediaType.APPLICATION_JSON_VALUE) +@RequestMapping(value = PERMISSION_PATH + + "/policy", produces = MediaType.APPLICATION_JSON_VALUE) @RestController @RequiredArgsConstructor -public class AppPermissionPolicyController { +public class PermissionPolicyController { /** * 获取所有策略(分页) * * @param page {@link PageModel} - * @return {@link AppPermissionRoleListResult} + * @return {@link PermissionRoleListResult} */ @Operation(summary = "获取策略列表") @GetMapping(value = "/list") @PreAuthorize(value = "authenticated and @sae.hasAuthority(T(cn.topiam.employee.support.security.userdetails.UserType).ADMIN)") - public ApiRestResult> getPermissionPolicyList(PageModel page, - @Validated AppPolicyQuery query) { - Page result = permissionPolicyService + public ApiRestResult> getPermissionPolicyList(PageModel page, + @Validated AppPolicyQuery query) { + Page result = permissionPolicyService .getPermissionPolicyList(page, query); - return ApiRestResult.> builder().result(result).build(); + return ApiRestResult.> builder().result(result).build(); } /** * 创建资源 * - * @param param {@link AppPermissionRoleCreateParam} + * @param param {@link PermissionRoleCreateParam} * @return {@link Boolean} */ @Lock @@ -84,7 +85,7 @@ public class AppPermissionPolicyController { @Operation(summary = "创建资源") @PostMapping(value = "/create") @PreAuthorize(value = "authenticated and @sae.hasAuthority(T(cn.topiam.employee.support.security.userdetails.UserType).ADMIN)") - public ApiRestResult createPolicy(@Validated @RequestBody AppPermissionPolicyCreateParam param) { + public ApiRestResult createPolicy(@Validated @RequestBody PermissionPolicyCreateParam param) { return ApiRestResult. builder() .result(permissionPolicyService.createPermissionPolicy(param)).build(); } @@ -100,7 +101,7 @@ public class AppPermissionPolicyController { @Operation(summary = "修改资源") @PutMapping(value = "/update/{id}") @PreAuthorize(value = "authenticated and @sae.hasAuthority(T(cn.topiam.employee.support.security.userdetails.UserType).ADMIN)") - public ApiRestResult updatePolicy(@Validated AppPermissionPolicyUpdateParam param) { + public ApiRestResult updatePolicy(@Validated PermissionPolicyUpdateParam param) { return ApiRestResult. builder() .result(permissionPolicyService.updatePermissionPolicy(param)).build(); } @@ -132,11 +133,11 @@ public class AppPermissionPolicyController { @Operation(summary = "获取资源信息") @GetMapping(value = "/{id}") @PreAuthorize(value = "authenticated and @sae.hasAuthority(T(cn.topiam.employee.support.security.userdetails.UserType).ADMIN)") - public ApiRestResult getPermissionPolicy(@PathVariable(value = "id") String id) { + public ApiRestResult getPermissionPolicy(@PathVariable(value = "id") String id) { //返回 - return ApiRestResult. builder() + return ApiRestResult. builder() .result(permissionPolicyService.getPermissionPolicy(id)).build(); } - private final AppPermissionPolicyService permissionPolicyService; + private final PermissionPolicyService permissionPolicyService; } diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/controller/app/AppPermissionResourceController.java b/eiam-console/src/main/java/cn/topiam/employee/console/controller/permission/PermissionResourceController.java similarity index 72% rename from eiam-console/src/main/java/cn/topiam/employee/console/controller/app/AppPermissionResourceController.java rename to eiam-console/src/main/java/cn/topiam/employee/console/controller/permission/PermissionResourceController.java index 7e9f3da6..69136278 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/controller/app/AppPermissionResourceController.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/controller/permission/PermissionResourceController.java @@ -15,8 +15,11 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.console.controller.app; +package cn.topiam.employee.console.controller.permission; +import cn.topiam.employee.console.pojo.result.permission.PermissionResourceGetResult; +import cn.topiam.employee.console.pojo.result.permission.PermissionResourceListResult; +import cn.topiam.employee.console.pojo.save.permission.PermissionRoleCreateParam; import org.springframework.http.MediaType; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; @@ -25,15 +28,12 @@ import org.springframework.web.bind.annotation.*; import cn.topiam.employee.audit.annotation.Audit; import cn.topiam.employee.audit.event.type.EventType; import cn.topiam.employee.common.enums.CheckValidityType; -import cn.topiam.employee.console.pojo.query.app.AppResourceListQuery; -import cn.topiam.employee.console.pojo.result.app.AppPermissionResourceGetResult; -import cn.topiam.employee.console.pojo.result.app.AppPermissionResourceListResult; -import cn.topiam.employee.console.pojo.result.app.AppPermissionRoleListResult; -import cn.topiam.employee.console.pojo.save.app.AppPermissionResourceCreateParam; -import cn.topiam.employee.console.pojo.save.app.AppPermissionRoleCreateParam; -import cn.topiam.employee.console.pojo.update.app.AppPermissionResourceUpdateParam; -import cn.topiam.employee.console.pojo.update.app.PermissionRoleUpdateParam; -import cn.topiam.employee.console.service.app.AppPermissionResourceService; +import cn.topiam.employee.console.pojo.query.permission.PermissionResourceListQuery; +import cn.topiam.employee.console.pojo.result.permission.PermissionRoleListResult; +import cn.topiam.employee.console.pojo.save.permission.PermissionResourceCreateParam; +import cn.topiam.employee.console.pojo.update.permission.PermissionResourceUpdateParam; +import cn.topiam.employee.console.pojo.update.permission.PermissionRoleUpdateParam; +import cn.topiam.employee.console.service.permission.PermissionResourceService; import cn.topiam.employee.support.lock.Lock; import cn.topiam.employee.support.preview.Preview; import cn.topiam.employee.support.repository.page.domain.Page; @@ -47,7 +47,8 @@ import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotNull; -import static cn.topiam.employee.common.constant.AppConstants.APP_PATH; + +import static cn.topiam.employee.common.constant.PermissionConstants.PERMISSION_PATH; /** * 应用权限 @@ -57,33 +58,33 @@ import static cn.topiam.employee.common.constant.AppConstants.APP_PATH; */ @Validated @Tag(name = "应用权限-资源") -@RequestMapping(value = APP_PATH - + "/permission/resource", produces = MediaType.APPLICATION_JSON_VALUE) +@RequestMapping(value = PERMISSION_PATH + + "/resource", produces = MediaType.APPLICATION_JSON_VALUE) @RestController @RequiredArgsConstructor -public class AppPermissionResourceController { +public class PermissionResourceController { /** * 获取所有资源(分页) * * @param page {@link PageModel} - * @return {@link AppPermissionRoleListResult} + * @return {@link PermissionRoleListResult} */ @Operation(summary = "获取资源列表") @GetMapping(value = "/list") @PreAuthorize(value = "authenticated and @sae.hasAuthority(T(cn.topiam.employee.support.security.userdetails.UserType).ADMIN)") - public ApiRestResult> getPermissionResourceList(PageModel page, - @Validated AppResourceListQuery query) { - Page result = appPermissionResourceService + public ApiRestResult> getPermissionResourceList(PageModel page, + @Validated PermissionResourceListQuery query) { + Page result = permissionResourceService .getPermissionResourceList(page, query); - return ApiRestResult.> builder().result(result) + return ApiRestResult.> builder().result(result) .build(); } /** * 创建资源 * - * @param param {@link AppPermissionRoleCreateParam} + * @param param {@link PermissionRoleCreateParam} * @return {@link Boolean} */ @Lock @@ -92,9 +93,9 @@ public class AppPermissionResourceController { @Audit(type = EventType.SAVE_APP_PERMISSION_RESOURCE) @PostMapping(value = "/create") @PreAuthorize(value = "authenticated and @sae.hasAuthority(T(cn.topiam.employee.support.security.userdetails.UserType).ADMIN)") - public ApiRestResult createResource(@Validated @RequestBody AppPermissionResourceCreateParam param) { + public ApiRestResult createResource(@Validated @RequestBody PermissionResourceCreateParam param) { return ApiRestResult. builder() - .result(appPermissionResourceService.createPermissionResource(param)).build(); + .result(permissionResourceService.createPermissionResource(param)).build(); } /** @@ -109,9 +110,9 @@ public class AppPermissionResourceController { @Audit(type = EventType.UPDATE_APP_PERMISSION_RESOURCE) @PutMapping(value = "/update") @PreAuthorize(value = "authenticated and @sae.hasAuthority(T(cn.topiam.employee.support.security.userdetails.UserType).ADMIN)") - public ApiRestResult updateResource(@RequestBody @Validated AppPermissionResourceUpdateParam param) { + public ApiRestResult updateResource(@RequestBody @Validated PermissionResourceUpdateParam param) { return ApiRestResult. builder() - .result(appPermissionResourceService.updatePermissionResource(param)).build(); + .result(permissionResourceService.updatePermissionResource(param)).build(); } /** @@ -128,7 +129,7 @@ public class AppPermissionResourceController { @PreAuthorize(value = "authenticated and @sae.hasAuthority(T(cn.topiam.employee.support.security.userdetails.UserType).ADMIN)") public ApiRestResult deletePermissionResource(@PathVariable(value = "id") String id) { return ApiRestResult. builder() - .result(appPermissionResourceService.deletePermissionResource(id)).build(); + .result(permissionResourceService.deletePermissionResource(id)).build(); } /** @@ -140,10 +141,10 @@ public class AppPermissionResourceController { @Operation(summary = "获取资源信息") @GetMapping(value = "/get/{id}") @PreAuthorize(value = "authenticated and @sae.hasAuthority(T(cn.topiam.employee.support.security.userdetails.UserType).ADMIN)") - public ApiRestResult getPermissionResource(@PathVariable(value = "id") String id) { + public ApiRestResult getPermissionResource(@PathVariable(value = "id") String id) { //返回 - return ApiRestResult. builder() - .result(appPermissionResourceService.getPermissionResource(id)).build(); + return ApiRestResult. builder() + .result(permissionResourceService.getPermissionResource(id)).build(); } /** @@ -160,7 +161,7 @@ public class AppPermissionResourceController { @PreAuthorize(value = "authenticated and @sae.hasAuthority(T(cn.topiam.employee.support.security.userdetails.UserType).ADMIN)") public ApiRestResult enableOrganization(@PathVariable(value = "id") Long id) { return ApiRestResult. builder() - .result(appPermissionResourceService.updateStatus(id, Boolean.TRUE)).build(); + .result(permissionResourceService.updateStatus(id, Boolean.TRUE)).build(); } /** @@ -177,7 +178,7 @@ public class AppPermissionResourceController { @PreAuthorize(value = "authenticated and @sae.hasAuthority(T(cn.topiam.employee.support.security.userdetails.UserType).ADMIN)") public ApiRestResult disableOrganization(@PathVariable(value = "id") Long id) { return ApiRestResult. builder() - .result(appPermissionResourceService.updateStatus(id, Boolean.FALSE)).build(); + .result(permissionResourceService.updateStatus(id, Boolean.FALSE)).build(); } /** @@ -192,7 +193,7 @@ public class AppPermissionResourceController { @Parameter(description = "值") @NotEmpty(message = "验证值不能为空") String value, @Parameter(description = "应用ID") @NotNull(message = "应用ID不能为空") Long appId, @Parameter(description = "ID") Long id) { - Boolean result = appPermissionResourceService.permissionResourceParamCheck(type, value, + Boolean result = permissionResourceService.permissionResourceParamCheck(type, value, appId, id); //返回 return ApiRestResult. builder().result(result).build(); @@ -201,5 +202,5 @@ public class AppPermissionResourceController { /** * 资源服务类 */ - private final AppPermissionResourceService appPermissionResourceService; + private final PermissionResourceService permissionResourceService; } diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/controller/app/AppPermissionRoleController.java b/eiam-console/src/main/java/cn/topiam/employee/console/controller/permission/PermissionRoleController.java similarity index 75% rename from eiam-console/src/main/java/cn/topiam/employee/console/controller/app/AppPermissionRoleController.java rename to eiam-console/src/main/java/cn/topiam/employee/console/controller/permission/PermissionRoleController.java index 45dd2654..68fe9234 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/controller/app/AppPermissionRoleController.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/controller/permission/PermissionRoleController.java @@ -15,8 +15,11 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.console.controller.app; +package cn.topiam.employee.console.controller.permission; +import cn.topiam.employee.console.pojo.result.permission.PermissionRoleListResult; +import cn.topiam.employee.console.pojo.result.permission.PermissionRoleResult; +import cn.topiam.employee.console.pojo.save.permission.PermissionRoleCreateParam; import org.springframework.http.MediaType; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; @@ -25,12 +28,9 @@ import org.springframework.web.bind.annotation.*; import cn.topiam.employee.audit.annotation.Audit; import cn.topiam.employee.audit.event.type.EventType; import cn.topiam.employee.common.enums.CheckValidityType; -import cn.topiam.employee.console.pojo.query.app.AppPermissionRoleListQuery; -import cn.topiam.employee.console.pojo.result.app.AppPermissionRoleListResult; -import cn.topiam.employee.console.pojo.result.app.AppPermissionRoleResult; -import cn.topiam.employee.console.pojo.save.app.AppPermissionRoleCreateParam; -import cn.topiam.employee.console.pojo.update.app.PermissionRoleUpdateParam; -import cn.topiam.employee.console.service.app.AppPermissionRoleService; +import cn.topiam.employee.console.pojo.query.permission.PermissionRoleListQuery; +import cn.topiam.employee.console.pojo.update.permission.PermissionRoleUpdateParam; +import cn.topiam.employee.console.service.permission.PermissionRoleService; import cn.topiam.employee.support.lock.Lock; import cn.topiam.employee.support.preview.Preview; import cn.topiam.employee.support.repository.page.domain.Page; @@ -44,7 +44,8 @@ import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotNull; -import static cn.topiam.employee.common.constant.AppConstants.APP_PATH; + +import static cn.topiam.employee.common.constant.PermissionConstants.PERMISSION_PATH; /** * 应用角色 @@ -55,30 +56,30 @@ import static cn.topiam.employee.common.constant.AppConstants.APP_PATH; @RequiredArgsConstructor @Validated @Tag(name = "应用权限-角色") -@RequestMapping(value = APP_PATH + "/permission/role", produces = MediaType.APPLICATION_JSON_VALUE) +@RequestMapping(value = PERMISSION_PATH + "/role", produces = MediaType.APPLICATION_JSON_VALUE) @RestController -public class AppPermissionRoleController { +public class PermissionRoleController { /** * 获取所有角色(分页) * * @param page {@link PageModel} - * @return {@link AppPermissionRoleListResult} + * @return {@link PermissionRoleListResult} */ @Operation(summary = "获取角色列表") @GetMapping(value = "/list") @PreAuthorize(value = "authenticated and @sae.hasAuthority(T(cn.topiam.employee.support.security.userdetails.UserType).ADMIN)") - public ApiRestResult> getPermissionRoleList(PageModel page, - @Validated AppPermissionRoleListQuery query) { - Page result = appPermissionRoleService + public ApiRestResult> getPermissionRoleList(PageModel page, + @Validated PermissionRoleListQuery query) { + Page result = permissionRoleService .getPermissionRoleList(page, query); - return ApiRestResult.> builder().result(result).build(); + return ApiRestResult.> builder().result(result).build(); } /** * 创建角色 * - * @param param {@link AppPermissionRoleCreateParam} + * @param param {@link PermissionRoleCreateParam} * @return {@link Boolean} */ @Lock @@ -87,9 +88,9 @@ public class AppPermissionRoleController { @Audit(type = EventType.SAVE_APP_PERMISSION_ROLE) @PostMapping(value = "/create") @PreAuthorize(value = "authenticated and @sae.hasAuthority(T(cn.topiam.employee.support.security.userdetails.UserType).ADMIN)") - public ApiRestResult createPermissionRole(@Validated @RequestBody AppPermissionRoleCreateParam param) { + public ApiRestResult createPermissionRole(@Validated @RequestBody PermissionRoleCreateParam param) { return ApiRestResult. builder() - .result(appPermissionRoleService.createPermissionRole(param)).build(); + .result(permissionRoleService.createPermissionRole(param)).build(); } /** @@ -106,7 +107,7 @@ public class AppPermissionRoleController { @PreAuthorize(value = "authenticated and @sae.hasAuthority(T(cn.topiam.employee.support.security.userdetails.UserType).ADMIN)") public ApiRestResult updatePermissionRole(@RequestBody @Validated PermissionRoleUpdateParam param) { return ApiRestResult. builder() - .result(appPermissionRoleService.updatePermissionRole(param)).build(); + .result(permissionRoleService.updatePermissionRole(param)).build(); } /** @@ -123,7 +124,7 @@ public class AppPermissionRoleController { @PreAuthorize(value = "authenticated and @sae.hasAuthority(T(cn.topiam.employee.support.security.userdetails.UserType).ADMIN)") public ApiRestResult deletePermissionRole(@PathVariable(value = "ids") String ids) { return ApiRestResult. builder() - .result(appPermissionRoleService.deletePermissionRole(ids)).build(); + .result(permissionRoleService.deletePermissionRole(ids)).build(); } /** @@ -135,10 +136,10 @@ public class AppPermissionRoleController { @Operation(summary = "获取角色信息") @GetMapping(value = "/{id}") @PreAuthorize(value = "authenticated and @sae.hasAuthority(T(cn.topiam.employee.support.security.userdetails.UserType).ADMIN)") - public ApiRestResult getPermissionRole(@PathVariable(value = "id") Long id) { - AppPermissionRoleResult details = appPermissionRoleService.getPermissionRole(id); + public ApiRestResult getPermissionRole(@PathVariable(value = "id") Long id) { + PermissionRoleResult details = permissionRoleService.getPermissionRole(id); //返回 - return ApiRestResult. builder().result(details).build(); + return ApiRestResult. builder().result(details).build(); } /** @@ -153,7 +154,7 @@ public class AppPermissionRoleController { @PutMapping(value = "/enable/{id}") @PreAuthorize(value = "authenticated and @sae.hasAuthority(T(cn.topiam.employee.support.security.userdetails.UserType).ADMIN)") public ApiRestResult enablePermissionRole(@PathVariable(value = "id") String id) { - Boolean result = appPermissionRoleService.updatePermissionRoleStatus(id, Boolean.TRUE); + Boolean result = permissionRoleService.updatePermissionRoleStatus(id, Boolean.TRUE); return ApiRestResult. builder().result(result).build(); } @@ -169,7 +170,7 @@ public class AppPermissionRoleController { @PutMapping(value = "/disable/{id}") @PreAuthorize(value = "authenticated and @sae.hasAuthority(T(cn.topiam.employee.support.security.userdetails.UserType).ADMIN)") public ApiRestResult disablePermissionRole(@PathVariable(value = "id") String id) { - Boolean result = appPermissionRoleService.updatePermissionRoleStatus(id, Boolean.FALSE); + Boolean result = permissionRoleService.updatePermissionRoleStatus(id, Boolean.FALSE); return ApiRestResult. builder().result(result).build(); } @@ -185,7 +186,7 @@ public class AppPermissionRoleController { @Parameter(description = "值") @NotEmpty(message = "验证值不能为空") String value, @Parameter(description = "应用ID") @NotNull(message = "应用ID不能为空") Long appId, @Parameter(description = "ID") Long id) { - Boolean result = appPermissionRoleService.permissionRoleParamCheck(type, value, appId, id); + Boolean result = permissionRoleService.permissionRoleParamCheck(type, value, appId, id); //返回 return ApiRestResult. builder().result(result).build(); } @@ -193,5 +194,5 @@ public class AppPermissionRoleController { /** * 角色服务类 */ - private final AppPermissionRoleService appPermissionRoleService; + private final PermissionRoleService permissionRoleService; } diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/controller/setting/SmsProviderController.java b/eiam-console/src/main/java/cn/topiam/employee/console/controller/setting/SmsProviderController.java index abf16e11..f513414e 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/controller/setting/SmsProviderController.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/controller/setting/SmsProviderController.java @@ -29,7 +29,7 @@ import cn.topiam.employee.common.enums.MailType; import cn.topiam.employee.common.enums.MessageCategory; import cn.topiam.employee.common.enums.SmsType; import cn.topiam.employee.console.pojo.save.setting.SmsProviderSaveParam; -import cn.topiam.employee.console.pojo.setting.SmsProviderConfigResult; +import cn.topiam.employee.console.pojo.result.setting.SmsProviderConfigResult; import cn.topiam.employee.console.service.setting.MessageSettingService; import cn.topiam.employee.core.message.MsgVariable; import cn.topiam.employee.core.message.sms.SmsMsgEventPublish; diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/converter/app/AppPermissionActionConverter.java b/eiam-console/src/main/java/cn/topiam/employee/console/converter/permission/PermissionActionConverter.java similarity index 71% rename from eiam-console/src/main/java/cn/topiam/employee/console/converter/app/AppPermissionActionConverter.java rename to eiam-console/src/main/java/cn/topiam/employee/console/converter/permission/PermissionActionConverter.java index 154ad285..ef46a91b 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/converter/app/AppPermissionActionConverter.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/converter/permission/PermissionActionConverter.java @@ -15,11 +15,13 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.console.converter.app; +package cn.topiam.employee.console.converter.permission; import java.util.ArrayList; import java.util.List; +import cn.topiam.employee.common.entity.permission.PermissionActionEntity; +import cn.topiam.employee.common.entity.permission.PermissionResourceEntity; import org.apache.commons.lang3.StringUtils; import org.mapstruct.Mapper; import org.mapstruct.Mapping; @@ -28,12 +30,10 @@ import org.springframework.util.ObjectUtils; import com.querydsl.core.types.ExpressionUtils; import com.querydsl.core.types.Predicate; -import cn.topiam.employee.common.entity.app.AppPermissionActionEntity; -import cn.topiam.employee.common.entity.app.AppPermissionResourceEntity; import cn.topiam.employee.common.entity.app.QAppPermissionResourceEntity; import cn.topiam.employee.common.enums.PermissionActionType; -import cn.topiam.employee.console.pojo.query.app.AppPermissionActionListQuery; -import cn.topiam.employee.console.pojo.result.app.AppPermissionActionListResult; +import cn.topiam.employee.console.pojo.query.permission.PermissionActionListQuery; +import cn.topiam.employee.console.pojo.result.permission.PermissionActionListResult; /** * 权限映射 @@ -42,14 +42,14 @@ import cn.topiam.employee.console.pojo.result.app.AppPermissionActionListResult; * Created by support@topiam.cn on 2020/8/14 22:45 */ @Mapper(componentModel = "spring") -public interface AppPermissionActionConverter { +public interface PermissionActionConverter { /** * 应用权限资源列表转分页 * - * @param query {@link AppPermissionActionListQuery} + * @param query {@link PermissionActionListQuery} * @return {@link Predicate} */ - default Predicate appPermissionActionListQueryConvertToPredicate(AppPermissionActionListQuery query) { + default Predicate appPermissionActionListQueryConvertToPredicate(PermissionActionListQuery query) { QAppPermissionResourceEntity resource = QAppPermissionResourceEntity.appPermissionResourceEntity; Predicate predicate = ExpressionUtils.and(resource.isNotNull(), resource.deleted.eq(Boolean.FALSE)); @@ -68,18 +68,18 @@ public interface AppPermissionActionConverter { /** * 实体转资源权限结果返回 * - * @param list {@link AppPermissionResourceEntity} - * @return {@link AppPermissionActionListResult} + * @param list {@link PermissionResourceEntity} + * @return {@link PermissionActionListResult} */ - default List entityConvertToResourceActionListResult(List list) { - List results = new ArrayList<>(); - List menus = new ArrayList<>(); - List apis = new ArrayList<>(); - List buttons = new ArrayList<>(); - List others = new ArrayList<>(); - List datas = new ArrayList<>(); - for (AppPermissionResourceEntity resource : list) { - for (AppPermissionActionEntity action : resource.getActions()) { + default List entityConvertToResourceActionListResult(List list) { + List results = new ArrayList<>(); + List menus = new ArrayList<>(); + List apis = new ArrayList<>(); + List buttons = new ArrayList<>(); + List others = new ArrayList<>(); + List datas = new ArrayList<>(); + for (PermissionResourceEntity resource : list) { + for (PermissionActionEntity action : resource.getActions()) { if (PermissionActionType.MENU.equals(action.getType())) { menus.add(actionConvertToResourceActionResult(action)); } @@ -96,7 +96,7 @@ public interface AppPermissionActionConverter { others.add(actionConvertToResourceActionResult(action)); } } - AppPermissionActionListResult result = new AppPermissionActionListResult(); + PermissionActionListResult result = new PermissionActionListResult(); //基本信息 result.setAppId(resource.getAppId().toString()); result.setId(resource.getId().toString()); @@ -117,10 +117,10 @@ public interface AppPermissionActionConverter { /** * actionConvertToResourceActionResult * - * @param action {@link AppPermissionActionEntity} - * @return {@link AppPermissionActionListResult.Action} + * @param action {@link PermissionActionEntity} + * @return {@link PermissionActionListResult.Action} */ @Mapping(target = "access", source = "value") - AppPermissionActionListResult.Action actionConvertToResourceActionResult(AppPermissionActionEntity action); + PermissionActionListResult.Action actionConvertToResourceActionResult(PermissionActionEntity action); } diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/converter/app/AppPermissionPolicyConverter.java b/eiam-console/src/main/java/cn/topiam/employee/console/converter/permission/PermissionPolicyConverter.java similarity index 62% rename from eiam-console/src/main/java/cn/topiam/employee/console/converter/app/AppPermissionPolicyConverter.java rename to eiam-console/src/main/java/cn/topiam/employee/console/converter/permission/PermissionPolicyConverter.java index e8fc31cb..437723ea 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/converter/app/AppPermissionPolicyConverter.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/converter/permission/PermissionPolicyConverter.java @@ -15,20 +15,20 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.console.converter.app; +package cn.topiam.employee.console.converter.permission; import java.util.ArrayList; import java.util.List; +import cn.topiam.employee.common.entity.permission.PermissionPolicyEntity; +import cn.topiam.employee.common.entity.permission.po.PermissionPolicyPO; +import cn.topiam.employee.console.pojo.result.permission.PermissionPolicyListResult; +import cn.topiam.employee.console.pojo.save.permission.PermissionPolicyCreateParam; import org.mapstruct.Mapper; import org.mapstruct.Mapping; import org.springframework.util.CollectionUtils; -import cn.topiam.employee.common.entity.app.AppPermissionPolicyEntity; -import cn.topiam.employee.common.entity.app.po.AppPermissionPolicyPO; -import cn.topiam.employee.console.pojo.result.app.AppPermissionPolicyListResult; -import cn.topiam.employee.console.pojo.save.app.AppPermissionPolicyCreateParam; -import cn.topiam.employee.console.pojo.update.app.AppPermissionPolicyUpdateParam; +import cn.topiam.employee.console.pojo.update.permission.PermissionPolicyUpdateParam; import cn.topiam.employee.support.repository.page.domain.Page; /** @@ -37,14 +37,14 @@ import cn.topiam.employee.support.repository.page.domain.Page; * @author TopIAM * Created by support@topiam.cn on 2020/8/14 22:45 */ -@Mapper(componentModel = "spring", uses = AppPermissionActionConverter.class) -public interface AppPermissionPolicyConverter { +@Mapper(componentModel = "spring", uses = PermissionActionConverter.class) +public interface PermissionPolicyConverter { /** * 资源创建参数转实体类 * - * @param param {@link AppPermissionPolicyCreateParam} - * @return {@link AppPermissionPolicyEntity} + * @param param {@link PermissionPolicyCreateParam} + * @return {@link PermissionPolicyEntity} */ @Mapping(target = "deleted", ignore = true) @Mapping(target = "id", ignore = true) @@ -53,13 +53,13 @@ public interface AppPermissionPolicyConverter { @Mapping(target = "remark", ignore = true) @Mapping(target = "createTime", ignore = true) @Mapping(target = "createBy", ignore = true) - AppPermissionPolicyEntity policyCreateParamConvertToEntity(AppPermissionPolicyCreateParam param); + PermissionPolicyEntity policyCreateParamConvertToEntity(PermissionPolicyCreateParam param); /** * 资源修改参数转实体类 * - * @param param {@link AppPermissionPolicyCreateParam} - * @return {@link AppPermissionPolicyEntity} + * @param param {@link PermissionPolicyCreateParam} + * @return {@link PermissionPolicyEntity} */ @Mapping(target = "deleted", ignore = true) @Mapping(target = "updateTime", ignore = true) @@ -67,7 +67,7 @@ public interface AppPermissionPolicyConverter { @Mapping(target = "remark", ignore = true) @Mapping(target = "createTime", ignore = true) @Mapping(target = "createBy", ignore = true) - AppPermissionPolicyEntity policyUpdateParamConvertToEntity(AppPermissionPolicyUpdateParam param); + PermissionPolicyEntity policyUpdateParamConvertToEntity(PermissionPolicyUpdateParam param); /** * 资源转换为资源列表结果 @@ -75,9 +75,9 @@ public interface AppPermissionPolicyConverter { * @param page {@link Page} * @return {@link Page} */ - default Page entityConvertToPolicyListResult(org.springframework.data.domain.Page page) { - Page result = new Page<>(); - List pageList = page.getContent(); + default Page entityConvertToPolicyListResult(org.springframework.data.domain.Page page) { + Page result = new Page<>(); + List pageList = page.getContent(); if (!CollectionUtils.isEmpty(pageList)) { //@formatter:off result.setPagination(Page.Pagination.builder() @@ -86,8 +86,8 @@ public interface AppPermissionPolicyConverter { .current(page.getPageable().getPageNumber() + 1) .build()); //@formatter:on - List list = new ArrayList<>(); - for (AppPermissionPolicyPO po : pageList) { + List list = new ArrayList<>(); + for (PermissionPolicyPO po : pageList) { list.add(entityConvertToPolicyListResult(po)); } result.setList(list); @@ -98,8 +98,8 @@ public interface AppPermissionPolicyConverter { /** * entityConvertToPolicyListResult * - * @param entity {@link AppPermissionPolicyListResult} - * @return {@link AppPermissionPolicyPO} + * @param entity {@link PermissionPolicyListResult} + * @return {@link PermissionPolicyPO} */ - AppPermissionPolicyListResult entityConvertToPolicyListResult(AppPermissionPolicyPO entity); + PermissionPolicyListResult entityConvertToPolicyListResult(PermissionPolicyPO entity); } diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/converter/app/AppPermissionResourceConverter.java b/eiam-console/src/main/java/cn/topiam/employee/console/converter/permission/PermissionResourceConverter.java similarity index 65% rename from eiam-console/src/main/java/cn/topiam/employee/console/converter/app/AppPermissionResourceConverter.java rename to eiam-console/src/main/java/cn/topiam/employee/console/converter/permission/PermissionResourceConverter.java index c6972b74..ce6df9ea 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/converter/app/AppPermissionResourceConverter.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/converter/permission/PermissionResourceConverter.java @@ -15,11 +15,15 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.console.converter.app; +package cn.topiam.employee.console.converter.permission; import java.util.ArrayList; import java.util.List; +import cn.topiam.employee.common.entity.permission.PermissionResourceEntity; +import cn.topiam.employee.console.pojo.result.permission.PermissionResourceGetResult; +import cn.topiam.employee.console.pojo.result.permission.PermissionResourceListResult; +import cn.topiam.employee.console.pojo.update.permission.PermissionResourceUpdateParam; import org.apache.commons.lang3.StringUtils; import org.mapstruct.Mapper; import org.mapstruct.Mapping; @@ -29,13 +33,9 @@ import org.springframework.util.ObjectUtils; import com.querydsl.core.types.ExpressionUtils; import com.querydsl.core.types.Predicate; -import cn.topiam.employee.common.entity.app.AppPermissionResourceEntity; import cn.topiam.employee.common.entity.app.QAppPermissionResourceEntity; -import cn.topiam.employee.console.pojo.query.app.AppResourceListQuery; -import cn.topiam.employee.console.pojo.result.app.AppPermissionResourceGetResult; -import cn.topiam.employee.console.pojo.result.app.AppPermissionResourceListResult; -import cn.topiam.employee.console.pojo.save.app.AppPermissionResourceCreateParam; -import cn.topiam.employee.console.pojo.update.app.AppPermissionResourceUpdateParam; +import cn.topiam.employee.console.pojo.query.permission.PermissionResourceListQuery; +import cn.topiam.employee.console.pojo.save.permission.PermissionResourceCreateParam; import cn.topiam.employee.support.repository.page.domain.Page; /** @@ -44,16 +44,16 @@ import cn.topiam.employee.support.repository.page.domain.Page; * @author TopIAM * Created by support@topiam.cn on 2020/8/14 22:45 */ -@Mapper(componentModel = "spring", uses = AppPermissionActionConverter.class) -public interface AppPermissionResourceConverter { +@Mapper(componentModel = "spring", uses = PermissionActionConverter.class) +public interface PermissionResourceConverter { /** * 资源分页查询参数转实体 * - * @param query {@link AppResourceListQuery} + * @param query {@link PermissionResourceListQuery} * @return {@link Predicate} */ - default Predicate resourcePaginationParamConvertToPredicate(AppResourceListQuery query) { + default Predicate resourcePaginationParamConvertToPredicate(PermissionResourceListQuery query) { QAppPermissionResourceEntity resource = QAppPermissionResourceEntity.appPermissionResourceEntity; Predicate predicate = ExpressionUtils.and(resource.isNotNull(), resource.deleted.eq(Boolean.FALSE)); @@ -70,8 +70,8 @@ public interface AppPermissionResourceConverter { /** * 资源创建参数转实体类 * - * @param param {@link AppPermissionResourceCreateParam} - * @return {@link AppPermissionResourceEntity} + * @param param {@link PermissionResourceCreateParam} + * @return {@link PermissionResourceEntity} */ @Mapping(target = "deleted", ignore = true) @Mapping(target = "actions", ignore = true) @@ -81,13 +81,13 @@ public interface AppPermissionResourceConverter { @Mapping(target = "remark", ignore = true) @Mapping(target = "createTime", ignore = true) @Mapping(target = "createBy", ignore = true) - AppPermissionResourceEntity resourceCreateParamConvertToEntity(AppPermissionResourceCreateParam param); + PermissionResourceEntity resourceCreateParamConvertToEntity(PermissionResourceCreateParam param); /** * 资源修改参数转实体类 * - * @param param {@link AppPermissionResourceCreateParam} - * @return {@link AppPermissionResourceEntity} + * @param param {@link PermissionResourceCreateParam} + * @return {@link PermissionResourceEntity} */ @Mapping(target = "deleted", ignore = true) @Mapping(target = "actions", ignore = true) @@ -96,7 +96,7 @@ public interface AppPermissionResourceConverter { @Mapping(target = "remark", ignore = true) @Mapping(target = "createTime", ignore = true) @Mapping(target = "createBy", ignore = true) - AppPermissionResourceEntity resourceUpdateParamConvertToEntity(AppPermissionResourceUpdateParam param); + PermissionResourceEntity resourceUpdateParamConvertToEntity(PermissionResourceUpdateParam param); /** * 资源转换为资源列表结果 @@ -104,12 +104,12 @@ public interface AppPermissionResourceConverter { * @param page {@link Page} * @return {@link Page} */ - default Page entityConvertToResourceListResult(org.springframework.data.domain.Page page) { - Page result = new Page<>(); - List pageList = page.getContent(); + default Page entityConvertToResourceListResult(org.springframework.data.domain.Page page) { + Page result = new Page<>(); + List pageList = page.getContent(); if (!CollectionUtils.isEmpty(pageList)) { - List list = new ArrayList<>(); - for (AppPermissionResourceEntity resource : pageList) { + List list = new ArrayList<>(); + for (PermissionResourceEntity resource : pageList) { list.add(entityConvertToResourceListResult(resource)); } //@formatter:off @@ -127,17 +127,17 @@ public interface AppPermissionResourceConverter { /** * 实体转换为资源列表结果 * - * @param data {@link AppPermissionResourceEntity} - * @return {@link AppPermissionResourceListResult} + * @param data {@link PermissionResourceEntity} + * @return {@link PermissionResourceListResult} */ - AppPermissionResourceListResult entityConvertToResourceListResult(AppPermissionResourceEntity data); + PermissionResourceListResult entityConvertToResourceListResult(PermissionResourceEntity data); /** * 实体转获取详情返回 * - * @param resource {@link AppPermissionResourceEntity} - * @return {@link AppPermissionResourceGetResult} + * @param resource {@link PermissionResourceEntity} + * @return {@link PermissionResourceGetResult} */ @Mapping(target = "actions", source = "actions") - AppPermissionResourceGetResult entityConvertToResourceGetResult(AppPermissionResourceEntity resource); + PermissionResourceGetResult entityConvertToResourceGetResult(PermissionResourceEntity resource); } diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/converter/app/AppPermissionRoleConverter.java b/eiam-console/src/main/java/cn/topiam/employee/console/converter/permission/PermissionRoleConverter.java similarity index 69% rename from eiam-console/src/main/java/cn/topiam/employee/console/converter/app/AppPermissionRoleConverter.java rename to eiam-console/src/main/java/cn/topiam/employee/console/converter/permission/PermissionRoleConverter.java index 365d3dca..18b1310a 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/converter/app/AppPermissionRoleConverter.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/converter/permission/PermissionRoleConverter.java @@ -15,11 +15,12 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.console.converter.app; +package cn.topiam.employee.console.converter.permission; import java.util.ArrayList; import java.util.List; +import cn.topiam.employee.console.pojo.save.permission.PermissionRoleCreateParam; import org.apache.commons.lang3.StringUtils; import org.mapstruct.Mapper; import org.mapstruct.Mapping; @@ -29,13 +30,12 @@ import org.springframework.util.ObjectUtils; import com.querydsl.core.types.ExpressionUtils; import com.querydsl.core.types.Predicate; -import cn.topiam.employee.common.entity.app.AppPermissionRoleEntity; import cn.topiam.employee.common.entity.app.QAppPermissionRoleEntity; -import cn.topiam.employee.console.pojo.query.app.AppPermissionRoleListQuery; -import cn.topiam.employee.console.pojo.result.app.AppPermissionRoleListResult; -import cn.topiam.employee.console.pojo.result.app.AppPermissionRoleResult; -import cn.topiam.employee.console.pojo.save.app.AppPermissionRoleCreateParam; -import cn.topiam.employee.console.pojo.update.app.PermissionRoleUpdateParam; +import cn.topiam.employee.common.entity.permission.PermissionRoleEntity; +import cn.topiam.employee.console.pojo.query.permission.PermissionRoleListQuery; +import cn.topiam.employee.console.pojo.result.permission.PermissionRoleListResult; +import cn.topiam.employee.console.pojo.result.permission.PermissionRoleResult; +import cn.topiam.employee.console.pojo.update.permission.PermissionRoleUpdateParam; import cn.topiam.employee.support.repository.page.domain.Page; /** @@ -45,7 +45,7 @@ import cn.topiam.employee.support.repository.page.domain.Page; * Created by support@topiam.cn on 2020/8/14 22:45 */ @Mapper(componentModel = "spring") -public interface AppPermissionRoleConverter { +public interface PermissionRoleConverter { /** * 角色实体转换为角色分页结果 @@ -53,11 +53,11 @@ public interface AppPermissionRoleConverter { * @param page {@link Page} * @return {@link Page} */ - default Page entityConvertToRolePaginationResult(org.springframework.data.domain.Page page) { - Page result = new Page<>(); + default Page entityConvertToRolePaginationResult(org.springframework.data.domain.Page page) { + Page result = new Page<>(); if (!CollectionUtils.isEmpty(page.getContent())) { - List list = new ArrayList<>(); - for (AppPermissionRoleEntity user : page.getContent()) { + List list = new ArrayList<>(); + for (PermissionRoleEntity user : page.getContent()) { list.add(entityConvertToRolePaginationResult(user)); } //@formatter:off @@ -75,16 +75,16 @@ public interface AppPermissionRoleConverter { /** * 角色实体转换为角色分页结果 * - * @param page {@link AppPermissionRoleEntity} - * @return {@link AppPermissionRoleListResult} + * @param page {@link PermissionRoleEntity} + * @return {@link PermissionRoleListResult} */ - AppPermissionRoleListResult entityConvertToRolePaginationResult(AppPermissionRoleEntity page); + PermissionRoleListResult entityConvertToRolePaginationResult(PermissionRoleEntity page); /** * 角色创建参数转换为角色实体 * - * @param param {@link AppPermissionRoleCreateParam} - * @return {@link AppPermissionRoleEntity} + * @param param {@link PermissionRoleCreateParam} + * @return {@link PermissionRoleEntity} */ @Mapping(target = "deleted", ignore = true) @Mapping(target = "id", ignore = true) @@ -93,13 +93,13 @@ public interface AppPermissionRoleConverter { @Mapping(target = "updateBy", ignore = true) @Mapping(target = "createTime", ignore = true) @Mapping(target = "createBy", ignore = true) - AppPermissionRoleEntity roleCreateParamConvertToEntity(AppPermissionRoleCreateParam param); + PermissionRoleEntity roleCreateParamConvertToEntity(PermissionRoleCreateParam param); /** * 角色更新参数转换为角色实体类 * * @param param {@link PermissionRoleUpdateParam} 更新参数 - * @return {@link AppPermissionRoleEntity} 角色实体 + * @return {@link PermissionRoleEntity} 角色实体 */ @Mapping(target = "deleted", ignore = true) @Mapping(target = "appId", ignore = true) @@ -108,23 +108,23 @@ public interface AppPermissionRoleConverter { @Mapping(target = "updateBy", ignore = true) @Mapping(target = "createTime", ignore = true) @Mapping(target = "createBy", ignore = true) - AppPermissionRoleEntity roleUpdateParamConvertToEntity(PermissionRoleUpdateParam param); + PermissionRoleEntity roleUpdateParamConvertToEntity(PermissionRoleUpdateParam param); /** * 实体转系统详情结果 * - * @param role {@link AppPermissionRoleEntity} - * @return {@link AppPermissionRoleResult} + * @param role {@link PermissionRoleEntity} + * @return {@link PermissionRoleResult} */ - AppPermissionRoleResult entityConvertToRoleDetailResult(AppPermissionRoleEntity role); + PermissionRoleResult entityConvertToRoleDetailResult(PermissionRoleEntity role); /** * 角色分页查询参数转实体 * - * @param query {@link AppPermissionRoleListQuery} - * @return {@link AppPermissionRoleEntity} + * @param query {@link PermissionRoleListQuery} + * @return {@link PermissionRoleEntity} */ - default Predicate rolePaginationParamConvertToPredicate(AppPermissionRoleListQuery query) { + default Predicate rolePaginationParamConvertToPredicate(PermissionRoleListQuery query) { QAppPermissionRoleEntity role = QAppPermissionRoleEntity.appPermissionRoleEntity; Predicate predicate = ExpressionUtils.and(role.isNotNull(), role.deleted.eq(Boolean.FALSE)); //查询条件 diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/converter/setting/MessageSettingConverter.java b/eiam-console/src/main/java/cn/topiam/employee/console/converter/setting/MessageSettingConverter.java index 63ed22c5..58aa8537 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/converter/setting/MessageSettingConverter.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/converter/setting/MessageSettingConverter.java @@ -42,7 +42,7 @@ import cn.topiam.employee.common.message.sms.tencent.TencentSmsProviderConfig; import cn.topiam.employee.console.pojo.result.setting.EmailProviderConfigResult; import cn.topiam.employee.console.pojo.save.setting.MailProviderSaveParam; import cn.topiam.employee.console.pojo.save.setting.SmsProviderSaveParam; -import cn.topiam.employee.console.pojo.setting.SmsProviderConfigResult; +import cn.topiam.employee.console.pojo.result.setting.SmsProviderConfigResult; import cn.topiam.employee.support.exception.TopIamException; import cn.topiam.employee.support.validation.ValidationUtils; diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/query/app/AppPermissionActionListQuery.java b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/query/permission/PermissionActionListQuery.java similarity index 93% rename from eiam-console/src/main/java/cn/topiam/employee/console/pojo/query/app/AppPermissionActionListQuery.java rename to eiam-console/src/main/java/cn/topiam/employee/console/pojo/query/permission/PermissionActionListQuery.java index 553cc8e1..05443c23 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/query/app/AppPermissionActionListQuery.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/query/permission/PermissionActionListQuery.java @@ -15,7 +15,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.console.pojo.query.app; +package cn.topiam.employee.console.pojo.query.permission; import java.io.Serial; import java.io.Serializable; @@ -37,7 +37,7 @@ import jakarta.validation.constraints.NotEmpty; @Data @Schema(description = "查询权限列表入参") @ParameterObject -public class AppPermissionActionListQuery implements Serializable { +public class PermissionActionListQuery implements Serializable { @Serial private static final long serialVersionUID = 4307939244290315206L; diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/query/app/AppResourceListQuery.java b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/query/permission/PermissionResourceListQuery.java similarity index 92% rename from eiam-console/src/main/java/cn/topiam/employee/console/pojo/query/app/AppResourceListQuery.java rename to eiam-console/src/main/java/cn/topiam/employee/console/pojo/query/permission/PermissionResourceListQuery.java index c7fb5a45..881fcc6c 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/query/app/AppResourceListQuery.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/query/permission/PermissionResourceListQuery.java @@ -15,7 +15,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.console.pojo.query.app; +package cn.topiam.employee.console.pojo.query.permission; import java.io.Serializable; @@ -36,7 +36,7 @@ import jakarta.validation.constraints.NotNull; @Data @Schema(description = "查询权限资源列表入参") @ParameterObject -public class AppResourceListQuery implements Serializable { +public class PermissionResourceListQuery implements Serializable { /** * 资源名称 diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/query/app/AppPermissionRoleListQuery.java b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/query/permission/PermissionRoleListQuery.java similarity index 93% rename from eiam-console/src/main/java/cn/topiam/employee/console/pojo/query/app/AppPermissionRoleListQuery.java rename to eiam-console/src/main/java/cn/topiam/employee/console/pojo/query/permission/PermissionRoleListQuery.java index 58365da4..274da7d2 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/query/app/AppPermissionRoleListQuery.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/query/permission/PermissionRoleListQuery.java @@ -15,7 +15,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.console.pojo.query.app; +package cn.topiam.employee.console.pojo.query.permission; import java.io.Serializable; @@ -36,7 +36,7 @@ import jakarta.validation.constraints.NotNull; @Data @Schema(description = "查询角色列表入参") @ParameterObject -public class AppPermissionRoleListQuery implements Serializable { +public class PermissionRoleListQuery implements Serializable { /** * 角色名称 diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/app/AppPermissionActionListResult.java b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/permission/PermissionActionListResult.java similarity index 96% rename from eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/app/AppPermissionActionListResult.java rename to eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/permission/PermissionActionListResult.java index 112b0e31..2a37d159 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/app/AppPermissionActionListResult.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/permission/PermissionActionListResult.java @@ -15,7 +15,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.console.pojo.result.app; +package cn.topiam.employee.console.pojo.result.permission; import java.io.Serial; import java.io.Serializable; @@ -36,7 +36,7 @@ import io.swagger.v3.oas.annotations.media.Schema; @Data @Accessors(chain = true) @Schema(description = "获取应用资源权限列表") -public class AppPermissionActionListResult implements Serializable { +public class PermissionActionListResult implements Serializable { @Serial private static final long serialVersionUID = 3320953184046791392L; diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/app/AppPermissionPolicyGetResult.java b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/permission/PermissionPolicyGetResult.java similarity index 95% rename from eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/app/AppPermissionPolicyGetResult.java rename to eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/permission/PermissionPolicyGetResult.java index b1f0716a..b0b5435a 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/app/AppPermissionPolicyGetResult.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/permission/PermissionPolicyGetResult.java @@ -15,7 +15,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.console.pojo.result.app; +package cn.topiam.employee.console.pojo.result.permission; import java.io.Serializable; @@ -36,7 +36,7 @@ import io.swagger.v3.oas.annotations.media.Schema; */ @Schema(description = "获取资源结果") @Data -public class AppPermissionPolicyGetResult implements Serializable { +public class PermissionPolicyGetResult implements Serializable { /** * ID */ diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/app/AppPermissionPolicyListResult.java b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/permission/PermissionPolicyListResult.java similarity index 95% rename from eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/app/AppPermissionPolicyListResult.java rename to eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/permission/PermissionPolicyListResult.java index 6dedc889..ef63b925 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/app/AppPermissionPolicyListResult.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/permission/PermissionPolicyListResult.java @@ -15,7 +15,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.console.pojo.result.app; +package cn.topiam.employee.console.pojo.result.permission; import cn.topiam.employee.common.enums.app.AppPolicyEffect; import cn.topiam.employee.common.enums.app.AppPolicyObjectType; @@ -33,7 +33,7 @@ import io.swagger.v3.oas.annotations.media.Schema; */ @Schema(description = "获取授权列表") @Data -public class AppPermissionPolicyListResult { +public class PermissionPolicyListResult { /** * ID */ diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/app/AppPermissionResourceGetResult.java b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/permission/PermissionResourceGetResult.java similarity index 95% rename from eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/app/AppPermissionResourceGetResult.java rename to eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/permission/PermissionResourceGetResult.java index db78ce5c..935fc308 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/app/AppPermissionResourceGetResult.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/permission/PermissionResourceGetResult.java @@ -15,7 +15,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.console.pojo.result.app; +package cn.topiam.employee.console.pojo.result.permission; import java.io.Serial; import java.io.Serializable; @@ -36,7 +36,7 @@ import io.swagger.v3.oas.annotations.media.Schema; */ @Schema(description = "获取资源结果") @Data -public class AppPermissionResourceGetResult implements Serializable { +public class PermissionResourceGetResult implements Serializable { /** * 名称 */ diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/app/AppPermissionResourceListResult.java b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/permission/PermissionResourceListResult.java similarity index 93% rename from eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/app/AppPermissionResourceListResult.java rename to eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/permission/PermissionResourceListResult.java index 208795e6..9bfd4e76 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/app/AppPermissionResourceListResult.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/permission/PermissionResourceListResult.java @@ -15,7 +15,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.console.pojo.result.app; +package cn.topiam.employee.console.pojo.result.permission; import java.io.Serial; import java.io.Serializable; @@ -35,7 +35,7 @@ import io.swagger.v3.oas.annotations.media.Schema; @Data @Accessors(chain = true) @Schema(description = "分页查询资源结果") -public class AppPermissionResourceListResult implements Serializable { +public class PermissionResourceListResult implements Serializable { @Serial private static final long serialVersionUID = 3320953184046791392L; diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/app/AppPermissionRoleListResult.java b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/permission/PermissionRoleListResult.java similarity index 94% rename from eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/app/AppPermissionRoleListResult.java rename to eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/permission/PermissionRoleListResult.java index 31c3bcbd..7eff2e24 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/app/AppPermissionRoleListResult.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/permission/PermissionRoleListResult.java @@ -15,7 +15,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.console.pojo.result.app; +package cn.topiam.employee.console.pojo.result.permission; import java.io.Serial; import java.io.Serializable; @@ -35,7 +35,7 @@ import io.swagger.v3.oas.annotations.media.Schema; @Data @Accessors(chain = true) @Schema(description = "分页查询角色结果") -public class AppPermissionRoleListResult implements Serializable { +public class PermissionRoleListResult implements Serializable { @Serial private static final long serialVersionUID = 3320953184046791392L; diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/app/AppPermissionRoleResult.java b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/permission/PermissionRoleResult.java similarity index 93% rename from eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/app/AppPermissionRoleResult.java rename to eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/permission/PermissionRoleResult.java index 6e5ccb1b..8d55e0ad 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/app/AppPermissionRoleResult.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/permission/PermissionRoleResult.java @@ -15,7 +15,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.console.pojo.result.app; +package cn.topiam.employee.console.pojo.result.permission; import java.io.Serializable; @@ -32,7 +32,7 @@ import io.swagger.v3.oas.annotations.media.Schema; */ @Schema(description = "获取角色") @Data -public class AppPermissionRoleResult implements Serializable { +public class PermissionRoleResult implements Serializable { /** * id */ diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/setting/SmsProviderConfigResult.java b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/setting/SmsProviderConfigResult.java similarity index 97% rename from eiam-console/src/main/java/cn/topiam/employee/console/pojo/setting/SmsProviderConfigResult.java rename to eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/setting/SmsProviderConfigResult.java index 90a658f0..5305bcfa 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/setting/SmsProviderConfigResult.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/setting/SmsProviderConfigResult.java @@ -15,7 +15,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.console.pojo.setting; +package cn.topiam.employee.console.pojo.result.setting; import java.io.Serial; import java.io.Serializable; diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/save/app/AppPermissionPolicyCreateParam.java b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/save/permission/PermissionPolicyCreateParam.java similarity index 95% rename from eiam-console/src/main/java/cn/topiam/employee/console/pojo/save/app/AppPermissionPolicyCreateParam.java rename to eiam-console/src/main/java/cn/topiam/employee/console/pojo/save/permission/PermissionPolicyCreateParam.java index c2be55c3..29df6b23 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/save/app/AppPermissionPolicyCreateParam.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/save/permission/PermissionPolicyCreateParam.java @@ -15,7 +15,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.console.pojo.save.app; +package cn.topiam.employee.console.pojo.save.permission; import java.io.Serializable; @@ -37,7 +37,7 @@ import jakarta.validation.constraints.NotNull; */ @Data @Schema(description = "创建策略入参") -public class AppPermissionPolicyCreateParam implements Serializable { +public class PermissionPolicyCreateParam implements Serializable { /** * 所属应用 diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/save/app/AppPermissionResourceCreateParam.java b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/save/permission/PermissionResourceCreateParam.java similarity index 89% rename from eiam-console/src/main/java/cn/topiam/employee/console/pojo/save/app/AppPermissionResourceCreateParam.java rename to eiam-console/src/main/java/cn/topiam/employee/console/pojo/save/permission/PermissionResourceCreateParam.java index 772be46d..f64fe0d4 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/save/app/AppPermissionResourceCreateParam.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/save/permission/PermissionResourceCreateParam.java @@ -15,7 +15,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.console.pojo.save.app; +package cn.topiam.employee.console.pojo.save.permission; import java.io.Serializable; import java.util.List; @@ -34,7 +34,7 @@ import jakarta.validation.constraints.NotNull; */ @Data @Schema(description = "创建资源入参") -public class AppPermissionResourceCreateParam implements Serializable { +public class PermissionResourceCreateParam implements Serializable { /** * 编码 */ @@ -70,6 +70,6 @@ public class AppPermissionResourceCreateParam implements Serializable { * 资源权限 */ @Schema(description = "资源权限") - @NotNull(message = "资源权限不能为空") - private List actions; + // @NotNull(message = "资源权限不能为空") + private List actions; } diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/save/app/AppPermissionRoleCreateParam.java b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/save/permission/PermissionRoleCreateParam.java similarity index 93% rename from eiam-console/src/main/java/cn/topiam/employee/console/pojo/save/app/AppPermissionRoleCreateParam.java rename to eiam-console/src/main/java/cn/topiam/employee/console/pojo/save/permission/PermissionRoleCreateParam.java index b0ef7fa4..da172ade 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/save/app/AppPermissionRoleCreateParam.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/save/permission/PermissionRoleCreateParam.java @@ -15,7 +15,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.console.pojo.save.app; +package cn.topiam.employee.console.pojo.save.permission; import java.io.Serializable; @@ -33,7 +33,7 @@ import jakarta.validation.constraints.NotNull; */ @Data @Schema(description = "创建角色入参") -public class AppPermissionRoleCreateParam implements Serializable { +public class PermissionRoleCreateParam implements Serializable { /** * 角色名称 */ diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/save/app/AppPermissionsActionParam.java b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/save/permission/PermissionsActionParam.java similarity index 93% rename from eiam-console/src/main/java/cn/topiam/employee/console/pojo/save/app/AppPermissionsActionParam.java rename to eiam-console/src/main/java/cn/topiam/employee/console/pojo/save/permission/PermissionsActionParam.java index 3730e4a2..1c64dd1c 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/save/app/AppPermissionsActionParam.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/save/permission/PermissionsActionParam.java @@ -15,7 +15,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.console.pojo.save.app; +package cn.topiam.employee.console.pojo.save.permission; import java.io.Serial; import java.io.Serializable; @@ -36,7 +36,7 @@ import jakarta.validation.constraints.NotNull; */ @Data @Valid -public class AppPermissionsActionParam implements Serializable { +public class PermissionsActionParam implements Serializable { @Serial private static final long serialVersionUID = -6391182747252245592L; diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/update/app/AppPermissionPolicyUpdateParam.java b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/update/permission/PermissionPolicyUpdateParam.java similarity index 95% rename from eiam-console/src/main/java/cn/topiam/employee/console/pojo/update/app/AppPermissionPolicyUpdateParam.java rename to eiam-console/src/main/java/cn/topiam/employee/console/pojo/update/permission/PermissionPolicyUpdateParam.java index c47a5615..9382280c 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/update/app/AppPermissionPolicyUpdateParam.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/update/permission/PermissionPolicyUpdateParam.java @@ -15,7 +15,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.console.pojo.update.app; +package cn.topiam.employee.console.pojo.update.permission; import java.io.Serializable; @@ -37,7 +37,7 @@ import jakarta.validation.constraints.NotNull; */ @Data @Schema(description = "修改策略入参") -public class AppPermissionPolicyUpdateParam implements Serializable { +public class PermissionPolicyUpdateParam implements Serializable { /** * 所属应用 */ diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/update/app/AppPermissionResourceUpdateParam.java b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/update/permission/PermissionResourceUpdateParam.java similarity index 90% rename from eiam-console/src/main/java/cn/topiam/employee/console/pojo/update/app/AppPermissionResourceUpdateParam.java rename to eiam-console/src/main/java/cn/topiam/employee/console/pojo/update/permission/PermissionResourceUpdateParam.java index 2765fc76..008eb59a 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/update/app/AppPermissionResourceUpdateParam.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/update/permission/PermissionResourceUpdateParam.java @@ -15,13 +15,13 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.console.pojo.update.app; +package cn.topiam.employee.console.pojo.update.permission; import java.io.Serial; import java.io.Serializable; import java.util.List; -import cn.topiam.employee.console.pojo.save.app.AppPermissionsActionParam; +import cn.topiam.employee.console.pojo.save.permission.PermissionsActionParam; import lombok.Data; @@ -38,7 +38,7 @@ import static io.swagger.v3.oas.annotations.media.Schema.AccessMode.READ_ONLY; */ @Data @Schema(description = "修改资源入参") -public class AppPermissionResourceUpdateParam implements Serializable { +public class PermissionResourceUpdateParam implements Serializable { @Serial private static final long serialVersionUID = 6021548372386059064L; /** @@ -87,5 +87,5 @@ public class AppPermissionResourceUpdateParam implements Serializable { */ @Schema(description = "资源权限") @NotNull(message = "资源权限不能为空") - private List actions; + private List actions; } diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/update/app/PermissionRoleUpdateParam.java b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/update/permission/PermissionRoleUpdateParam.java similarity index 96% rename from eiam-console/src/main/java/cn/topiam/employee/console/pojo/update/app/PermissionRoleUpdateParam.java rename to eiam-console/src/main/java/cn/topiam/employee/console/pojo/update/permission/PermissionRoleUpdateParam.java index 98a5c12d..855df4fe 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/update/app/PermissionRoleUpdateParam.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/update/permission/PermissionRoleUpdateParam.java @@ -15,7 +15,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.console.pojo.update.app; +package cn.topiam.employee.console.pojo.update.permission; import java.io.Serial; import java.io.Serializable; diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/service/app/AppPermissionActionService.java b/eiam-console/src/main/java/cn/topiam/employee/console/service/permission/PermissionActionService.java similarity index 68% rename from eiam-console/src/main/java/cn/topiam/employee/console/service/app/AppPermissionActionService.java rename to eiam-console/src/main/java/cn/topiam/employee/console/service/permission/PermissionActionService.java index 7d6bed67..bc6f375e 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/service/app/AppPermissionActionService.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/service/permission/PermissionActionService.java @@ -15,12 +15,12 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.console.service.app; +package cn.topiam.employee.console.service.permission; import java.util.List; -import cn.topiam.employee.console.pojo.query.app.AppPermissionActionListQuery; -import cn.topiam.employee.console.pojo.result.app.AppPermissionActionListResult; +import cn.topiam.employee.console.pojo.query.permission.PermissionActionListQuery; +import cn.topiam.employee.console.pojo.result.permission.PermissionActionListResult; /** *

@@ -30,14 +30,14 @@ import cn.topiam.employee.console.pojo.result.app.AppPermissionActionListResult; * @author TopIAM * Created by support@topiam.cn on 2020-08-10 */ -public interface AppPermissionActionService { +public interface PermissionActionService { /** * 获取资源权限列表 * - * @param query {@link AppPermissionActionListQuery} - * @return {@link AppPermissionActionListResult} + * @param query {@link PermissionActionListQuery} + * @return {@link PermissionActionListResult} */ - List getPermissionActionList(AppPermissionActionListQuery query); + List getPermissionActionList(PermissionActionListQuery query); } diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/service/app/AppPermissionPolicyService.java b/eiam-console/src/main/java/cn/topiam/employee/console/service/permission/PermissionPolicyService.java similarity index 61% rename from eiam-console/src/main/java/cn/topiam/employee/console/service/app/AppPermissionPolicyService.java rename to eiam-console/src/main/java/cn/topiam/employee/console/service/permission/PermissionPolicyService.java index e27934fb..6eec5049 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/service/app/AppPermissionPolicyService.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/service/permission/PermissionPolicyService.java @@ -15,13 +15,13 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.console.service.app; +package cn.topiam.employee.console.service.permission; import cn.topiam.employee.common.entity.app.query.AppPolicyQuery; -import cn.topiam.employee.console.pojo.result.app.AppPermissionPolicyGetResult; -import cn.topiam.employee.console.pojo.result.app.AppPermissionPolicyListResult; -import cn.topiam.employee.console.pojo.save.app.AppPermissionPolicyCreateParam; -import cn.topiam.employee.console.pojo.update.app.AppPermissionPolicyUpdateParam; +import cn.topiam.employee.console.pojo.result.permission.PermissionPolicyGetResult; +import cn.topiam.employee.console.pojo.result.permission.PermissionPolicyListResult; +import cn.topiam.employee.console.pojo.save.permission.PermissionPolicyCreateParam; +import cn.topiam.employee.console.pojo.update.permission.PermissionPolicyUpdateParam; import cn.topiam.employee.support.repository.page.domain.Page; import cn.topiam.employee.support.repository.page.domain.PageModel; @@ -33,24 +33,24 @@ import cn.topiam.employee.support.repository.page.domain.PageModel; * @author TopIAM * Created by support@topiam.cn on 2020-08-10 */ -public interface AppPermissionPolicyService { +public interface PermissionPolicyService { /** * 获取资源列表 * * @param page {@link PageModel} * @param query {@link AppPolicyQuery} - * @return {@link AppPermissionPolicyListResult} + * @return {@link PermissionPolicyListResult} */ - Page getPermissionPolicyList(PageModel page, - AppPolicyQuery query); + Page getPermissionPolicyList(PageModel page, + AppPolicyQuery query); /** * 获取资源 * * @param id {@link String} - * @return {@link AppPermissionPolicyGetResult} + * @return {@link PermissionPolicyGetResult} */ - AppPermissionPolicyGetResult getPermissionPolicy(String id); + PermissionPolicyGetResult getPermissionPolicy(String id); /** * 删除资源 @@ -63,16 +63,16 @@ public interface AppPermissionPolicyService { /** * 创建资源 * - * @param param {@link AppPermissionPolicyCreateParam} + * @param param {@link PermissionPolicyCreateParam} * @return {@link Boolean} */ - Boolean createPermissionPolicy(AppPermissionPolicyCreateParam param); + Boolean createPermissionPolicy(PermissionPolicyCreateParam param); /** * 更新资源 * - * @param param {@link AppPermissionPolicyUpdateParam} + * @param param {@link PermissionPolicyUpdateParam} * @return {@link Boolean} */ - Boolean updatePermissionPolicy(AppPermissionPolicyUpdateParam param); + Boolean updatePermissionPolicy(PermissionPolicyUpdateParam param); } diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/service/app/AppPermissionResourceService.java b/eiam-console/src/main/java/cn/topiam/employee/console/service/permission/PermissionResourceService.java similarity index 66% rename from eiam-console/src/main/java/cn/topiam/employee/console/service/app/AppPermissionResourceService.java rename to eiam-console/src/main/java/cn/topiam/employee/console/service/permission/PermissionResourceService.java index c93d88b3..19ae316e 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/service/app/AppPermissionResourceService.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/service/permission/PermissionResourceService.java @@ -15,14 +15,14 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.console.service.app; +package cn.topiam.employee.console.service.permission; import cn.topiam.employee.common.enums.CheckValidityType; -import cn.topiam.employee.console.pojo.query.app.AppResourceListQuery; -import cn.topiam.employee.console.pojo.result.app.AppPermissionResourceGetResult; -import cn.topiam.employee.console.pojo.result.app.AppPermissionResourceListResult; -import cn.topiam.employee.console.pojo.save.app.AppPermissionResourceCreateParam; -import cn.topiam.employee.console.pojo.update.app.AppPermissionResourceUpdateParam; +import cn.topiam.employee.console.pojo.query.permission.PermissionResourceListQuery; +import cn.topiam.employee.console.pojo.result.permission.PermissionResourceGetResult; +import cn.topiam.employee.console.pojo.result.permission.PermissionResourceListResult; +import cn.topiam.employee.console.pojo.save.permission.PermissionResourceCreateParam; +import cn.topiam.employee.console.pojo.update.permission.PermissionResourceUpdateParam; import cn.topiam.employee.support.repository.page.domain.Page; import cn.topiam.employee.support.repository.page.domain.PageModel; @@ -34,24 +34,24 @@ import cn.topiam.employee.support.repository.page.domain.PageModel; * @author TopIAM * Created by support@topiam.cn on 2020-08-10 */ -public interface AppPermissionResourceService { +public interface PermissionResourceService { /** * 获取资源列表 * * @param page {@link PageModel} - * @param query {@link AppResourceListQuery} - * @return {@link AppPermissionResourceListResult} + * @param query {@link PermissionResourceListQuery} + * @return {@link PermissionResourceListResult} */ - Page getPermissionResourceList(PageModel page, - AppResourceListQuery query); + Page getPermissionResourceList(PageModel page, + PermissionResourceListQuery query); /** * 获取资源 * * @param id {@link String} - * @return {@link AppPermissionResourceGetResult} + * @return {@link PermissionResourceGetResult} */ - AppPermissionResourceGetResult getPermissionResource(String id); + PermissionResourceGetResult getPermissionResource(String id); /** * 删除资源 @@ -73,18 +73,18 @@ public interface AppPermissionResourceService { /** * 创建资源 * - * @param param {@link AppPermissionResourceCreateParam} + * @param param {@link PermissionResourceCreateParam} * @return {@link Boolean} */ - Boolean createPermissionResource(AppPermissionResourceCreateParam param); + Boolean createPermissionResource(PermissionResourceCreateParam param); /** * 更新资源 * - * @param param {@link AppPermissionResourceUpdateParam} + * @param param {@link PermissionResourceUpdateParam} * @return {@link Boolean} */ - Boolean updatePermissionResource(AppPermissionResourceUpdateParam param); + Boolean updatePermissionResource(PermissionResourceUpdateParam param); /** * 参数有效性验证 diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/service/app/AppPermissionRoleService.java b/eiam-console/src/main/java/cn/topiam/employee/console/service/permission/PermissionRoleService.java similarity index 69% rename from eiam-console/src/main/java/cn/topiam/employee/console/service/app/AppPermissionRoleService.java rename to eiam-console/src/main/java/cn/topiam/employee/console/service/permission/PermissionRoleService.java index 707d0648..b33618fa 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/service/app/AppPermissionRoleService.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/service/permission/PermissionRoleService.java @@ -15,14 +15,14 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.console.service.app; +package cn.topiam.employee.console.service.permission; import cn.topiam.employee.common.enums.CheckValidityType; -import cn.topiam.employee.console.pojo.query.app.AppPermissionRoleListQuery; -import cn.topiam.employee.console.pojo.result.app.AppPermissionRoleListResult; -import cn.topiam.employee.console.pojo.result.app.AppPermissionRoleResult; -import cn.topiam.employee.console.pojo.save.app.AppPermissionRoleCreateParam; -import cn.topiam.employee.console.pojo.update.app.PermissionRoleUpdateParam; +import cn.topiam.employee.console.pojo.query.permission.PermissionRoleListQuery; +import cn.topiam.employee.console.pojo.result.permission.PermissionRoleListResult; +import cn.topiam.employee.console.pojo.result.permission.PermissionRoleResult; +import cn.topiam.employee.console.pojo.save.permission.PermissionRoleCreateParam; +import cn.topiam.employee.console.pojo.update.permission.PermissionRoleUpdateParam; import cn.topiam.employee.support.repository.page.domain.Page; import cn.topiam.employee.support.repository.page.domain.PageModel; @@ -34,25 +34,25 @@ import cn.topiam.employee.support.repository.page.domain.PageModel; * @author TopIAM * Created by support@topiam.cn on 2020-08-10 */ -public interface AppPermissionRoleService { +public interface PermissionRoleService { /** * 获取所有角色(分页) * * @param page {@link PageModel} - * @param query {@link AppPermissionRoleListQuery} - * @return {@link AppPermissionRoleListResult} + * @param query {@link PermissionRoleListQuery} + * @return {@link PermissionRoleListResult} */ - Page getPermissionRoleList(PageModel page, - AppPermissionRoleListQuery query); + Page getPermissionRoleList(PageModel page, + PermissionRoleListQuery query); /** * 创建角色 * - * @param param {@link AppPermissionRoleCreateParam} + * @param param {@link PermissionRoleCreateParam} * @return {@link Boolean} */ - boolean createPermissionRole(AppPermissionRoleCreateParam param); + boolean createPermissionRole(PermissionRoleCreateParam param); /** * 更新角色 @@ -74,9 +74,9 @@ public interface AppPermissionRoleService { * 角色详情 * * @param id {@link Long} - * @return {@link AppPermissionRoleResult} + * @return {@link PermissionRoleResult} */ - AppPermissionRoleResult getPermissionRole(Long id); + PermissionRoleResult getPermissionRole(Long id); /** * 参数有效性验证 diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/service/app/impl/AppPermissionActionServiceImpl.java b/eiam-console/src/main/java/cn/topiam/employee/console/service/permission/impl/PermissionActionServiceImpl.java similarity index 54% rename from eiam-console/src/main/java/cn/topiam/employee/console/service/app/impl/AppPermissionActionServiceImpl.java rename to eiam-console/src/main/java/cn/topiam/employee/console/service/permission/impl/PermissionActionServiceImpl.java index 39dd8300..e4220d5a 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/service/app/impl/AppPermissionActionServiceImpl.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/service/permission/impl/PermissionActionServiceImpl.java @@ -15,20 +15,20 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.console.service.app.impl; +package cn.topiam.employee.console.service.permission.impl; import java.util.List; +import cn.topiam.employee.common.entity.permission.PermissionResourceEntity; +import cn.topiam.employee.console.converter.permission.PermissionActionConverter; import org.springframework.stereotype.Service; import com.querydsl.core.types.Predicate; -import cn.topiam.employee.common.entity.app.AppPermissionResourceEntity; -import cn.topiam.employee.common.repository.app.AppPermissionResourceRepository; -import cn.topiam.employee.console.converter.app.AppPermissionActionConverter; -import cn.topiam.employee.console.pojo.query.app.AppPermissionActionListQuery; -import cn.topiam.employee.console.pojo.result.app.AppPermissionActionListResult; -import cn.topiam.employee.console.service.app.AppPermissionActionService; +import cn.topiam.employee.common.repository.permission.AppPermissionResourceRepository; +import cn.topiam.employee.console.pojo.query.permission.PermissionActionListQuery; +import cn.topiam.employee.console.pojo.result.permission.PermissionActionListResult; +import cn.topiam.employee.console.service.permission.PermissionActionService; import lombok.RequiredArgsConstructor; @@ -42,24 +42,24 @@ import lombok.RequiredArgsConstructor; */ @Service @RequiredArgsConstructor -public class AppPermissionActionServiceImpl implements AppPermissionActionService { +public class PermissionActionServiceImpl implements PermissionActionService { /** * 获取资源列表 * - * @param query {@link AppPermissionActionListQuery} - * @return {@link AppPermissionActionListResult} + * @param query {@link PermissionActionListQuery} + * @return {@link PermissionActionListResult} */ @Override - public List getPermissionActionList(AppPermissionActionListQuery query) { - Predicate predicate = appPermissionActionConverter + public List getPermissionActionList(PermissionActionListQuery query) { + Predicate predicate = permissionActionConverter .appPermissionActionListQueryConvertToPredicate(query); - List list = (List) appPermissionResourceRepository + List list = (List) appPermissionResourceRepository .findAll(predicate); - return appPermissionActionConverter.entityConvertToResourceActionListResult(list); + return permissionActionConverter.entityConvertToResourceActionListResult(list); } private final AppPermissionResourceRepository appPermissionResourceRepository; - private final AppPermissionActionConverter appPermissionActionConverter; + private final PermissionActionConverter permissionActionConverter; } diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/service/app/impl/AppPermissionPolicyServiceImpl.java b/eiam-console/src/main/java/cn/topiam/employee/console/service/permission/impl/PermissionPolicyServiceImpl.java similarity index 62% rename from eiam-console/src/main/java/cn/topiam/employee/console/service/app/impl/AppPermissionPolicyServiceImpl.java rename to eiam-console/src/main/java/cn/topiam/employee/console/service/permission/impl/PermissionPolicyServiceImpl.java index 280cd110..d5759175 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/service/app/impl/AppPermissionPolicyServiceImpl.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/service/permission/impl/PermissionPolicyServiceImpl.java @@ -15,23 +15,23 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.console.service.app.impl; +package cn.topiam.employee.console.service.permission.impl; +import cn.topiam.employee.console.pojo.result.permission.PermissionPolicyListResult; +import cn.topiam.employee.console.pojo.save.permission.PermissionPolicyCreateParam; import org.springframework.data.querydsl.QPageRequest; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import cn.topiam.employee.common.entity.app.AppPermissionPolicyEntity; -import cn.topiam.employee.common.entity.app.po.AppPermissionPolicyPO; import cn.topiam.employee.common.entity.app.query.AppPolicyQuery; +import cn.topiam.employee.common.entity.permission.PermissionPolicyEntity; +import cn.topiam.employee.common.entity.permission.po.PermissionPolicyPO; import cn.topiam.employee.common.exception.app.AppPolicyNotExistException; -import cn.topiam.employee.common.repository.app.AppPermissionPolicyRepository; -import cn.topiam.employee.console.converter.app.AppPermissionPolicyConverter; -import cn.topiam.employee.console.pojo.result.app.AppPermissionPolicyGetResult; -import cn.topiam.employee.console.pojo.result.app.AppPermissionPolicyListResult; -import cn.topiam.employee.console.pojo.save.app.AppPermissionPolicyCreateParam; -import cn.topiam.employee.console.pojo.update.app.AppPermissionPolicyUpdateParam; -import cn.topiam.employee.console.service.app.AppPermissionPolicyService; +import cn.topiam.employee.common.repository.permission.AppPermissionPolicyRepository; +import cn.topiam.employee.console.converter.permission.PermissionPolicyConverter; +import cn.topiam.employee.console.pojo.result.permission.PermissionPolicyGetResult; +import cn.topiam.employee.console.pojo.update.permission.PermissionPolicyUpdateParam; +import cn.topiam.employee.console.service.permission.PermissionPolicyService; import cn.topiam.employee.support.repository.page.domain.Page; import cn.topiam.employee.support.repository.page.domain.PageModel; @@ -47,32 +47,32 @@ import lombok.RequiredArgsConstructor; */ @Service @RequiredArgsConstructor -public class AppPermissionPolicyServiceImpl implements AppPermissionPolicyService { +public class PermissionPolicyServiceImpl implements PermissionPolicyService { /** * 获取策略列表 * * @param page {@link PageModel} * @param query {@link AppPolicyQuery} - * @return {@link AppPermissionPolicyListResult} + * @return {@link PermissionPolicyListResult} */ @Override - public Page getPermissionPolicyList(PageModel page, - AppPolicyQuery query) { - org.springframework.data.domain.Page data; + public Page getPermissionPolicyList(PageModel page, + AppPolicyQuery query) { + org.springframework.data.domain.Page data; QPageRequest request = QPageRequest.of(page.getCurrent(), page.getPageSize()); data = appPermissionPolicyRepository.findPage(query, request); - return appPermissionPolicyConverter.entityConvertToPolicyListResult(data); + return permissionPolicyConverter.entityConvertToPolicyListResult(data); } /** * 获取策略 * * @param id {@link String} - * @return {@link AppPermissionPolicyGetResult} + * @return {@link PermissionPolicyGetResult} */ @Override - public AppPermissionPolicyGetResult getPermissionPolicy(String id) { + public PermissionPolicyGetResult getPermissionPolicy(String id) { return null; } @@ -94,13 +94,13 @@ public class AppPermissionPolicyServiceImpl implements AppPermissionPolicyServic /** * 创建策略 * - * @param param {@link AppPermissionPolicyCreateParam} + * @param param {@link PermissionPolicyCreateParam} * @return {@link Boolean} */ @Override @Transactional(rollbackFor = Exception.class) - public Boolean createPermissionPolicy(AppPermissionPolicyCreateParam param) { - AppPermissionPolicyEntity resource = appPermissionPolicyConverter + public Boolean createPermissionPolicy(PermissionPolicyCreateParam param) { + PermissionPolicyEntity resource = permissionPolicyConverter .policyCreateParamConvertToEntity(param); // 新增策略 appPermissionPolicyRepository.save(resource); @@ -110,19 +110,19 @@ public class AppPermissionPolicyServiceImpl implements AppPermissionPolicyServic /** * 更新策略 * - * @param param {@link AppPermissionPolicyUpdateParam} + * @param param {@link PermissionPolicyUpdateParam} * @return {@link Boolean} */ @Override - public Boolean updatePermissionPolicy(AppPermissionPolicyUpdateParam param) { - AppPermissionPolicyEntity resource = appPermissionPolicyConverter + public Boolean updatePermissionPolicy(PermissionPolicyUpdateParam param) { + PermissionPolicyEntity resource = permissionPolicyConverter .policyUpdateParamConvertToEntity(param); // 更新策略 appPermissionPolicyRepository.save(resource); return null; } - private final AppPermissionPolicyConverter appPermissionPolicyConverter; + private final PermissionPolicyConverter permissionPolicyConverter; private final AppPermissionPolicyRepository appPermissionPolicyRepository; } diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/service/app/impl/AppPermissionResourceServiceImpl.java b/eiam-console/src/main/java/cn/topiam/employee/console/service/permission/impl/PermissionResourceServiceImpl.java similarity index 67% rename from eiam-console/src/main/java/cn/topiam/employee/console/service/app/impl/AppPermissionResourceServiceImpl.java rename to eiam-console/src/main/java/cn/topiam/employee/console/service/permission/impl/PermissionResourceServiceImpl.java index b4ae401a..5e274505 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/service/app/impl/AppPermissionResourceServiceImpl.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/service/permission/impl/PermissionResourceServiceImpl.java @@ -15,7 +15,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.console.service.app.impl; +package cn.topiam.employee.console.service.permission.impl; import java.util.ArrayList; import java.util.List; @@ -23,6 +23,12 @@ import java.util.Objects; import java.util.Set; import java.util.stream.Collectors; +import cn.topiam.employee.common.entity.permission.PermissionActionEntity; +import cn.topiam.employee.common.entity.permission.PermissionResourceEntity; +import cn.topiam.employee.console.pojo.result.permission.PermissionResourceGetResult; +import cn.topiam.employee.console.pojo.result.permission.PermissionResourceListResult; +import cn.topiam.employee.console.pojo.save.permission.PermissionResourceCreateParam; +import cn.topiam.employee.console.pojo.update.permission.PermissionResourceUpdateParam; import org.apache.commons.lang3.StringUtils; import org.springframework.data.querydsl.QPageRequest; import org.springframework.stereotype.Service; @@ -34,22 +40,16 @@ import com.querydsl.core.types.dsl.BooleanExpression; import cn.topiam.employee.audit.context.AuditContext; import cn.topiam.employee.audit.entity.Target; import cn.topiam.employee.audit.enums.TargetType; -import cn.topiam.employee.common.entity.app.AppPermissionActionEntity; -import cn.topiam.employee.common.entity.app.AppPermissionResourceEntity; import cn.topiam.employee.common.entity.app.QAppPermissionResourceEntity; import cn.topiam.employee.common.enums.CheckValidityType; import cn.topiam.employee.common.exception.app.AppResourceNotExistException; -import cn.topiam.employee.common.repository.app.AppPermissionActionRepository; -import cn.topiam.employee.common.repository.app.AppPermissionPolicyRepository; -import cn.topiam.employee.common.repository.app.AppPermissionResourceRepository; -import cn.topiam.employee.console.converter.app.AppPermissionResourceConverter; -import cn.topiam.employee.console.pojo.query.app.AppResourceListQuery; -import cn.topiam.employee.console.pojo.result.app.AppPermissionResourceGetResult; -import cn.topiam.employee.console.pojo.result.app.AppPermissionResourceListResult; -import cn.topiam.employee.console.pojo.save.app.AppPermissionResourceCreateParam; -import cn.topiam.employee.console.pojo.save.app.AppPermissionsActionParam; -import cn.topiam.employee.console.pojo.update.app.AppPermissionResourceUpdateParam; -import cn.topiam.employee.console.service.app.AppPermissionResourceService; +import cn.topiam.employee.common.repository.permission.AppPermissionActionRepository; +import cn.topiam.employee.common.repository.permission.AppPermissionPolicyRepository; +import cn.topiam.employee.common.repository.permission.AppPermissionResourceRepository; +import cn.topiam.employee.console.converter.permission.PermissionResourceConverter; +import cn.topiam.employee.console.pojo.query.permission.PermissionResourceListQuery; +import cn.topiam.employee.console.pojo.save.permission.PermissionsActionParam; +import cn.topiam.employee.console.service.permission.PermissionResourceService; import cn.topiam.employee.support.exception.BadParamsException; import cn.topiam.employee.support.repository.page.domain.Page; import cn.topiam.employee.support.repository.page.domain.PageModel; @@ -69,37 +69,37 @@ import static cn.topiam.employee.support.repository.domain.BaseEntity.LAST_MODIF */ @Service @RequiredArgsConstructor -public class AppPermissionResourceServiceImpl implements AppPermissionResourceService { +public class PermissionResourceServiceImpl implements PermissionResourceService { /** * 获取资源列表 * * @param page {@link PageModel} - * @param query {@link AppResourceListQuery} - * @return {@link AppPermissionResourceListResult} + * @param query {@link PermissionResourceListQuery} + * @return {@link PermissionResourceListResult} */ @Override - public Page getPermissionResourceList(PageModel page, - AppResourceListQuery query) { - org.springframework.data.domain.Page data; - Predicate predicate = appPermissionResourceConverter + public Page getPermissionResourceList(PageModel page, + PermissionResourceListQuery query) { + org.springframework.data.domain.Page data; + Predicate predicate = permissionResourceConverter .resourcePaginationParamConvertToPredicate(query); QPageRequest request = QPageRequest.of(page.getCurrent(), page.getPageSize()); data = appResourceRepository.findAll(predicate, request); - return appPermissionResourceConverter.entityConvertToResourceListResult(data); + return permissionResourceConverter.entityConvertToResourceListResult(data); } /** * 获取资源 * * @param id {@link String} - * @return {@link AppPermissionResourceGetResult} + * @return {@link PermissionResourceGetResult} */ @Override - public AppPermissionResourceGetResult getPermissionResource(String id) { - AppPermissionResourceEntity resource = appResourceRepository.findById(Long.valueOf(id)) + public PermissionResourceGetResult getPermissionResource(String id) { + PermissionResourceEntity resource = appResourceRepository.findById(Long.valueOf(id)) .orElseThrow(AppResourceNotExistException::new); - return appPermissionResourceConverter.entityConvertToResourceGetResult(resource); + return permissionResourceConverter.entityConvertToResourceGetResult(resource); } /** @@ -112,12 +112,12 @@ public class AppPermissionResourceServiceImpl implements AppPermissionResourceSe @Transactional(rollbackFor = Exception.class) public Boolean deletePermissionResource(String id) { Long resourceId = Long.valueOf(id); - AppPermissionResourceEntity resource = appResourceRepository.findById(resourceId) + PermissionResourceEntity resource = appResourceRepository.findById(resourceId) .orElseThrow(AppResourceNotExistException::new); - List actionList = appPermissionActionRepository + List actionList = appPermissionActionRepository .findAllByResource(resource); List objectIdList = new ArrayList<>( - actionList.stream().map(AppPermissionActionEntity::getId).toList()); + actionList.stream().map(PermissionActionEntity::getId).toList()); objectIdList.add(resourceId); appPermissionPolicyRepository.deleteAllByObjectIdIn(objectIdList); appResourceRepository.deleteById(resourceId); @@ -135,7 +135,7 @@ public class AppPermissionResourceServiceImpl implements AppPermissionResourceSe */ @Override public Boolean updateStatus(Long id, boolean enabled) { - AppPermissionResourceEntity resource = appResourceRepository.findById(Long.valueOf(id)) + PermissionResourceEntity resource = appResourceRepository.findById(Long.valueOf(id)) .orElseThrow(AppResourceNotExistException::new); AuditContext.setTarget( Target.builder().id(id.toString()).type(TargetType.APP_PERMISSION_RESOURCE).build()); @@ -145,13 +145,13 @@ public class AppPermissionResourceServiceImpl implements AppPermissionResourceSe /** * 创建资源 * - * @param param {@link AppPermissionResourceCreateParam} + * @param param {@link PermissionResourceCreateParam} * @return {@link Boolean} */ @Override @Transactional(rollbackFor = Exception.class) - public Boolean createPermissionResource(AppPermissionResourceCreateParam param) { - AppPermissionResourceEntity resource = appPermissionResourceConverter + public Boolean createPermissionResource(PermissionResourceCreateParam param) { + PermissionResourceEntity resource = permissionResourceConverter .resourceCreateParamConvertToEntity(param); buildActions(param.getActions(), resource); // 新增资源 @@ -164,28 +164,28 @@ public class AppPermissionResourceServiceImpl implements AppPermissionResourceSe /** * 更新资源 * - * @param param {@link AppPermissionResourceUpdateParam} + * @param param {@link PermissionResourceUpdateParam} * @return {@link Boolean} */ @Override @Transactional(rollbackFor = Exception.class) - public Boolean updatePermissionResource(AppPermissionResourceUpdateParam param) { - AppPermissionResourceEntity resource = appPermissionResourceConverter + public Boolean updatePermissionResource(PermissionResourceUpdateParam param) { + PermissionResourceEntity resource = permissionResourceConverter .resourceUpdateParamConvertToEntity(param); - AppPermissionResourceEntity entity = getAppPermissionResourceEntity( + PermissionResourceEntity entity = getAppPermissionResourceEntity( Long.valueOf(param.getId())); buildActions(param.getActions(), resource); BeanUtils.merge(resource, entity, LAST_MODIFIED_BY, LAST_MODIFIED_TIME); // 查询资源下所有权限 - List actionList = appPermissionActionRepository + List actionList = appPermissionActionRepository .findAllByResource(resource); // 取出未删除的权限id - Set reservedSet = resource.getActions().stream().map(AppPermissionActionEntity::getId) + Set reservedSet = resource.getActions().stream().map(PermissionActionEntity::getId) .collect(Collectors.toSet()); // 过滤要删除的权限id List removeActions = actionList.stream() .filter(item -> !reservedSet.contains(item.getId())) - .map(AppPermissionActionEntity::getId).toList(); + .map(PermissionActionEntity::getId).toList(); appPermissionActionRepository.deleteAllById(removeActions); // 更新资源 appResourceRepository.save(entity); @@ -198,9 +198,9 @@ public class AppPermissionResourceServiceImpl implements AppPermissionResourceSe * 获取应用权限资源 * * @param id {@link Long} - * @return {@link AppPermissionResourceEntity} + * @return {@link PermissionResourceEntity} */ - private AppPermissionResourceEntity getAppPermissionResourceEntity(Long id) { + private PermissionResourceEntity getAppPermissionResourceEntity(Long id) { return appResourceRepository.findById(id) .orElseThrow(() -> new BadParamsException("应用权限资源不存在")); } @@ -219,7 +219,7 @@ public class AppPermissionResourceServiceImpl implements AppPermissionResourceSe public Boolean permissionResourceParamCheck(CheckValidityType type, String value, Long appId, Long id) { QAppPermissionResourceEntity role = QAppPermissionResourceEntity.appPermissionResourceEntity; - AppPermissionResourceEntity entity = new AppPermissionResourceEntity(); + PermissionResourceEntity entity = new PermissionResourceEntity(); boolean result = false; // ID存在说明是修改操作,查询一下当前数据 if (Objects.nonNull(id)) { @@ -248,15 +248,15 @@ public class AppPermissionResourceServiceImpl implements AppPermissionResourceSe /** * 批量处理actions * - * @param permissions {@link List} - * @param resource {@link AppPermissionResourceEntity>} + * @param permissions {@link List< PermissionsActionParam >} + * @param resource {@link PermissionResourceEntity >} */ - private void buildActions(List permissions, - AppPermissionResourceEntity resource) { + private void buildActions(List permissions, + PermissionResourceEntity resource) { // 权限 - List list = new ArrayList<>(); - for (AppPermissionsActionParam p : permissions) { - AppPermissionActionEntity entity = new AppPermissionActionEntity(); + List list = new ArrayList<>(); + for (PermissionsActionParam p : permissions) { + PermissionActionEntity entity = new PermissionActionEntity(); entity.setResource(resource); entity.setType(p.getType()); entity.setName(p.getName()); @@ -267,7 +267,7 @@ public class AppPermissionResourceServiceImpl implements AppPermissionResourceSe resource.setActions(list); } - private final AppPermissionResourceConverter appPermissionResourceConverter; + private final PermissionResourceConverter permissionResourceConverter; private final AppPermissionResourceRepository appResourceRepository; /** diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/service/app/impl/AppPermissionRoleServiceImpl.java b/eiam-console/src/main/java/cn/topiam/employee/console/service/permission/impl/PermissionRoleServiceImpl.java similarity index 75% rename from eiam-console/src/main/java/cn/topiam/employee/console/service/app/impl/AppPermissionRoleServiceImpl.java rename to eiam-console/src/main/java/cn/topiam/employee/console/service/permission/impl/PermissionRoleServiceImpl.java index 0864b2be..23fd1101 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/service/app/impl/AppPermissionRoleServiceImpl.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/service/permission/impl/PermissionRoleServiceImpl.java @@ -15,13 +15,17 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.console.service.app.impl; +package cn.topiam.employee.console.service.permission.impl; import java.util.Arrays; import java.util.List; import java.util.Objects; import java.util.Optional; +import cn.topiam.employee.console.converter.permission.PermissionRoleConverter; +import cn.topiam.employee.console.pojo.result.permission.PermissionRoleListResult; +import cn.topiam.employee.console.pojo.result.permission.PermissionRoleResult; +import cn.topiam.employee.console.pojo.save.permission.PermissionRoleCreateParam; import org.apache.commons.lang3.StringUtils; import org.springframework.data.querydsl.QPageRequest; import org.springframework.stereotype.Service; @@ -33,19 +37,15 @@ import com.querydsl.core.types.dsl.BooleanExpression; import cn.topiam.employee.audit.context.AuditContext; import cn.topiam.employee.audit.entity.Target; import cn.topiam.employee.audit.enums.TargetType; -import cn.topiam.employee.common.entity.app.AppPermissionRoleEntity; import cn.topiam.employee.common.entity.app.QAppPermissionRoleEntity; +import cn.topiam.employee.common.entity.permission.PermissionRoleEntity; import cn.topiam.employee.common.enums.CheckValidityType; import cn.topiam.employee.common.exception.app.AppRoleNotExistException; -import cn.topiam.employee.common.repository.app.AppPermissionPolicyRepository; -import cn.topiam.employee.common.repository.app.AppPermissionRoleRepository; -import cn.topiam.employee.console.converter.app.AppPermissionRoleConverter; -import cn.topiam.employee.console.pojo.query.app.AppPermissionRoleListQuery; -import cn.topiam.employee.console.pojo.result.app.AppPermissionRoleListResult; -import cn.topiam.employee.console.pojo.result.app.AppPermissionRoleResult; -import cn.topiam.employee.console.pojo.save.app.AppPermissionRoleCreateParam; -import cn.topiam.employee.console.pojo.update.app.PermissionRoleUpdateParam; -import cn.topiam.employee.console.service.app.AppPermissionRoleService; +import cn.topiam.employee.common.repository.permission.AppPermissionPolicyRepository; +import cn.topiam.employee.common.repository.permission.AppPermissionRoleRepository; +import cn.topiam.employee.console.pojo.query.permission.PermissionRoleListQuery; +import cn.topiam.employee.console.pojo.update.permission.PermissionRoleUpdateParam; +import cn.topiam.employee.console.service.permission.PermissionRoleService; import cn.topiam.employee.support.repository.page.domain.Page; import cn.topiam.employee.support.repository.page.domain.PageModel; import cn.topiam.employee.support.util.BeanUtils; @@ -64,34 +64,34 @@ import static cn.topiam.employee.support.repository.domain.BaseEntity.LAST_MODIF */ @Service @RequiredArgsConstructor -public class AppPermissionRoleServiceImpl implements AppPermissionRoleService { +public class PermissionRoleServiceImpl implements PermissionRoleService { /** * 获取所有角色(分页) * * @param page {@link PageModel} - * @return {@link AppPermissionRoleListResult} + * @return {@link PermissionRoleListResult} */ @Override - public Page getPermissionRoleList(PageModel page, - AppPermissionRoleListQuery query) { - org.springframework.data.domain.Page data; - Predicate predicate = appPermissionRoleConverter + public Page getPermissionRoleList(PageModel page, + PermissionRoleListQuery query) { + org.springframework.data.domain.Page data; + Predicate predicate = permissionRoleConverter .rolePaginationParamConvertToPredicate(query); QPageRequest request = QPageRequest.of(page.getCurrent(), page.getPageSize()); data = appPermissionRoleRepository.findAll(predicate, request); - return appPermissionRoleConverter.entityConvertToRolePaginationResult(data); + return permissionRoleConverter.entityConvertToRolePaginationResult(data); } /** * 创建系统 * - * @param param {@link AppPermissionRoleCreateParam} + * @param param {@link PermissionRoleCreateParam} * @return {@link Boolean} */ @Override - public boolean createPermissionRole(AppPermissionRoleCreateParam param) { - AppPermissionRoleEntity entity = appPermissionRoleConverter + public boolean createPermissionRole(PermissionRoleCreateParam param) { + PermissionRoleEntity entity = permissionRoleConverter .roleCreateParamConvertToEntity(param); appPermissionRoleRepository.save(entity); AuditContext.setTarget(Target.builder().id(entity.getId().toString()) @@ -105,9 +105,9 @@ public class AppPermissionRoleServiceImpl implements AppPermissionRoleService { */ @Override public boolean updatePermissionRole(PermissionRoleUpdateParam param) { - AppPermissionRoleEntity source = appPermissionRoleConverter + PermissionRoleEntity source = permissionRoleConverter .roleUpdateParamConvertToEntity(param); - AppPermissionRoleEntity target = appPermissionRoleRepository + PermissionRoleEntity target = appPermissionRoleRepository .findById(Long.valueOf(param.getId())).orElseThrow(AppRoleNotExistException::new); BeanUtils.merge(source, target, LAST_MODIFIED_TIME, LAST_MODIFIED_BY); appPermissionRoleRepository.save(target); @@ -140,14 +140,14 @@ public class AppPermissionRoleServiceImpl implements AppPermissionRoleService { * 角色详情 * * @param id {@link Long} - * @return {@link AppPermissionRoleResult} + * @return {@link PermissionRoleResult} */ @Override - public AppPermissionRoleResult getPermissionRole(Long id) { + public PermissionRoleResult getPermissionRole(Long id) { //查询 - Optional entity = appPermissionRoleRepository.findById(id); + Optional entity = appPermissionRoleRepository.findById(id); //映射 - return appPermissionRoleConverter.entityConvertToRoleDetailResult(entity.orElse(null)); + return permissionRoleConverter.entityConvertToRoleDetailResult(entity.orElse(null)); } /** @@ -164,7 +164,7 @@ public class AppPermissionRoleServiceImpl implements AppPermissionRoleService { public Boolean permissionRoleParamCheck(CheckValidityType type, String value, Long appId, Long id) { QAppPermissionRoleEntity role = QAppPermissionRoleEntity.appPermissionRoleEntity; - AppPermissionRoleEntity entity = new AppPermissionRoleEntity(); + PermissionRoleEntity entity = new PermissionRoleEntity(); boolean result = false; // ID存在说明是修改操作,查询一下当前数据 if (Objects.nonNull(id)) { @@ -208,7 +208,7 @@ public class AppPermissionRoleServiceImpl implements AppPermissionRoleService { /** * 用户数据映射器 */ - private final AppPermissionRoleConverter appPermissionRoleConverter; + private final PermissionRoleConverter permissionRoleConverter; /** * RoleRepository */ diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/service/setting/MessageSettingService.java b/eiam-console/src/main/java/cn/topiam/employee/console/service/setting/MessageSettingService.java index 273675c1..bcf3e974 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/service/setting/MessageSettingService.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/service/setting/MessageSettingService.java @@ -20,7 +20,7 @@ package cn.topiam.employee.console.service.setting; import cn.topiam.employee.console.pojo.result.setting.EmailProviderConfigResult; import cn.topiam.employee.console.pojo.save.setting.MailProviderSaveParam; import cn.topiam.employee.console.pojo.save.setting.SmsProviderSaveParam; -import cn.topiam.employee.console.pojo.setting.SmsProviderConfigResult; +import cn.topiam.employee.console.pojo.result.setting.SmsProviderConfigResult; /** * 消息设置接口 diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/service/setting/impl/MessageSettingServiceImpl.java b/eiam-console/src/main/java/cn/topiam/employee/console/service/setting/impl/MessageSettingServiceImpl.java index 500bf90d..9b87d537 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/service/setting/impl/MessageSettingServiceImpl.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/service/setting/impl/MessageSettingServiceImpl.java @@ -25,7 +25,7 @@ import cn.topiam.employee.console.converter.setting.MessageSettingConverter; import cn.topiam.employee.console.pojo.result.setting.EmailProviderConfigResult; import cn.topiam.employee.console.pojo.save.setting.MailProviderSaveParam; import cn.topiam.employee.console.pojo.save.setting.SmsProviderSaveParam; -import cn.topiam.employee.console.pojo.setting.SmsProviderConfigResult; +import cn.topiam.employee.console.pojo.result.setting.SmsProviderConfigResult; import cn.topiam.employee.console.service.setting.MessageSettingService; import cn.topiam.employee.support.context.ApplicationContextHelp; import static cn.topiam.employee.common.constant.ConfigBeanNameConstants.MAIL_PROVIDER_SEND; diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/app/AppPermissionActionConverter.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/permission/PermissionActionConverter.java similarity index 83% rename from eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/app/AppPermissionActionConverter.java rename to eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/permission/PermissionActionConverter.java index 83396cdb..c79aa6eb 100644 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/app/AppPermissionActionConverter.java +++ b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/permission/PermissionActionConverter.java @@ -15,12 +15,12 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.openapi.converter.app; +package cn.topiam.employee.openapi.converter.permission; +import cn.topiam.employee.common.entity.permission.PermissionActionEntity; import org.mapstruct.Mapper; import org.mapstruct.Mapping; -import cn.topiam.employee.common.entity.app.AppPermissionActionEntity; import cn.topiam.employee.openapi.pojo.request.app.AppPermissionsActionParam; /** @@ -31,7 +31,7 @@ import cn.topiam.employee.openapi.pojo.request.app.AppPermissionsActionParam; */ @SuppressWarnings("AlibabaAbstractMethodOrInterfaceMethodMustUseJavadoc") @Mapper(componentModel = "spring") -public interface AppPermissionActionConverter { +public interface PermissionActionConverter { @Mapping(target = "updateTime", ignore = true) @Mapping(target = "updateBy", ignore = true) @Mapping(target = "resource", ignore = true) @@ -40,7 +40,7 @@ public interface AppPermissionActionConverter { @Mapping(target = "deleted", ignore = true) @Mapping(target = "createTime", ignore = true) @Mapping(target = "createBy", ignore = true) - AppPermissionActionEntity toEntity(AppPermissionsActionParam dto); + PermissionActionEntity toEntity(AppPermissionsActionParam dto); - AppPermissionsActionParam toDTO(AppPermissionActionEntity entities); + AppPermissionsActionParam toDTO(PermissionActionEntity entities); } diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/app/AppPermissionPolicyConverter.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/permission/PermissionPolicyConverter.java similarity index 75% rename from eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/app/AppPermissionPolicyConverter.java rename to eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/permission/PermissionPolicyConverter.java index 1596e1ab..cd3c8a24 100644 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/app/AppPermissionPolicyConverter.java +++ b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/permission/PermissionPolicyConverter.java @@ -15,16 +15,16 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.openapi.converter.app; +package cn.topiam.employee.openapi.converter.permission; import java.util.List; +import cn.topiam.employee.common.entity.permission.PermissionPolicyEntity; +import cn.topiam.employee.common.entity.permission.po.PermissionPolicyPO; import org.mapstruct.Mapper; import org.mapstruct.Mapping; import org.springframework.util.CollectionUtils; -import cn.topiam.employee.common.entity.app.AppPermissionPolicyEntity; -import cn.topiam.employee.common.entity.app.po.AppPermissionPolicyPO; import cn.topiam.employee.openapi.pojo.request.app.save.AppPermissionPolicyCreateParam; import cn.topiam.employee.openapi.pojo.request.app.update.AppPermissionPolicyUpdateParam; import cn.topiam.employee.support.repository.page.domain.Page; @@ -35,14 +35,14 @@ import cn.topiam.employee.support.repository.page.domain.Page; * @author TopIAM * Created by support@topiam.cn on 2020/8/14 22:45 */ -@Mapper(componentModel = "spring", uses = AppPermissionActionConverter.class) -public interface AppPermissionPolicyConverter { +@Mapper(componentModel = "spring", uses = PermissionActionConverter.class) +public interface PermissionPolicyConverter { /** * 资源创建参数转实体类 * * @param param {@link AppPermissionPolicyCreateParam} - * @return {@link AppPermissionPolicyEntity} + * @return {@link PermissionPolicyEntity} */ @Mapping(target = "deleted", ignore = true) @Mapping(target = "id", ignore = true) @@ -51,13 +51,13 @@ public interface AppPermissionPolicyConverter { @Mapping(target = "remark", ignore = true) @Mapping(target = "createTime", ignore = true) @Mapping(target = "createBy", ignore = true) - AppPermissionPolicyEntity policyCreateParamConvertToEntity(AppPermissionPolicyCreateParam param); + PermissionPolicyEntity policyCreateParamConvertToEntity(AppPermissionPolicyCreateParam param); /** * 资源修改参数转实体类 * * @param param {@link AppPermissionPolicyCreateParam} - * @return {@link AppPermissionPolicyEntity} + * @return {@link PermissionPolicyEntity} */ @Mapping(target = "deleted", ignore = true) @Mapping(target = "updateTime", ignore = true) @@ -65,7 +65,7 @@ public interface AppPermissionPolicyConverter { @Mapping(target = "remark", ignore = true) @Mapping(target = "createTime", ignore = true) @Mapping(target = "createBy", ignore = true) - AppPermissionPolicyEntity policyUpdateParamConvertToEntity(AppPermissionPolicyUpdateParam param); + PermissionPolicyEntity policyUpdateParamConvertToEntity(AppPermissionPolicyUpdateParam param); /** * 资源转换为资源列表结果 @@ -73,9 +73,9 @@ public interface AppPermissionPolicyConverter { * @param page {@link Page} * @return {@link Page} */ - default Page entityConvertToPolicyListResult(org.springframework.data.domain.Page page) { - Page result = new Page<>(); - List pageList = page.getContent(); + default Page entityConvertToPolicyListResult(org.springframework.data.domain.Page page) { + Page result = new Page<>(); + List pageList = page.getContent(); if (!CollectionUtils.isEmpty(pageList)) { //@formatter:off result.setPagination(Page.Pagination.builder() diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/app/AppPermissionResourceConverter.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/permission/PermissionResourceConverter.java similarity index 83% rename from eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/app/AppPermissionResourceConverter.java rename to eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/permission/PermissionResourceConverter.java index f039ff60..2bd5543f 100644 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/app/AppPermissionResourceConverter.java +++ b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/permission/PermissionResourceConverter.java @@ -15,11 +15,12 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.openapi.converter.app; +package cn.topiam.employee.openapi.converter.permission; import java.util.ArrayList; import java.util.List; +import cn.topiam.employee.common.entity.permission.PermissionResourceEntity; import org.apache.commons.lang3.StringUtils; import org.mapstruct.Mapper; import org.mapstruct.Mapping; @@ -28,7 +29,6 @@ import org.springframework.util.CollectionUtils; import com.querydsl.core.types.ExpressionUtils; import com.querydsl.core.types.Predicate; -import cn.topiam.employee.common.entity.app.AppPermissionResourceEntity; import cn.topiam.employee.common.entity.app.QAppPermissionResourceEntity; import cn.topiam.employee.openapi.pojo.request.app.query.AppResourceListQuery; import cn.topiam.employee.openapi.pojo.request.app.save.AppPermissionResourceCreateParam; @@ -43,8 +43,8 @@ import cn.topiam.employee.support.repository.page.domain.Page; * @author TopIAM * Created by support@topiam.cn on 2020/8/14 22:45 */ -@Mapper(componentModel = "spring", uses = AppPermissionActionConverter.class) -public interface AppPermissionResourceConverter { +@Mapper(componentModel = "spring", uses = PermissionActionConverter.class) +public interface PermissionResourceConverter { /** * 资源分页查询参数转实体 @@ -70,7 +70,7 @@ public interface AppPermissionResourceConverter { * 资源创建参数转实体类 * * @param param {@link AppPermissionResourceCreateParam} - * @return {@link AppPermissionResourceEntity} + * @return {@link PermissionResourceEntity} */ @Mapping(target = "deleted", ignore = true) @Mapping(target = "actions", ignore = true) @@ -80,13 +80,13 @@ public interface AppPermissionResourceConverter { @Mapping(target = "remark", ignore = true) @Mapping(target = "createTime", ignore = true) @Mapping(target = "createBy", ignore = true) - AppPermissionResourceEntity resourceCreateParamConvertToEntity(AppPermissionResourceCreateParam param); + PermissionResourceEntity resourceCreateParamConvertToEntity(AppPermissionResourceCreateParam param); /** * 资源修改参数转实体类 * * @param param {@link AppPermissionResourceCreateParam} - * @return {@link AppPermissionResourceEntity} + * @return {@link PermissionResourceEntity} */ @Mapping(target = "enabled", expression = "java(Boolean.TRUE)") @Mapping(target = "deleted", ignore = true) @@ -98,7 +98,7 @@ public interface AppPermissionResourceConverter { @Mapping(target = "remark", ignore = true) @Mapping(target = "createTime", ignore = true) @Mapping(target = "createBy", ignore = true) - AppPermissionResourceEntity resourceUpdateParamConvertToEntity(AppPermissionResourceUpdateParam param); + PermissionResourceEntity resourceUpdateParamConvertToEntity(AppPermissionResourceUpdateParam param); /** * 资源转换为资源列表结果 @@ -106,12 +106,12 @@ public interface AppPermissionResourceConverter { * @param page {@link Page} * @return {@link Page} */ - default Page entityConvertToResourceListResult(org.springframework.data.domain.Page page) { + default Page entityConvertToResourceListResult(org.springframework.data.domain.Page page) { Page result = new Page<>(); - List pageList = page.getContent(); + List pageList = page.getContent(); if (!CollectionUtils.isEmpty(pageList)) { List list = new ArrayList<>(); - for (AppPermissionResourceEntity resource : pageList) { + for (PermissionResourceEntity resource : pageList) { list.add(entityConvertToResourceListResult(resource)); } //@formatter:off @@ -129,17 +129,17 @@ public interface AppPermissionResourceConverter { /** * 实体转换为资源列表结果 * - * @param data {@link AppPermissionResourceEntity} + * @param data {@link PermissionResourceEntity} * @return {@link AppPermissionResourceListResult} */ - AppPermissionResourceListResult entityConvertToResourceListResult(AppPermissionResourceEntity data); + AppPermissionResourceListResult entityConvertToResourceListResult(PermissionResourceEntity data); /** * 实体转获取详情返回 * - * @param resource {@link AppPermissionResourceEntity} + * @param resource {@link PermissionResourceEntity} * @return {@link AppPermissionResourceGetResult} */ @Mapping(target = "actions", source = "actions") - AppPermissionResourceGetResult entityConvertToResourceGetResult(AppPermissionResourceEntity resource); + AppPermissionResourceGetResult entityConvertToResourceGetResult(PermissionResourceEntity resource); } diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/app/AppPermissionRoleConverter.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/permission/PermissionRoleConverter.java similarity index 85% rename from eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/app/AppPermissionRoleConverter.java rename to eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/permission/PermissionRoleConverter.java index 3b6c7156..bb8e5cf5 100644 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/app/AppPermissionRoleConverter.java +++ b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/permission/PermissionRoleConverter.java @@ -15,7 +15,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.openapi.converter.app; +package cn.topiam.employee.openapi.converter.permission; import java.util.ArrayList; import java.util.List; @@ -29,8 +29,8 @@ import org.springframework.util.ObjectUtils; import com.querydsl.core.types.ExpressionUtils; import com.querydsl.core.types.Predicate; -import cn.topiam.employee.common.entity.app.AppPermissionRoleEntity; import cn.topiam.employee.common.entity.app.QAppPermissionRoleEntity; +import cn.topiam.employee.common.entity.permission.PermissionRoleEntity; import cn.topiam.employee.openapi.pojo.request.app.query.AppPermissionRoleListQuery; import cn.topiam.employee.openapi.pojo.request.app.save.AppPermissionRoleCreateParam; import cn.topiam.employee.openapi.pojo.request.app.update.PermissionRoleUpdateParam; @@ -45,7 +45,7 @@ import cn.topiam.employee.support.repository.page.domain.Page; * Created by support@topiam.cn on 2020/8/14 22:45 */ @Mapper(componentModel = "spring") -public interface AppPermissionRoleConverter { +public interface PermissionRoleConverter { /** * 角色实体转换为角色分页结果 @@ -53,11 +53,11 @@ public interface AppPermissionRoleConverter { * @param page {@link Page} * @return {@link Page} */ - default Page entityConvertToRolePaginationResult(org.springframework.data.domain.Page page) { + default Page entityConvertToRolePaginationResult(org.springframework.data.domain.Page page) { Page result = new Page<>(); if (!CollectionUtils.isEmpty(page.getContent())) { List list = new ArrayList<>(); - for (AppPermissionRoleEntity user : page.getContent()) { + for (PermissionRoleEntity user : page.getContent()) { list.add(entityConvertToRolePaginationResult(user)); } //@formatter:off @@ -75,16 +75,16 @@ public interface AppPermissionRoleConverter { /** * 角色实体转换为角色分页结果 * - * @param page {@link AppPermissionRoleEntity} + * @param page {@link PermissionRoleEntity} * @return {@link AppPermissionRoleListResult} */ - AppPermissionRoleListResult entityConvertToRolePaginationResult(AppPermissionRoleEntity page); + AppPermissionRoleListResult entityConvertToRolePaginationResult(PermissionRoleEntity page); /** * 角色创建参数转换为角色实体 * * @param param {@link AppPermissionRoleCreateParam} - * @return {@link AppPermissionRoleEntity} + * @return {@link PermissionRoleEntity} */ @Mapping(target = "deleted", ignore = true) @Mapping(target = "id", ignore = true) @@ -93,13 +93,13 @@ public interface AppPermissionRoleConverter { @Mapping(target = "updateBy", ignore = true) @Mapping(target = "createTime", ignore = true) @Mapping(target = "createBy", ignore = true) - AppPermissionRoleEntity roleCreateParamConvertToEntity(AppPermissionRoleCreateParam param); + PermissionRoleEntity roleCreateParamConvertToEntity(AppPermissionRoleCreateParam param); /** * 角色更新参数转换为角色实体类 * * @param param {@link PermissionRoleUpdateParam} 更新参数 - * @return {@link AppPermissionRoleEntity} 角色实体 + * @return {@link PermissionRoleEntity} 角色实体 */ @Mapping(target = "deleted", ignore = true) @Mapping(target = "appId", ignore = true) @@ -108,21 +108,21 @@ public interface AppPermissionRoleConverter { @Mapping(target = "updateBy", ignore = true) @Mapping(target = "createTime", ignore = true) @Mapping(target = "createBy", ignore = true) - AppPermissionRoleEntity roleUpdateParamConvertToEntity(PermissionRoleUpdateParam param); + PermissionRoleEntity roleUpdateParamConvertToEntity(PermissionRoleUpdateParam param); /** * 实体转系统详情结果 * - * @param role {@link AppPermissionRoleEntity} + * @param role {@link PermissionRoleEntity} * @return {@link AppPermissionRoleResult} */ - AppPermissionRoleResult entityConvertToRoleDetailResult(AppPermissionRoleEntity role); + AppPermissionRoleResult entityConvertToRoleDetailResult(PermissionRoleEntity role); /** * 角色分页查询参数转实体 * * @param query {@link AppPermissionRoleListQuery} - * @return {@link AppPermissionRoleEntity} + * @return {@link PermissionRoleEntity} */ default Predicate rolePaginationParamConvertToPredicate(AppPermissionRoleListQuery query) { QAppPermissionRoleEntity role = QAppPermissionRoleEntity.appPermissionRoleEntity; diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/endpoint/permission/AppPermissionPolicyEndpoint.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/endpoint/permission/PermissionPolicyEndpoint.java similarity index 76% rename from eiam-openapi/src/main/java/cn/topiam/employee/openapi/endpoint/permission/AppPermissionPolicyEndpoint.java rename to eiam-openapi/src/main/java/cn/topiam/employee/openapi/endpoint/permission/PermissionPolicyEndpoint.java index d6d3d9ef..2b736028 100644 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/endpoint/permission/AppPermissionPolicyEndpoint.java +++ b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/endpoint/permission/PermissionPolicyEndpoint.java @@ -17,14 +17,14 @@ */ package cn.topiam.employee.openapi.endpoint.permission; +import cn.topiam.employee.common.entity.permission.po.PermissionPolicyPO; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import cn.topiam.employee.common.entity.app.po.AppPermissionPolicyPO; import cn.topiam.employee.openapi.pojo.request.app.query.OpenApiPolicyQuery; -import cn.topiam.employee.openapi.service.AppPermissionPolicyService; +import cn.topiam.employee.openapi.service.PermissionPolicyService; import cn.topiam.employee.support.repository.page.domain.Page; import cn.topiam.employee.support.repository.page.domain.PageModel; import cn.topiam.employee.support.result.ApiRestResult; @@ -43,21 +43,21 @@ import static cn.topiam.employee.openapi.constants.OpenApiV1Constants.OPEN_API_P @RestController @RequestMapping(value = OPEN_API_PERMISSION_PATH + "/policy") @RequiredArgsConstructor -public class AppPermissionPolicyEndpoint { +public class PermissionPolicyEndpoint { /** * 获取所有策略(分页) * * @param page {@link PageModel} - * @return {@link AppPermissionPolicyPO} + * @return {@link PermissionPolicyPO} */ @Operation(summary = "获取策略列表") @GetMapping(value = "/list") - public ApiRestResult> getPermissionPolicyList(PageModel page, - @Validated OpenApiPolicyQuery query) { - Page result = permissionPolicyService.getPermissionPolicyList(page, + public ApiRestResult> getPermissionPolicyList(PageModel page, + @Validated OpenApiPolicyQuery query) { + Page result = permissionPolicyService.getPermissionPolicyList(page, query); - return ApiRestResult.> builder().result(result).build(); + return ApiRestResult.> builder().result(result).build(); } - private final AppPermissionPolicyService permissionPolicyService; + private final PermissionPolicyService permissionPolicyService; } diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/endpoint/permission/AppPermissionResourceEndpoint.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/endpoint/permission/PermissionResourceEndpoint.java similarity index 90% rename from eiam-openapi/src/main/java/cn/topiam/employee/openapi/endpoint/permission/AppPermissionResourceEndpoint.java rename to eiam-openapi/src/main/java/cn/topiam/employee/openapi/endpoint/permission/PermissionResourceEndpoint.java index cc955e73..b3b18782 100644 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/endpoint/permission/AppPermissionResourceEndpoint.java +++ b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/endpoint/permission/PermissionResourceEndpoint.java @@ -24,7 +24,7 @@ import org.springframework.web.bind.annotation.RestController; import cn.topiam.employee.openapi.pojo.request.app.query.AppResourceListQuery; import cn.topiam.employee.openapi.pojo.response.app.AppPermissionResourceListResult; -import cn.topiam.employee.openapi.service.AppPermissionResourceService; +import cn.topiam.employee.openapi.service.PermissionResourceService; import cn.topiam.employee.support.repository.page.domain.Page; import cn.topiam.employee.support.repository.page.domain.PageModel; import cn.topiam.employee.support.result.ApiRestResult; @@ -43,7 +43,7 @@ import static cn.topiam.employee.openapi.constants.OpenApiV1Constants.OPEN_API_P @RestController @RequestMapping(value = OPEN_API_PERMISSION_PATH + "/resource") @RequiredArgsConstructor -public class AppPermissionResourceEndpoint { +public class PermissionResourceEndpoint { /** * 获取应用的所有资源(分页) * @@ -54,7 +54,7 @@ public class AppPermissionResourceEndpoint { @GetMapping(value = "/list") public ApiRestResult> getPermissionResourceList(PageModel page, @Validated AppResourceListQuery query) { - Page result = appPermissionResourceService + Page result = permissionResourceService .getPermissionResourceList(page, query); return ApiRestResult.> builder().result(result) .build(); @@ -68,5 +68,5 @@ public class AppPermissionResourceEndpoint { /** * 资源服务类 */ - private final AppPermissionResourceService appPermissionResourceService; + private final PermissionResourceService permissionResourceService; } diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/endpoint/permission/AppPermissionRoleEndpoint.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/endpoint/permission/PermissionRoleEndpoint.java similarity index 91% rename from eiam-openapi/src/main/java/cn/topiam/employee/openapi/endpoint/permission/AppPermissionRoleEndpoint.java rename to eiam-openapi/src/main/java/cn/topiam/employee/openapi/endpoint/permission/PermissionRoleEndpoint.java index 5574073f..692b64a3 100644 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/endpoint/permission/AppPermissionRoleEndpoint.java +++ b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/endpoint/permission/PermissionRoleEndpoint.java @@ -24,7 +24,7 @@ import org.springframework.web.bind.annotation.RestController; import cn.topiam.employee.openapi.pojo.request.app.query.AppPermissionRoleListQuery; import cn.topiam.employee.openapi.pojo.response.app.AppPermissionRoleListResult; -import cn.topiam.employee.openapi.service.AppPermissionRoleService; +import cn.topiam.employee.openapi.service.PermissionRoleService; import cn.topiam.employee.support.repository.page.domain.Page; import cn.topiam.employee.support.repository.page.domain.PageModel; import cn.topiam.employee.support.result.ApiRestResult; @@ -43,7 +43,7 @@ import static cn.topiam.employee.openapi.constants.OpenApiV1Constants.OPEN_API_P @RestController @RequestMapping(value = OPEN_API_PERMISSION_PATH + "/role") @RequiredArgsConstructor -public class AppPermissionRoleEndpoint { +public class PermissionRoleEndpoint { //1、获取应用的所有角色(分页) /** * 获取所有角色(分页) @@ -55,7 +55,7 @@ public class AppPermissionRoleEndpoint { @GetMapping(value = "/list") public ApiRestResult> getPermissionRoleList(PageModel page, @Validated AppPermissionRoleListQuery query) { - Page result = appPermissionRoleService + Page result = permissionRoleService .getPermissionRoleList(page, query); return ApiRestResult.> builder().result(result).build(); } @@ -68,5 +68,5 @@ public class AppPermissionRoleEndpoint { /** * 角色服务类 */ - private final AppPermissionRoleService appPermissionRoleService; + private final PermissionRoleService permissionRoleService; } diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/AppPermissionActionService.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/PermissionActionService.java similarity index 98% rename from eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/AppPermissionActionService.java rename to eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/PermissionActionService.java index 8de589f9..55d4b974 100644 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/AppPermissionActionService.java +++ b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/PermissionActionService.java @@ -33,7 +33,7 @@ import cn.topiam.employee.openapi.pojo.response.app.AppPermissionActionListResul * @author TopIAM * Created by support@topiam.cn on 2020-08-10 */ -public interface AppPermissionActionService { +public interface PermissionActionService { /** * 获取权限列表 * diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/AppPermissionPolicyService.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/PermissionPolicyService.java similarity index 90% rename from eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/AppPermissionPolicyService.java rename to eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/PermissionPolicyService.java index fe7c94e8..59925f55 100644 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/AppPermissionPolicyService.java +++ b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/PermissionPolicyService.java @@ -17,7 +17,7 @@ */ package cn.topiam.employee.openapi.service; -import cn.topiam.employee.common.entity.app.po.AppPermissionPolicyPO; +import cn.topiam.employee.common.entity.permission.po.PermissionPolicyPO; import cn.topiam.employee.openapi.pojo.request.app.query.OpenApiPolicyQuery; import cn.topiam.employee.openapi.pojo.request.app.save.AppPermissionPolicyCreateParam; import cn.topiam.employee.openapi.pojo.request.app.update.AppPermissionPolicyUpdateParam; @@ -33,15 +33,15 @@ import cn.topiam.employee.support.repository.page.domain.PageModel; * @author TopIAM * Created by support@topiam.cn on 2020-08-10 */ -public interface AppPermissionPolicyService { +public interface PermissionPolicyService { /** * 获取资源列表 * * @param page {@link PageModel} * @param query {@link OpenApiPolicyQuery} - * @return {@link AppPermissionPolicyPO} + * @return {@link PermissionPolicyPO} */ - Page getPermissionPolicyList(PageModel page, OpenApiPolicyQuery query); + Page getPermissionPolicyList(PageModel page, OpenApiPolicyQuery query); /** * 获取资源 diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/AppPermissionResourceService.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/PermissionResourceService.java similarity index 98% rename from eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/AppPermissionResourceService.java rename to eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/PermissionResourceService.java index 1cc8b919..4ec6e8c1 100644 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/AppPermissionResourceService.java +++ b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/PermissionResourceService.java @@ -34,7 +34,7 @@ import cn.topiam.employee.support.repository.page.domain.PageModel; * @author TopIAM * Created by support@topiam.cn on 2020-08-10 */ -public interface AppPermissionResourceService { +public interface PermissionResourceService { /** * 获取资源列表 * diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/AppPermissionRoleService.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/PermissionRoleService.java similarity index 98% rename from eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/AppPermissionRoleService.java rename to eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/PermissionRoleService.java index ffee1738..89217d9f 100644 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/AppPermissionRoleService.java +++ b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/PermissionRoleService.java @@ -34,7 +34,7 @@ import cn.topiam.employee.support.repository.page.domain.PageModel; * @author TopIAM * Created by support@topiam.cn on 2020-08-10 */ -public interface AppPermissionRoleService { +public interface PermissionRoleService { /** * 获取所有角色(分页) diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/impl/AppPermissionActionServiceImpl.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/impl/PermissionActionServiceImpl.java similarity index 94% rename from eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/impl/AppPermissionActionServiceImpl.java rename to eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/impl/PermissionActionServiceImpl.java index 249cc1d5..c29483a2 100644 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/impl/AppPermissionActionServiceImpl.java +++ b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/impl/PermissionActionServiceImpl.java @@ -26,7 +26,7 @@ import cn.topiam.employee.openapi.pojo.request.app.save.AppPermissionActionCreat import cn.topiam.employee.openapi.pojo.request.app.update.ResourceActionUpdateParam; import cn.topiam.employee.openapi.pojo.response.app.AppPermissionActionGetResult; import cn.topiam.employee.openapi.pojo.response.app.AppPermissionActionListResult; -import cn.topiam.employee.openapi.service.AppPermissionActionService; +import cn.topiam.employee.openapi.service.PermissionActionService; import lombok.RequiredArgsConstructor; @@ -40,7 +40,7 @@ import lombok.RequiredArgsConstructor; */ @Service @RequiredArgsConstructor -public class AppPermissionActionServiceImpl implements AppPermissionActionService { +public class PermissionActionServiceImpl implements PermissionActionService { /** * 获取权限列表 diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/impl/AppPermissionPolicyServiceImpl.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/impl/PermissionPolicyServiceImpl.java similarity index 79% rename from eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/impl/AppPermissionPolicyServiceImpl.java rename to eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/impl/PermissionPolicyServiceImpl.java index 643ee508..073b06ce 100644 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/impl/AppPermissionPolicyServiceImpl.java +++ b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/impl/PermissionPolicyServiceImpl.java @@ -17,21 +17,21 @@ */ package cn.topiam.employee.openapi.service.impl; +import cn.topiam.employee.common.entity.permission.po.PermissionPolicyPO; import org.springframework.data.querydsl.QPageRequest; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import cn.topiam.employee.common.entity.app.AppPermissionPolicyEntity; -import cn.topiam.employee.common.entity.app.po.AppPermissionPolicyPO; import cn.topiam.employee.common.entity.app.query.AppPolicyQuery; +import cn.topiam.employee.common.entity.permission.PermissionPolicyEntity; import cn.topiam.employee.common.exception.app.AppPolicyNotExistException; -import cn.topiam.employee.common.repository.app.AppPermissionPolicyRepository; -import cn.topiam.employee.openapi.converter.app.AppPermissionPolicyConverter; +import cn.topiam.employee.common.repository.permission.AppPermissionPolicyRepository; +import cn.topiam.employee.openapi.converter.permission.PermissionPolicyConverter; import cn.topiam.employee.openapi.pojo.request.app.query.OpenApiPolicyQuery; import cn.topiam.employee.openapi.pojo.request.app.save.AppPermissionPolicyCreateParam; import cn.topiam.employee.openapi.pojo.request.app.update.AppPermissionPolicyUpdateParam; import cn.topiam.employee.openapi.pojo.response.app.AppPermissionPolicyGetResult; -import cn.topiam.employee.openapi.service.AppPermissionPolicyService; +import cn.topiam.employee.openapi.service.PermissionPolicyService; import cn.topiam.employee.support.repository.page.domain.Page; import cn.topiam.employee.support.repository.page.domain.PageModel; @@ -47,18 +47,18 @@ import lombok.RequiredArgsConstructor; */ @Service @RequiredArgsConstructor -public class AppPermissionPolicyServiceImpl implements AppPermissionPolicyService { +public class PermissionPolicyServiceImpl implements PermissionPolicyService { /** * 获取策略列表 * * @param page {@link PageModel} * @param query {@link OpenApiPolicyQuery} - * @return {@link AppPermissionPolicyPO} + * @return {@link PermissionPolicyPO} */ @Override - public Page getPermissionPolicyList(PageModel page, - OpenApiPolicyQuery query) { + public Page getPermissionPolicyList(PageModel page, + OpenApiPolicyQuery query) { AppPolicyQuery appPolicyQuery = new AppPolicyQuery(); // TODO token获取所属应用 // appPolicyQuery.setAppId(0L); @@ -68,9 +68,9 @@ public class AppPermissionPolicyServiceImpl implements AppPermissionPolicyServic appPolicyQuery.setSubjectType(query.getSubjectType()); appPolicyQuery.setObjectType(query.getObjectType()); QPageRequest request = QPageRequest.of(page.getCurrent(), page.getPageSize()); - org.springframework.data.domain.Page data = appPermissionPolicyRepository + org.springframework.data.domain.Page data = appPermissionPolicyRepository .findPage(appPolicyQuery, request); - return appPermissionPolicyConverter.entityConvertToPolicyListResult(data); + return permissionPolicyConverter.entityConvertToPolicyListResult(data); } /** @@ -108,7 +108,7 @@ public class AppPermissionPolicyServiceImpl implements AppPermissionPolicyServic @Override @Transactional(rollbackFor = Exception.class) public Boolean createPermissionPolicy(AppPermissionPolicyCreateParam param) { - AppPermissionPolicyEntity resource = appPermissionPolicyConverter + PermissionPolicyEntity resource = permissionPolicyConverter .policyCreateParamConvertToEntity(param); // 新增策略 appPermissionPolicyRepository.save(resource); @@ -123,14 +123,14 @@ public class AppPermissionPolicyServiceImpl implements AppPermissionPolicyServic */ @Override public Boolean updatePermissionPolicy(AppPermissionPolicyUpdateParam param) { - AppPermissionPolicyEntity resource = appPermissionPolicyConverter + PermissionPolicyEntity resource = permissionPolicyConverter .policyUpdateParamConvertToEntity(param); // 更新策略 appPermissionPolicyRepository.save(resource); return null; } - private final AppPermissionPolicyConverter appPermissionPolicyConverter; + private final PermissionPolicyConverter permissionPolicyConverter; private final AppPermissionPolicyRepository appPermissionPolicyRepository; } diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/impl/AppPermissionResourceServiceImpl.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/impl/PermissionResourceServiceImpl.java similarity index 79% rename from eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/impl/AppPermissionResourceServiceImpl.java rename to eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/impl/PermissionResourceServiceImpl.java index e7d1bb26..3e743e11 100644 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/impl/AppPermissionResourceServiceImpl.java +++ b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/impl/PermissionResourceServiceImpl.java @@ -23,6 +23,9 @@ import java.util.Objects; import java.util.Set; import java.util.stream.Collectors; +import cn.topiam.employee.common.entity.permission.PermissionActionEntity; +import cn.topiam.employee.common.entity.permission.PermissionResourceEntity; +import cn.topiam.employee.openapi.converter.permission.PermissionResourceConverter; import org.apache.commons.lang3.StringUtils; import org.springframework.data.querydsl.QPageRequest; import org.springframework.stereotype.Service; @@ -31,15 +34,12 @@ import org.springframework.transaction.annotation.Transactional; import com.querydsl.core.types.Predicate; import com.querydsl.core.types.dsl.BooleanExpression; -import cn.topiam.employee.common.entity.app.AppPermissionActionEntity; -import cn.topiam.employee.common.entity.app.AppPermissionResourceEntity; import cn.topiam.employee.common.entity.app.QAppPermissionResourceEntity; import cn.topiam.employee.common.enums.CheckValidityType; import cn.topiam.employee.common.exception.app.AppResourceNotExistException; -import cn.topiam.employee.common.repository.app.AppPermissionActionRepository; -import cn.topiam.employee.common.repository.app.AppPermissionPolicyRepository; -import cn.topiam.employee.common.repository.app.AppPermissionResourceRepository; -import cn.topiam.employee.openapi.converter.app.AppPermissionResourceConverter; +import cn.topiam.employee.common.repository.permission.AppPermissionActionRepository; +import cn.topiam.employee.common.repository.permission.AppPermissionPolicyRepository; +import cn.topiam.employee.common.repository.permission.AppPermissionResourceRepository; import cn.topiam.employee.openapi.pojo.request.app.AppPermissionsActionParam; import cn.topiam.employee.openapi.pojo.request.app.query.AppResourceListQuery; import cn.topiam.employee.openapi.pojo.request.app.query.OpenApiPolicyQuery; @@ -47,7 +47,7 @@ import cn.topiam.employee.openapi.pojo.request.app.save.AppPermissionResourceCre import cn.topiam.employee.openapi.pojo.request.app.update.AppPermissionResourceUpdateParam; import cn.topiam.employee.openapi.pojo.response.app.AppPermissionResourceGetResult; import cn.topiam.employee.openapi.pojo.response.app.AppPermissionResourceListResult; -import cn.topiam.employee.openapi.service.AppPermissionResourceService; +import cn.topiam.employee.openapi.service.PermissionResourceService; import cn.topiam.employee.support.repository.page.domain.Page; import cn.topiam.employee.support.repository.page.domain.PageModel; @@ -63,7 +63,7 @@ import lombok.RequiredArgsConstructor; */ @Service @RequiredArgsConstructor -public class AppPermissionResourceServiceImpl implements AppPermissionResourceService { +public class PermissionResourceServiceImpl implements PermissionResourceService { /** * 获取资源列表 @@ -75,12 +75,12 @@ public class AppPermissionResourceServiceImpl implements AppPermissionResourceSe @Override public Page getPermissionResourceList(PageModel page, AppResourceListQuery query) { - org.springframework.data.domain.Page data; - Predicate predicate = appPermissionResourceConverter + org.springframework.data.domain.Page data; + Predicate predicate = permissionResourceConverter .resourcePaginationParamConvertToPredicate(query); QPageRequest request = QPageRequest.of(page.getCurrent(), page.getPageSize()); data = appResourceRepository.findAll(predicate, request); - return appPermissionResourceConverter.entityConvertToResourceListResult(data); + return permissionResourceConverter.entityConvertToResourceListResult(data); } /** @@ -91,9 +91,9 @@ public class AppPermissionResourceServiceImpl implements AppPermissionResourceSe */ @Override public AppPermissionResourceGetResult getPermissionResource(String id) { - AppPermissionResourceEntity resource = appResourceRepository.findById(Long.valueOf(id)) + PermissionResourceEntity resource = appResourceRepository.findById(Long.valueOf(id)) .orElseThrow(AppResourceNotExistException::new); - return appPermissionResourceConverter.entityConvertToResourceGetResult(resource); + return permissionResourceConverter.entityConvertToResourceGetResult(resource); } /** @@ -106,12 +106,12 @@ public class AppPermissionResourceServiceImpl implements AppPermissionResourceSe @Transactional(rollbackFor = Exception.class) public Boolean deletePermissionResource(String id) { Long resourceId = Long.valueOf(id); - AppPermissionResourceEntity resource = appResourceRepository.findById(resourceId) + PermissionResourceEntity resource = appResourceRepository.findById(resourceId) .orElseThrow(AppResourceNotExistException::new); - List actionList = appPermissionActionRepository + List actionList = appPermissionActionRepository .findAllByResource(resource); List objectIdList = new ArrayList<>( - actionList.stream().map(AppPermissionActionEntity::getId).toList()); + actionList.stream().map(PermissionActionEntity::getId).toList()); objectIdList.add(resourceId); appPermissionPolicyRepository.deleteAllByObjectIdIn(objectIdList); appResourceRepository.deleteById(resourceId); @@ -127,7 +127,7 @@ public class AppPermissionResourceServiceImpl implements AppPermissionResourceSe @Override @Transactional(rollbackFor = Exception.class) public Boolean createPermissionResource(AppPermissionResourceCreateParam param) { - AppPermissionResourceEntity resource = appPermissionResourceConverter + PermissionResourceEntity resource = permissionResourceConverter .resourceCreateParamConvertToEntity(param); buildActions(param.getActions(), resource); // 新增资源 @@ -144,19 +144,19 @@ public class AppPermissionResourceServiceImpl implements AppPermissionResourceSe @Override @Transactional(rollbackFor = Exception.class) public Boolean updatePermissionResource(AppPermissionResourceUpdateParam param) { - AppPermissionResourceEntity resource = appPermissionResourceConverter + PermissionResourceEntity resource = permissionResourceConverter .resourceUpdateParamConvertToEntity(param); buildActions(param.getActions(), resource); // 查询资源下所有权限 - List actionList = appPermissionActionRepository + List actionList = appPermissionActionRepository .findAllByResource(resource); // 取出未删除的权限id - Set reservedSet = resource.getActions().stream().map(AppPermissionActionEntity::getId) + Set reservedSet = resource.getActions().stream().map(PermissionActionEntity::getId) .collect(Collectors.toSet()); // 过滤要删除的权限id List removeActions = actionList.stream() .filter(item -> reservedSet.contains(item.getId())) - .map(AppPermissionActionEntity::getId).toList(); + .map(PermissionActionEntity::getId).toList(); appPermissionPolicyRepository.deleteAllByObjectIdIn(removeActions); // 更新资源 appResourceRepository.save(resource); @@ -177,7 +177,7 @@ public class AppPermissionResourceServiceImpl implements AppPermissionResourceSe public Boolean permissionResourceParamCheck(CheckValidityType type, String value, Long appId, Long id) { QAppPermissionResourceEntity role = QAppPermissionResourceEntity.appPermissionResourceEntity; - AppPermissionResourceEntity entity = new AppPermissionResourceEntity(); + PermissionResourceEntity entity = new PermissionResourceEntity(); boolean result = false; // ID存在说明是修改操作,查询一下当前数据 if (Objects.nonNull(id)) { @@ -209,14 +209,14 @@ public class AppPermissionResourceServiceImpl implements AppPermissionResourceSe * 批量处理actions * * @param permissions {@link List} - * @param resource {@link AppPermissionResourceEntity>} + * @param resource {@link PermissionResourceEntity >} */ private void buildActions(List permissions, - AppPermissionResourceEntity resource) { + PermissionResourceEntity resource) { // 权限 - List list = new ArrayList<>(); + List list = new ArrayList<>(); for (AppPermissionsActionParam p : permissions) { - AppPermissionActionEntity entity = new AppPermissionActionEntity(); + PermissionActionEntity entity = new PermissionActionEntity(); entity.setResource(resource); entity.setType(p.getType()); entity.setName(p.getName()); @@ -227,7 +227,7 @@ public class AppPermissionResourceServiceImpl implements AppPermissionResourceSe resource.setActions(list); } - private final AppPermissionResourceConverter appPermissionResourceConverter; + private final PermissionResourceConverter permissionResourceConverter; private final AppPermissionResourceRepository appResourceRepository; /** diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/impl/AppPermissionRoleServiceImpl.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/impl/PermissionRoleServiceImpl.java similarity index 85% rename from eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/impl/AppPermissionRoleServiceImpl.java rename to eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/impl/PermissionRoleServiceImpl.java index 3194c22b..fbba7ea9 100644 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/impl/AppPermissionRoleServiceImpl.java +++ b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/impl/PermissionRoleServiceImpl.java @@ -22,6 +22,7 @@ import java.util.List; import java.util.Objects; import java.util.Optional; +import cn.topiam.employee.common.entity.permission.PermissionRoleEntity; import org.apache.commons.lang3.StringUtils; import org.springframework.data.querydsl.QPageRequest; import org.springframework.stereotype.Service; @@ -30,19 +31,18 @@ import org.springframework.transaction.annotation.Transactional; import com.querydsl.core.types.Predicate; import com.querydsl.core.types.dsl.BooleanExpression; -import cn.topiam.employee.common.entity.app.AppPermissionRoleEntity; import cn.topiam.employee.common.entity.app.QAppPermissionRoleEntity; import cn.topiam.employee.common.enums.CheckValidityType; import cn.topiam.employee.common.exception.app.AppRoleNotExistException; -import cn.topiam.employee.common.repository.app.AppPermissionPolicyRepository; -import cn.topiam.employee.common.repository.app.AppPermissionRoleRepository; -import cn.topiam.employee.openapi.converter.app.AppPermissionRoleConverter; +import cn.topiam.employee.common.repository.permission.AppPermissionPolicyRepository; +import cn.topiam.employee.common.repository.permission.AppPermissionRoleRepository; +import cn.topiam.employee.openapi.converter.permission.PermissionRoleConverter; import cn.topiam.employee.openapi.pojo.request.app.query.AppPermissionRoleListQuery; import cn.topiam.employee.openapi.pojo.request.app.save.AppPermissionRoleCreateParam; import cn.topiam.employee.openapi.pojo.request.app.update.PermissionRoleUpdateParam; import cn.topiam.employee.openapi.pojo.response.app.AppPermissionRoleListResult; import cn.topiam.employee.openapi.pojo.response.app.AppPermissionRoleResult; -import cn.topiam.employee.openapi.service.AppPermissionRoleService; +import cn.topiam.employee.openapi.service.PermissionRoleService; import cn.topiam.employee.support.repository.page.domain.Page; import cn.topiam.employee.support.repository.page.domain.PageModel; import cn.topiam.employee.support.util.BeanUtils; @@ -61,7 +61,7 @@ import static cn.topiam.employee.support.repository.domain.BaseEntity.LAST_MODIF */ @Service @RequiredArgsConstructor -public class AppPermissionRoleServiceImpl implements AppPermissionRoleService { +public class PermissionRoleServiceImpl implements PermissionRoleService { /** * 获取所有角色(分页) @@ -72,12 +72,12 @@ public class AppPermissionRoleServiceImpl implements AppPermissionRoleService { @Override public Page getPermissionRoleList(PageModel page, AppPermissionRoleListQuery query) { - org.springframework.data.domain.Page data; - Predicate predicate = appPermissionRoleConverter + org.springframework.data.domain.Page data; + Predicate predicate = permissionRoleConverter .rolePaginationParamConvertToPredicate(query); QPageRequest request = QPageRequest.of(page.getCurrent(), page.getPageSize()); data = appPermissionRoleRepository.findAll(predicate, request); - return appPermissionRoleConverter.entityConvertToRolePaginationResult(data); + return permissionRoleConverter.entityConvertToRolePaginationResult(data); } /** @@ -88,7 +88,7 @@ public class AppPermissionRoleServiceImpl implements AppPermissionRoleService { */ @Override public boolean createPermissionRole(AppPermissionRoleCreateParam param) { - AppPermissionRoleEntity entity = appPermissionRoleConverter + PermissionRoleEntity entity = permissionRoleConverter .roleCreateParamConvertToEntity(param); appPermissionRoleRepository.save(entity); return true; @@ -100,9 +100,9 @@ public class AppPermissionRoleServiceImpl implements AppPermissionRoleService { */ @Override public boolean updatePermissionRole(PermissionRoleUpdateParam param) { - AppPermissionRoleEntity source = appPermissionRoleConverter + PermissionRoleEntity source = permissionRoleConverter .roleUpdateParamConvertToEntity(param); - AppPermissionRoleEntity target = appPermissionRoleRepository + PermissionRoleEntity target = appPermissionRoleRepository .findById(Long.valueOf(param.getId())).orElseThrow(AppRoleNotExistException::new); BeanUtils.merge(source, target, LAST_MODIFIED_TIME, LAST_MODIFIED_BY); appPermissionRoleRepository.save(target); @@ -136,9 +136,9 @@ public class AppPermissionRoleServiceImpl implements AppPermissionRoleService { @Override public AppPermissionRoleResult getPermissionRole(Long id) { //查询 - Optional entity = appPermissionRoleRepository.findById(id); + Optional entity = appPermissionRoleRepository.findById(id); //映射 - return appPermissionRoleConverter.entityConvertToRoleDetailResult(entity.orElse(null)); + return permissionRoleConverter.entityConvertToRoleDetailResult(entity.orElse(null)); } /** @@ -155,7 +155,7 @@ public class AppPermissionRoleServiceImpl implements AppPermissionRoleService { public Boolean permissionRoleParamCheck(CheckValidityType type, String value, Long appId, Long id) { QAppPermissionRoleEntity role = QAppPermissionRoleEntity.appPermissionRoleEntity; - AppPermissionRoleEntity entity = new AppPermissionRoleEntity(); + PermissionRoleEntity entity = new PermissionRoleEntity(); boolean result = false; // ID存在说明是修改操作,查询一下当前数据 if (Objects.nonNull(id)) { @@ -199,7 +199,7 @@ public class AppPermissionRoleServiceImpl implements AppPermissionRoleService { /** * 用户数据映射器 */ - private final AppPermissionRoleConverter appPermissionRoleConverter; + private final PermissionRoleConverter permissionRoleConverter; /** * RoleRepository */