From 16ddae29d39a3461cf668b977972ab9cde0bd178 Mon Sep 17 00:00:00 2001 From: smallbun <2689170096@qq.com> Date: Mon, 18 Sep 2023 23:37:26 +0800 Subject: [PATCH 1/3] =?UTF-8?q?:zap:=20=E4=BC=98=E5=8C=96=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/constant/PermissionConstants.java | 27 ++++++++ .../AppPermissionActionEntity.java | 2 +- .../AppPermissionPolicyEntity.java | 2 +- .../AppPermissionResourceEntity.java | 2 +- .../AppPermissionRoleEntity.java | 2 +- .../po/AppPermissionPolicyPO.java | 2 +- ...missionPolicyRepositoryCustomizedImpl.java | 4 +- .../mapper/AppPermissionPolicyPoMapper.java | 2 +- .../AppPermissionActionRepository.java | 6 +- .../AppPermissionPolicyRepository.java | 4 +- ...pPermissionPolicyRepositoryCustomized.java | 4 +- .../AppPermissionResourceRepository.java | 4 +- .../AppPermissionRoleRepository.java | 4 +- .../src/pages/permission/Role/index.tsx | 20 ++---- .../PermissionActionController.java} | 29 ++++---- .../PermissionPolicyController.java} | 49 ++++++------- .../PermissionResourceController.java} | 65 +++++++++--------- .../PermissionRoleController.java} | 55 +++++++-------- .../setting/SmsProviderController.java | 2 +- .../PermissionActionConverter.java} | 38 +++++------ .../PermissionPolicyConverter.java} | 34 +++++----- .../PermissionResourceConverter.java} | 44 ++++++------ .../PermissionRoleConverter.java} | 38 +++++------ .../setting/MessageSettingConverter.java | 2 +- .../PermissionActionListQuery.java} | 4 +- .../PermissionResourceListQuery.java} | 4 +- .../PermissionRoleListQuery.java} | 4 +- .../PermissionActionListResult.java} | 4 +- .../PermissionPolicyGetResult.java} | 4 +- .../PermissionPolicyListResult.java} | 4 +- .../PermissionResourceGetResult.java} | 4 +- .../PermissionResourceListResult.java} | 4 +- .../PermissionRoleListResult.java} | 4 +- .../PermissionRoleResult.java} | 4 +- .../setting/SmsProviderConfigResult.java | 2 +- .../PermissionPolicyCreateParam.java} | 4 +- .../PermissionResourceCreateParam.java} | 8 +-- .../PermissionRoleCreateParam.java} | 4 +- .../PermissionsActionParam.java} | 4 +- .../PermissionPolicyUpdateParam.java} | 4 +- .../PermissionResourceUpdateParam.java} | 8 +-- .../PermissionRoleUpdateParam.java | 2 +- .../PermissionActionService.java} | 14 ++-- .../PermissionPolicyService.java} | 30 ++++---- .../PermissionResourceService.java} | 34 +++++----- .../PermissionRoleService.java} | 30 ++++---- .../impl/PermissionActionServiceImpl.java} | 28 ++++---- .../impl/PermissionPolicyServiceImpl.java} | 48 ++++++------- .../impl/PermissionResourceServiceImpl.java} | 68 +++++++++---------- .../impl/PermissionRoleServiceImpl.java} | 50 +++++++------- .../setting/MessageSettingService.java | 2 +- .../impl/MessageSettingServiceImpl.java | 2 +- .../app/AppPermissionActionConverter.java | 2 +- .../app/AppPermissionPolicyConverter.java | 4 +- .../app/AppPermissionResourceConverter.java | 2 +- .../app/AppPermissionRoleConverter.java | 2 +- .../AppPermissionPolicyEndpoint.java | 2 +- .../service/AppPermissionPolicyService.java | 2 +- .../impl/AppPermissionPolicyServiceImpl.java | 6 +- .../AppPermissionResourceServiceImpl.java | 10 +-- .../impl/AppPermissionRoleServiceImpl.java | 6 +- 61 files changed, 440 insertions(+), 419 deletions(-) create mode 100644 eiam-common/src/main/java/cn/topiam/employee/common/constant/PermissionConstants.java rename eiam-common/src/main/java/cn/topiam/employee/common/entity/{app => permission}/AppPermissionActionEntity.java (97%) rename eiam-common/src/main/java/cn/topiam/employee/common/entity/{app => permission}/AppPermissionPolicyEntity.java (98%) rename eiam-common/src/main/java/cn/topiam/employee/common/entity/{app => permission}/AppPermissionResourceEntity.java (98%) rename eiam-common/src/main/java/cn/topiam/employee/common/entity/{app => permission}/AppPermissionRoleEntity.java (97%) rename eiam-common/src/main/java/cn/topiam/employee/common/entity/{app => permission}/po/AppPermissionPolicyPO.java (97%) rename eiam-common/src/main/java/cn/topiam/employee/common/repository/{app => permission}/AppPermissionActionRepository.java (88%) rename eiam-common/src/main/java/cn/topiam/employee/common/repository/{app => permission}/AppPermissionPolicyRepository.java (96%) rename eiam-common/src/main/java/cn/topiam/employee/common/repository/{app => permission}/AppPermissionPolicyRepositoryCustomized.java (91%) rename eiam-common/src/main/java/cn/topiam/employee/common/repository/{app => permission}/AppPermissionResourceRepository.java (93%) rename eiam-common/src/main/java/cn/topiam/employee/common/repository/{app => permission}/AppPermissionRoleRepository.java (94%) rename eiam-common/src/main/java/cn/topiam/employee/common/schema/field/Input.java => eiam-console/src/main/console-fe/src/pages/permission/Role/index.tsx (69%) rename eiam-console/src/main/java/cn/topiam/employee/console/controller/{app/AppPermissionActionController.java => permission/PermissionActionController.java} (65%) rename eiam-console/src/main/java/cn/topiam/employee/console/controller/{app/AppPermissionPolicyController.java => permission/PermissionPolicyController.java} (70%) rename eiam-console/src/main/java/cn/topiam/employee/console/controller/{app/AppPermissionResourceController.java => permission/PermissionResourceController.java} (72%) rename eiam-console/src/main/java/cn/topiam/employee/console/controller/{app/AppPermissionRoleController.java => permission/PermissionRoleController.java} (75%) rename eiam-console/src/main/java/cn/topiam/employee/console/converter/{app/AppPermissionActionConverter.java => permission/PermissionActionConverter.java} (75%) rename eiam-console/src/main/java/cn/topiam/employee/console/converter/{app/AppPermissionPolicyConverter.java => permission/PermissionPolicyConverter.java} (68%) rename eiam-console/src/main/java/cn/topiam/employee/console/converter/{app/AppPermissionResourceConverter.java => permission/PermissionResourceConverter.java} (73%) rename eiam-console/src/main/java/cn/topiam/employee/console/converter/{app/AppPermissionRoleConverter.java => permission/PermissionRoleConverter.java} (76%) rename eiam-console/src/main/java/cn/topiam/employee/console/pojo/query/{app/AppPermissionActionListQuery.java => permission/PermissionActionListQuery.java} (93%) rename eiam-console/src/main/java/cn/topiam/employee/console/pojo/query/{app/AppResourceListQuery.java => permission/PermissionResourceListQuery.java} (92%) rename eiam-console/src/main/java/cn/topiam/employee/console/pojo/query/{app/AppPermissionRoleListQuery.java => permission/PermissionRoleListQuery.java} (93%) rename eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/{app/AppPermissionActionListResult.java => permission/PermissionActionListResult.java} (96%) rename eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/{app/AppPermissionPolicyGetResult.java => permission/PermissionPolicyGetResult.java} (95%) rename eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/{app/AppPermissionPolicyListResult.java => permission/PermissionPolicyListResult.java} (95%) rename eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/{app/AppPermissionResourceGetResult.java => permission/PermissionResourceGetResult.java} (95%) rename eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/{app/AppPermissionResourceListResult.java => permission/PermissionResourceListResult.java} (93%) rename eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/{app/AppPermissionRoleListResult.java => permission/PermissionRoleListResult.java} (94%) rename eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/{app/AppPermissionRoleResult.java => permission/PermissionRoleResult.java} (93%) rename eiam-console/src/main/java/cn/topiam/employee/console/pojo/{ => result}/setting/SmsProviderConfigResult.java (97%) rename eiam-console/src/main/java/cn/topiam/employee/console/pojo/save/{app/AppPermissionPolicyCreateParam.java => permission/PermissionPolicyCreateParam.java} (95%) rename eiam-console/src/main/java/cn/topiam/employee/console/pojo/save/{app/AppPermissionResourceCreateParam.java => permission/PermissionResourceCreateParam.java} (89%) rename eiam-console/src/main/java/cn/topiam/employee/console/pojo/save/{app/AppPermissionRoleCreateParam.java => permission/PermissionRoleCreateParam.java} (93%) rename eiam-console/src/main/java/cn/topiam/employee/console/pojo/save/{app/AppPermissionsActionParam.java => permission/PermissionsActionParam.java} (93%) rename eiam-console/src/main/java/cn/topiam/employee/console/pojo/update/{app/AppPermissionPolicyUpdateParam.java => permission/PermissionPolicyUpdateParam.java} (95%) rename eiam-console/src/main/java/cn/topiam/employee/console/pojo/update/{app/AppPermissionResourceUpdateParam.java => permission/PermissionResourceUpdateParam.java} (90%) rename eiam-console/src/main/java/cn/topiam/employee/console/pojo/update/{app => permission}/PermissionRoleUpdateParam.java (96%) rename eiam-console/src/main/java/cn/topiam/employee/console/service/{app/AppPermissionActionService.java => permission/PermissionActionService.java} (68%) rename eiam-console/src/main/java/cn/topiam/employee/console/service/{app/AppPermissionPolicyService.java => permission/PermissionPolicyService.java} (61%) rename eiam-console/src/main/java/cn/topiam/employee/console/service/{app/AppPermissionResourceService.java => permission/PermissionResourceService.java} (66%) rename eiam-console/src/main/java/cn/topiam/employee/console/service/{app/AppPermissionRoleService.java => permission/PermissionRoleService.java} (69%) rename eiam-console/src/main/java/cn/topiam/employee/console/service/{app/impl/AppPermissionActionServiceImpl.java => permission/impl/PermissionActionServiceImpl.java} (58%) rename eiam-console/src/main/java/cn/topiam/employee/console/service/{app/impl/AppPermissionPolicyServiceImpl.java => permission/impl/PermissionPolicyServiceImpl.java} (64%) rename eiam-console/src/main/java/cn/topiam/employee/console/service/{app/impl/AppPermissionResourceServiceImpl.java => permission/impl/PermissionResourceServiceImpl.java} (78%) rename eiam-console/src/main/java/cn/topiam/employee/console/service/{app/impl/AppPermissionRoleServiceImpl.java => permission/impl/PermissionRoleServiceImpl.java} (79%) 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/AppPermissionActionEntity.java similarity index 97% 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/AppPermissionActionEntity.java index 7a224a82..dbf3da03 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/AppPermissionActionEntity.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; 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/AppPermissionPolicyEntity.java similarity index 98% 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/AppPermissionPolicyEntity.java index 42ed8177..6f14bdc1 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/AppPermissionPolicyEntity.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; 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/AppPermissionResourceEntity.java similarity index 98% 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/AppPermissionResourceEntity.java index 888891ed..f63c1204 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/AppPermissionResourceEntity.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; 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/AppPermissionRoleEntity.java similarity index 97% 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/AppPermissionRoleEntity.java index 0c307428..b2dedb43 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/AppPermissionRoleEntity.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; 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/AppPermissionPolicyPO.java similarity index 97% 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/AppPermissionPolicyPO.java index 48fdd6d4..08b0d595 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/AppPermissionPolicyPO.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; 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..7e3c1997 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 @@ -28,10 +28,10 @@ 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.entity.permission.po.AppPermissionPolicyPO; import cn.topiam.employee.common.repository.app.impl.mapper.AppPermissionPolicyPoMapper; +import cn.topiam.employee.common.repository.permission.AppPermissionPolicyRepositoryCustomized; import lombok.RequiredArgsConstructor; 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..954a586c 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 @@ -22,7 +22,7 @@ import java.sql.SQLException; import org.springframework.jdbc.core.RowMapper; -import cn.topiam.employee.common.entity.app.po.AppPermissionPolicyPO; +import cn.topiam.employee.common.entity.permission.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; diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppPermissionActionRepository.java b/eiam-common/src/main/java/cn/topiam/employee/common/repository/permission/AppPermissionActionRepository.java similarity index 88% rename from eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppPermissionActionRepository.java rename to eiam-common/src/main/java/cn/topiam/employee/common/repository/permission/AppPermissionActionRepository.java index a8113c3a..c1735c95 100644 --- a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppPermissionActionRepository.java +++ b/eiam-common/src/main/java/cn/topiam/employee/common/repository/permission/AppPermissionActionRepository.java @@ -15,15 +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.common.repository.app; +package cn.topiam.employee.common.repository.permission; import java.util.List; 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.common.entity.permission.AppPermissionActionEntity; +import cn.topiam.employee.common.entity.permission.AppPermissionResourceEntity; import cn.topiam.employee.support.repository.LogicDeleteRepository; /** 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 96% 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..76e2f0f7 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,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.repository.app; +package cn.topiam.employee.common.repository.permission; import java.io.Serializable; import java.util.Collection; @@ -27,7 +27,7 @@ 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.common.entity.permission.AppPermissionPolicyEntity; import cn.topiam.employee.support.repository.LogicDeleteRepository; import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_SET; 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 91% 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..6eba8eca 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,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.common.repository.app; +package cn.topiam.employee.common.repository.permission; 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; +import cn.topiam.employee.common.entity.permission.po.AppPermissionPolicyPO; /** * @author TopIAM 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 93% 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..6170c4f6 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,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.repository.app; +package cn.topiam.employee.common.repository.permission; import java.util.Optional; @@ -25,7 +25,7 @@ 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.common.entity.permission.AppPermissionResourceEntity; import cn.topiam.employee.support.repository.LogicDeleteRepository; /** 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 94% 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..9a2253d0 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,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.repository.app; +package cn.topiam.employee.common.repository.permission; import java.util.Optional; @@ -28,7 +28,7 @@ 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.common.entity.permission.AppPermissionRoleEntity; import cn.topiam.employee.support.repository.LogicDeleteRepository; /** diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/schema/field/Input.java b/eiam-console/src/main/console-fe/src/pages/permission/Role/index.tsx similarity index 69% rename from eiam-common/src/main/java/cn/topiam/employee/common/schema/field/Input.java rename to eiam-console/src/main/console-fe/src/pages/permission/Role/index.tsx index 0e60ae50..ca28800c 100644 --- a/eiam-common/src/main/java/cn/topiam/employee/common/schema/field/Input.java +++ b/eiam-console/src/main/console-fe/src/pages/permission/Role/index.tsx @@ -1,5 +1,5 @@ /* - * eiam-common - Employee Identity and Access Management + * 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 @@ -15,18 +15,8 @@ * 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.schema.field; +import Role from './Role'; -/** - * Input 输入框 - * - * @author TopIAM - * Created by support@topiam.cn on 2023/4/12 21:28 - */ -public class Input extends Field { - - public Input(String title) { - super("string"); - this.title = title; - } -} +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 75% 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..6e69fd76 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,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.converter.app; +package cn.topiam.employee.console.converter.permission; import java.util.ArrayList; import java.util.List; @@ -28,12 +28,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.AppPermissionActionEntity; -import cn.topiam.employee.common.entity.app.AppPermissionResourceEntity; import cn.topiam.employee.common.entity.app.QAppPermissionResourceEntity; +import cn.topiam.employee.common.entity.permission.AppPermissionActionEntity; +import cn.topiam.employee.common.entity.permission.AppPermissionResourceEntity; 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)); @@ -69,15 +69,15 @@ public interface AppPermissionActionConverter { * 实体转资源权限结果返回 * * @param list {@link AppPermissionResourceEntity} - * @return {@link AppPermissionActionListResult} + * @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<>(); + 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()) { if (PermissionActionType.MENU.equals(action.getType())) { @@ -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()); @@ -118,9 +118,9 @@ public interface AppPermissionActionConverter { * actionConvertToResourceActionResult * * @param action {@link AppPermissionActionEntity} - * @return {@link AppPermissionActionListResult.Action} + * @return {@link PermissionActionListResult.Action} */ @Mapping(target = "access", source = "value") - AppPermissionActionListResult.Action actionConvertToResourceActionResult(AppPermissionActionEntity action); + PermissionActionListResult.Action actionConvertToResourceActionResult(AppPermissionActionEntity 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 68% 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..e383c918 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.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.common.entity.permission.AppPermissionPolicyEntity; +import cn.topiam.employee.common.entity.permission.po.AppPermissionPolicyPO; +import cn.topiam.employee.console.pojo.update.permission.PermissionPolicyUpdateParam; import cn.topiam.employee.support.repository.page.domain.Page; /** @@ -37,13 +37,13 @@ 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} + * @param param {@link PermissionPolicyCreateParam} * @return {@link AppPermissionPolicyEntity} */ @Mapping(target = "deleted", ignore = true) @@ -53,12 +53,12 @@ public interface AppPermissionPolicyConverter { @Mapping(target = "remark", ignore = true) @Mapping(target = "createTime", ignore = true) @Mapping(target = "createBy", ignore = true) - AppPermissionPolicyEntity policyCreateParamConvertToEntity(AppPermissionPolicyCreateParam param); + AppPermissionPolicyEntity policyCreateParamConvertToEntity(PermissionPolicyCreateParam param); /** * 资源修改参数转实体类 * - * @param param {@link AppPermissionPolicyCreateParam} + * @param param {@link PermissionPolicyCreateParam} * @return {@link AppPermissionPolicyEntity} */ @Mapping(target = "deleted", 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); + AppPermissionPolicyEntity policyUpdateParamConvertToEntity(PermissionPolicyUpdateParam param); /** * 资源转换为资源列表结果 @@ -75,8 +75,8 @@ public interface AppPermissionPolicyConverter { * @param page {@link Page} * @return {@link Page} */ - default Page entityConvertToPolicyListResult(org.springframework.data.domain.Page page) { - Page result = new Page<>(); + default Page entityConvertToPolicyListResult(org.springframework.data.domain.Page page) { + Page result = new Page<>(); List pageList = page.getContent(); if (!CollectionUtils.isEmpty(pageList)) { //@formatter:off @@ -86,7 +86,7 @@ public interface AppPermissionPolicyConverter { .current(page.getPageable().getPageNumber() + 1) .build()); //@formatter:on - List list = new ArrayList<>(); + List list = new ArrayList<>(); for (AppPermissionPolicyPO po : pageList) { list.add(entityConvertToPolicyListResult(po)); } @@ -98,8 +98,8 @@ public interface AppPermissionPolicyConverter { /** * entityConvertToPolicyListResult * - * @param entity {@link AppPermissionPolicyListResult} + * @param entity {@link PermissionPolicyListResult} * @return {@link AppPermissionPolicyPO} */ - AppPermissionPolicyListResult entityConvertToPolicyListResult(AppPermissionPolicyPO entity); + PermissionPolicyListResult entityConvertToPolicyListResult(AppPermissionPolicyPO 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 73% 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..e840c3d8 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,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.converter.app; +package cn.topiam.employee.console.converter.permission; import java.util.ArrayList; import java.util.List; +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 +32,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.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.common.entity.permission.AppPermissionResourceEntity; +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,7 +70,7 @@ public interface AppPermissionResourceConverter { /** * 资源创建参数转实体类 * - * @param param {@link AppPermissionResourceCreateParam} + * @param param {@link PermissionResourceCreateParam} * @return {@link AppPermissionResourceEntity} */ @Mapping(target = "deleted", ignore = true) @@ -81,12 +81,12 @@ public interface AppPermissionResourceConverter { @Mapping(target = "remark", ignore = true) @Mapping(target = "createTime", ignore = true) @Mapping(target = "createBy", ignore = true) - AppPermissionResourceEntity resourceCreateParamConvertToEntity(AppPermissionResourceCreateParam param); + AppPermissionResourceEntity resourceCreateParamConvertToEntity(PermissionResourceCreateParam param); /** * 资源修改参数转实体类 * - * @param param {@link AppPermissionResourceCreateParam} + * @param param {@link PermissionResourceCreateParam} * @return {@link AppPermissionResourceEntity} */ @Mapping(target = "deleted", 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); + AppPermissionResourceEntity resourceUpdateParamConvertToEntity(PermissionResourceUpdateParam param); /** * 资源转换为资源列表结果 @@ -104,11 +104,11 @@ public interface AppPermissionResourceConverter { * @param page {@link Page} * @return {@link Page} */ - default Page entityConvertToResourceListResult(org.springframework.data.domain.Page page) { - Page result = new Page<>(); + 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<>(); + List list = new ArrayList<>(); for (AppPermissionResourceEntity resource : pageList) { list.add(entityConvertToResourceListResult(resource)); } @@ -128,16 +128,16 @@ public interface AppPermissionResourceConverter { * 实体转换为资源列表结果 * * @param data {@link AppPermissionResourceEntity} - * @return {@link AppPermissionResourceListResult} + * @return {@link PermissionResourceListResult} */ - AppPermissionResourceListResult entityConvertToResourceListResult(AppPermissionResourceEntity data); + PermissionResourceListResult entityConvertToResourceListResult(AppPermissionResourceEntity data); /** * 实体转获取详情返回 * * @param resource {@link AppPermissionResourceEntity} - * @return {@link AppPermissionResourceGetResult} + * @return {@link PermissionResourceGetResult} */ @Mapping(target = "actions", source = "actions") - AppPermissionResourceGetResult entityConvertToResourceGetResult(AppPermissionResourceEntity resource); + PermissionResourceGetResult entityConvertToResourceGetResult(AppPermissionResourceEntity 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 76% 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..d37c3e0a 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.AppPermissionRoleEntity; +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,10 +53,10 @@ 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<>(); + List list = new ArrayList<>(); for (AppPermissionRoleEntity user : page.getContent()) { list.add(entityConvertToRolePaginationResult(user)); } @@ -76,14 +76,14 @@ public interface AppPermissionRoleConverter { * 角色实体转换为角色分页结果 * * @param page {@link AppPermissionRoleEntity} - * @return {@link AppPermissionRoleListResult} + * @return {@link PermissionRoleListResult} */ - AppPermissionRoleListResult entityConvertToRolePaginationResult(AppPermissionRoleEntity page); + PermissionRoleListResult entityConvertToRolePaginationResult(AppPermissionRoleEntity page); /** * 角色创建参数转换为角色实体 * - * @param param {@link AppPermissionRoleCreateParam} + * @param param {@link PermissionRoleCreateParam} * @return {@link AppPermissionRoleEntity} */ @Mapping(target = "deleted", ignore = true) @@ -93,7 +93,7 @@ public interface AppPermissionRoleConverter { @Mapping(target = "updateBy", ignore = true) @Mapping(target = "createTime", ignore = true) @Mapping(target = "createBy", ignore = true) - AppPermissionRoleEntity roleCreateParamConvertToEntity(AppPermissionRoleCreateParam param); + AppPermissionRoleEntity roleCreateParamConvertToEntity(PermissionRoleCreateParam param); /** * 角色更新参数转换为角色实体类 @@ -114,17 +114,17 @@ public interface AppPermissionRoleConverter { * 实体转系统详情结果 * * @param role {@link AppPermissionRoleEntity} - * @return {@link AppPermissionRoleResult} + * @return {@link PermissionRoleResult} */ - AppPermissionRoleResult entityConvertToRoleDetailResult(AppPermissionRoleEntity role); + PermissionRoleResult entityConvertToRoleDetailResult(AppPermissionRoleEntity role); /** * 角色分页查询参数转实体 * - * @param query {@link AppPermissionRoleListQuery} + * @param query {@link PermissionRoleListQuery} * @return {@link AppPermissionRoleEntity} */ - 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 58% 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..ae818747 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.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.entity.permission.AppPermissionResourceEntity; +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 .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 64% 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..a3534a8f 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.AppPermissionPolicyEntity; +import cn.topiam.employee.common.entity.permission.po.AppPermissionPolicyPO; 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) { + 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) { + AppPermissionPolicyEntity 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) { + AppPermissionPolicyEntity 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 78% 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..0cba28a0 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,10 @@ import java.util.Objects; import java.util.Set; import java.util.stream.Collectors; +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 +38,18 @@ 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.entity.permission.AppPermissionActionEntity; +import cn.topiam.employee.common.entity.permission.AppPermissionResourceEntity; 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) { + public Page getPermissionResourceList(PageModel page, + PermissionResourceListQuery query) { org.springframework.data.domain.Page data; - Predicate predicate = appPermissionResourceConverter + 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) { + public PermissionResourceGetResult getPermissionResource(String id) { AppPermissionResourceEntity resource = appResourceRepository.findById(Long.valueOf(id)) .orElseThrow(AppResourceNotExistException::new); - return appPermissionResourceConverter.entityConvertToResourceGetResult(resource); + return permissionResourceConverter.entityConvertToResourceGetResult(resource); } /** @@ -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) { + AppPermissionResourceEntity resource = permissionResourceConverter .resourceCreateParamConvertToEntity(param); buildActions(param.getActions(), resource); // 新增资源 @@ -164,13 +164,13 @@ 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) { + AppPermissionResourceEntity resource = permissionResourceConverter .resourceUpdateParamConvertToEntity(param); AppPermissionResourceEntity entity = getAppPermissionResourceEntity( Long.valueOf(param.getId())); @@ -248,14 +248,14 @@ public class AppPermissionResourceServiceImpl implements AppPermissionResourceSe /** * 批量处理actions * - * @param permissions {@link List} + * @param permissions {@link List< PermissionsActionParam >} * @param resource {@link AppPermissionResourceEntity>} */ - private void buildActions(List permissions, + private void buildActions(List permissions, AppPermissionResourceEntity resource) { // 权限 List list = new ArrayList<>(); - for (AppPermissionsActionParam p : permissions) { + for (PermissionsActionParam p : permissions) { AppPermissionActionEntity entity = new AppPermissionActionEntity(); entity.setResource(resource); entity.setType(p.getType()); @@ -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 79% 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..ff69b12a 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.AppPermissionRoleEntity; 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) { + public Page getPermissionRoleList(PageModel page, + PermissionRoleListQuery query) { org.springframework.data.domain.Page data; - Predicate predicate = appPermissionRoleConverter + 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) { + AppPermissionRoleEntity entity = permissionRoleConverter .roleCreateParamConvertToEntity(param); appPermissionRoleRepository.save(entity); AuditContext.setTarget(Target.builder().id(entity.getId().toString()) @@ -105,7 +105,7 @@ public class AppPermissionRoleServiceImpl implements AppPermissionRoleService { */ @Override public boolean updatePermissionRole(PermissionRoleUpdateParam param) { - AppPermissionRoleEntity source = appPermissionRoleConverter + AppPermissionRoleEntity source = permissionRoleConverter .roleUpdateParamConvertToEntity(param); AppPermissionRoleEntity target = appPermissionRoleRepository .findById(Long.valueOf(param.getId())).orElseThrow(AppRoleNotExistException::new); @@ -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); //映射 - return appPermissionRoleConverter.entityConvertToRoleDetailResult(entity.orElse(null)); + return permissionRoleConverter.entityConvertToRoleDetailResult(entity.orElse(null)); } /** @@ -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/app/AppPermissionActionConverter.java index 83396cdb..fab71c28 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/app/AppPermissionActionConverter.java @@ -20,7 +20,7 @@ package cn.topiam.employee.openapi.converter.app; import org.mapstruct.Mapper; import org.mapstruct.Mapping; -import cn.topiam.employee.common.entity.app.AppPermissionActionEntity; +import cn.topiam.employee.common.entity.permission.AppPermissionActionEntity; import cn.topiam.employee.openapi.pojo.request.app.AppPermissionsActionParam; /** 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/app/AppPermissionPolicyConverter.java index 1596e1ab..9302c07f 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/app/AppPermissionPolicyConverter.java @@ -23,8 +23,8 @@ 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.common.entity.permission.AppPermissionPolicyEntity; +import cn.topiam.employee.common.entity.permission.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; 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/app/AppPermissionResourceConverter.java index f039ff60..d92bbcf8 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/app/AppPermissionResourceConverter.java @@ -28,8 +28,8 @@ 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.common.entity.permission.AppPermissionResourceEntity; import cn.topiam.employee.openapi.pojo.request.app.query.AppResourceListQuery; import cn.topiam.employee.openapi.pojo.request.app.save.AppPermissionResourceCreateParam; import cn.topiam.employee.openapi.pojo.request.app.update.AppPermissionResourceUpdateParam; 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/app/AppPermissionRoleConverter.java index 3b6c7156..0bb1b79a 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/app/AppPermissionRoleConverter.java @@ -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.AppPermissionRoleEntity; 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; 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/AppPermissionPolicyEndpoint.java index d6d3d9ef..4a13be00 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/AppPermissionPolicyEndpoint.java @@ -22,7 +22,7 @@ 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.common.entity.permission.po.AppPermissionPolicyPO; import cn.topiam.employee.openapi.pojo.request.app.query.OpenApiPolicyQuery; import cn.topiam.employee.openapi.service.AppPermissionPolicyService; import cn.topiam.employee.support.repository.page.domain.Page; 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/AppPermissionPolicyService.java index fe7c94e8..55d623f3 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/AppPermissionPolicyService.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.AppPermissionPolicyPO; 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; 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/AppPermissionPolicyServiceImpl.java index 643ee508..57590c05 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/AppPermissionPolicyServiceImpl.java @@ -21,11 +21,11 @@ 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.AppPermissionPolicyEntity; +import cn.topiam.employee.common.entity.permission.po.AppPermissionPolicyPO; import cn.topiam.employee.common.exception.app.AppPolicyNotExistException; -import cn.topiam.employee.common.repository.app.AppPermissionPolicyRepository; +import cn.topiam.employee.common.repository.permission.AppPermissionPolicyRepository; import cn.topiam.employee.openapi.converter.app.AppPermissionPolicyConverter; import cn.topiam.employee.openapi.pojo.request.app.query.OpenApiPolicyQuery; import cn.topiam.employee.openapi.pojo.request.app.save.AppPermissionPolicyCreateParam; 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/AppPermissionResourceServiceImpl.java index e7d1bb26..8c48d2ee 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/AppPermissionResourceServiceImpl.java @@ -31,14 +31,14 @@ 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.entity.permission.AppPermissionActionEntity; +import cn.topiam.employee.common.entity.permission.AppPermissionResourceEntity; 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.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.converter.app.AppPermissionResourceConverter; import cn.topiam.employee.openapi.pojo.request.app.AppPermissionsActionParam; import cn.topiam.employee.openapi.pojo.request.app.query.AppResourceListQuery; 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/AppPermissionRoleServiceImpl.java index 3194c22b..23742471 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/AppPermissionRoleServiceImpl.java @@ -30,12 +30,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.AppPermissionRoleEntity; import cn.topiam.employee.common.entity.app.QAppPermissionRoleEntity; +import cn.topiam.employee.common.entity.permission.AppPermissionRoleEntity; 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.common.repository.permission.AppPermissionPolicyRepository; +import cn.topiam.employee.common.repository.permission.AppPermissionRoleRepository; import cn.topiam.employee.openapi.converter.app.AppPermissionRoleConverter; import cn.topiam.employee.openapi.pojo.request.app.query.AppPermissionRoleListQuery; import cn.topiam.employee.openapi.pojo.request.app.save.AppPermissionRoleCreateParam; From 54ac2665cee652a410acb6a5f4a4c0b822650f37 Mon Sep 17 00:00:00 2001 From: smallbun <2689170096@qq.com> Date: Mon, 18 Sep 2023 23:40:33 +0800 Subject: [PATCH 2/3] =?UTF-8?q?:zap:=20=E4=BC=98=E5=8C=96=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ntity.java => PermissionActionEntity.java} | 4 +- ...ntity.java => PermissionPolicyEntity.java} | 2 +- ...ity.java => PermissionResourceEntity.java} | 4 +- ...eEntity.java => PermissionRoleEntity.java} | 2 +- ...nPolicyPO.java => PermissionPolicyPO.java} | 2 +- ...missionPolicyRepositoryCustomizedImpl.java | 6 +- .../mapper/AppPermissionPolicyPoMapper.java | 26 ++-- .../AppPermissionActionRepository.java | 12 +- .../AppPermissionPolicyRepository.java | 8 +- ...pPermissionPolicyRepositoryCustomized.java | 6 +- .../AppPermissionResourceRepository.java | 10 +- .../AppPermissionRoleRepository.java | 10 +- .../permission/PermissionActionConverter.java | 16 +-- .../permission/PermissionPolicyConverter.java | 22 +-- .../PermissionResourceConverter.java | 24 ++-- .../permission/PermissionRoleConverter.java | 24 ++-- .../impl/PermissionActionServiceImpl.java | 4 +- .../impl/PermissionPolicyServiceImpl.java | 10 +- .../impl/PermissionResourceServiceImpl.java | 42 +++--- .../impl/PermissionRoleServiceImpl.java | 14 +- ...er.java => PermissionActionConverter.java} | 8 +- ...er.java => PermissionPolicyConverter.java} | 22 +-- ....java => PermissionResourceConverter.java} | 28 ++-- ...rter.java => PermissionRoleConverter.java} | 26 ++-- .../AppPermissionPolicyEndpoint.java | 12 +- .../service/AppPermissionPolicyService.java | 6 +- .../impl/AppPermissionPolicyServiceImpl.java | 22 +-- .../AppPermissionResourceServiceImpl.java | 44 +++--- .../impl/AppPermissionRoleServiceImpl.java | 24 ++-- .../app/PermissionActionConverterImpl.java | 45 +++++++ .../app/PermissionPolicyConverterImpl.java | 53 ++++++++ .../app/PermissionResourceConverterImpl.java | 125 ++++++++++++++++++ .../app/PermissionRoleConverterImpl.java | 98 ++++++++++++++ 33 files changed, 541 insertions(+), 220 deletions(-) rename eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/{AppPermissionActionEntity.java => PermissionActionEntity.java} (94%) rename eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/{AppPermissionPolicyEntity.java => PermissionPolicyEntity.java} (97%) rename eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/{AppPermissionResourceEntity.java => PermissionResourceEntity.java} (95%) rename eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/{AppPermissionRoleEntity.java => PermissionRoleEntity.java} (96%) rename eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/po/{AppPermissionPolicyPO.java => PermissionPolicyPO.java} (97%) rename eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/app/{AppPermissionActionConverter.java => PermissionActionConverter.java} (85%) rename eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/app/{AppPermissionPolicyConverter.java => PermissionPolicyConverter.java} (76%) rename eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/app/{AppPermissionResourceConverter.java => PermissionResourceConverter.java} (84%) rename eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/app/{AppPermissionRoleConverter.java => PermissionRoleConverter.java} (85%) create mode 100644 eiam-openapi/target/generated-sources/annotations/cn/topiam/employee/openapi/converter/app/PermissionActionConverterImpl.java create mode 100644 eiam-openapi/target/generated-sources/annotations/cn/topiam/employee/openapi/converter/app/PermissionPolicyConverterImpl.java create mode 100644 eiam-openapi/target/generated-sources/annotations/cn/topiam/employee/openapi/converter/app/PermissionResourceConverterImpl.java create mode 100644 eiam-openapi/target/generated-sources/annotations/cn/topiam/employee/openapi/converter/app/PermissionRoleConverterImpl.java diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/AppPermissionActionEntity.java b/eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/PermissionActionEntity.java similarity index 94% rename from eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/AppPermissionActionEntity.java rename to eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/PermissionActionEntity.java index dbf3da03..8655e58b 100644 --- a/eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/AppPermissionActionEntity.java +++ b/eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/PermissionActionEntity.java @@ -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/permission/AppPermissionPolicyEntity.java b/eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/PermissionPolicyEntity.java similarity index 97% rename from eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/AppPermissionPolicyEntity.java rename to eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/PermissionPolicyEntity.java index 6f14bdc1..8ca2d8f8 100644 --- a/eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/AppPermissionPolicyEntity.java +++ b/eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/PermissionPolicyEntity.java @@ -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/permission/AppPermissionResourceEntity.java b/eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/PermissionResourceEntity.java similarity index 95% rename from eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/AppPermissionResourceEntity.java rename to eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/PermissionResourceEntity.java index f63c1204..99fbf8a3 100644 --- a/eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/AppPermissionResourceEntity.java +++ b/eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/PermissionResourceEntity.java @@ -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/permission/AppPermissionRoleEntity.java b/eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/PermissionRoleEntity.java similarity index 96% rename from eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/AppPermissionRoleEntity.java rename to eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/PermissionRoleEntity.java index b2dedb43..5e3055ae 100644 --- a/eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/AppPermissionRoleEntity.java +++ b/eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/PermissionRoleEntity.java @@ -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/permission/po/AppPermissionPolicyPO.java b/eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/po/PermissionPolicyPO.java similarity index 97% rename from eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/po/AppPermissionPolicyPO.java rename to eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/po/PermissionPolicyPO.java index 08b0d595..662d7991 100644 --- a/eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/po/AppPermissionPolicyPO.java +++ b/eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/po/PermissionPolicyPO.java @@ -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 7e3c1997..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; @@ -29,7 +30,6 @@ import org.springframework.util.ObjectUtils; import com.google.common.collect.Lists; import cn.topiam.employee.common.entity.app.query.AppPolicyQuery; -import cn.topiam.employee.common.entity.permission.po.AppPermissionPolicyPO; import cn.topiam.employee.common.repository.app.impl.mapper.AppPermissionPolicyPoMapper; import cn.topiam.employee.common.repository.permission.AppPermissionPolicyRepositoryCustomized; @@ -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 954a586c..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.permission.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, - 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/permission/AppPermissionPolicyRepository.java b/eiam-common/src/main/java/cn/topiam/employee/common/repository/permission/AppPermissionPolicyRepository.java index 76e2f0f7..4bea3303 100644 --- a/eiam-common/src/main/java/cn/topiam/employee/common/repository/permission/AppPermissionPolicyRepository.java +++ b/eiam-common/src/main/java/cn/topiam/employee/common/repository/permission/AppPermissionPolicyRepository.java @@ -20,6 +20,7 @@ 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.permission.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/permission/AppPermissionPolicyRepositoryCustomized.java b/eiam-common/src/main/java/cn/topiam/employee/common/repository/permission/AppPermissionPolicyRepositoryCustomized.java index 6eba8eca..c65c1ee0 100644 --- a/eiam-common/src/main/java/cn/topiam/employee/common/repository/permission/AppPermissionPolicyRepositoryCustomized.java +++ b/eiam-common/src/main/java/cn/topiam/employee/common/repository/permission/AppPermissionPolicyRepositoryCustomized.java @@ -17,11 +17,11 @@ */ 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.query.AppPolicyQuery; -import cn.topiam.employee.common.entity.permission.po.AppPermissionPolicyPO; /** * @author TopIAM @@ -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/permission/AppPermissionResourceRepository.java b/eiam-common/src/main/java/cn/topiam/employee/common/repository/permission/AppPermissionResourceRepository.java index 6170c4f6..169e5293 100644 --- a/eiam-common/src/main/java/cn/topiam/employee/common/repository/permission/AppPermissionResourceRepository.java +++ b/eiam-common/src/main/java/cn/topiam/employee/common/repository/permission/AppPermissionResourceRepository.java @@ -19,13 +19,13 @@ 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.permission.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/permission/AppPermissionRoleRepository.java b/eiam-common/src/main/java/cn/topiam/employee/common/repository/permission/AppPermissionRoleRepository.java index 9a2253d0..c545d62d 100644 --- a/eiam-common/src/main/java/cn/topiam/employee/common/repository/permission/AppPermissionRoleRepository.java +++ b/eiam-common/src/main/java/cn/topiam/employee/common/repository/permission/AppPermissionRoleRepository.java @@ -19,6 +19,7 @@ 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.permission.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/java/cn/topiam/employee/console/converter/permission/PermissionActionConverter.java b/eiam-console/src/main/java/cn/topiam/employee/console/converter/permission/PermissionActionConverter.java index 6e69fd76..ef46a91b 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/converter/permission/PermissionActionConverter.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/converter/permission/PermissionActionConverter.java @@ -20,6 +20,8 @@ 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; @@ -29,8 +31,6 @@ import com.querydsl.core.types.ExpressionUtils; import com.querydsl.core.types.Predicate; import cn.topiam.employee.common.entity.app.QAppPermissionResourceEntity; -import cn.topiam.employee.common.entity.permission.AppPermissionActionEntity; -import cn.topiam.employee.common.entity.permission.AppPermissionResourceEntity; import cn.topiam.employee.common.enums.PermissionActionType; import cn.topiam.employee.console.pojo.query.permission.PermissionActionListQuery; import cn.topiam.employee.console.pojo.result.permission.PermissionActionListResult; @@ -68,18 +68,18 @@ public interface PermissionActionConverter { /** * 实体转资源权限结果返回 * - * @param list {@link AppPermissionResourceEntity} + * @param list {@link PermissionResourceEntity} * @return {@link PermissionActionListResult} */ - default List entityConvertToResourceActionListResult(List list) { + 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()) { + for (PermissionResourceEntity resource : list) { + for (PermissionActionEntity action : resource.getActions()) { if (PermissionActionType.MENU.equals(action.getType())) { menus.add(actionConvertToResourceActionResult(action)); } @@ -117,10 +117,10 @@ public interface PermissionActionConverter { /** * actionConvertToResourceActionResult * - * @param action {@link AppPermissionActionEntity} + * @param action {@link PermissionActionEntity} * @return {@link PermissionActionListResult.Action} */ @Mapping(target = "access", source = "value") - PermissionActionListResult.Action actionConvertToResourceActionResult(AppPermissionActionEntity action); + PermissionActionListResult.Action actionConvertToResourceActionResult(PermissionActionEntity action); } diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/converter/permission/PermissionPolicyConverter.java b/eiam-console/src/main/java/cn/topiam/employee/console/converter/permission/PermissionPolicyConverter.java index e383c918..437723ea 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/converter/permission/PermissionPolicyConverter.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/converter/permission/PermissionPolicyConverter.java @@ -20,14 +20,14 @@ 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.permission.AppPermissionPolicyEntity; -import cn.topiam.employee.common.entity.permission.po.AppPermissionPolicyPO; import cn.topiam.employee.console.pojo.update.permission.PermissionPolicyUpdateParam; import cn.topiam.employee.support.repository.page.domain.Page; @@ -44,7 +44,7 @@ public interface PermissionPolicyConverter { * 资源创建参数转实体类 * * @param param {@link PermissionPolicyCreateParam} - * @return {@link AppPermissionPolicyEntity} + * @return {@link PermissionPolicyEntity} */ @Mapping(target = "deleted", ignore = true) @Mapping(target = "id", ignore = true) @@ -53,13 +53,13 @@ public interface PermissionPolicyConverter { @Mapping(target = "remark", ignore = true) @Mapping(target = "createTime", ignore = true) @Mapping(target = "createBy", ignore = true) - AppPermissionPolicyEntity policyCreateParamConvertToEntity(PermissionPolicyCreateParam param); + PermissionPolicyEntity policyCreateParamConvertToEntity(PermissionPolicyCreateParam param); /** * 资源修改参数转实体类 * * @param param {@link PermissionPolicyCreateParam} - * @return {@link AppPermissionPolicyEntity} + * @return {@link PermissionPolicyEntity} */ @Mapping(target = "deleted", ignore = true) @Mapping(target = "updateTime", ignore = true) @@ -67,7 +67,7 @@ public interface PermissionPolicyConverter { @Mapping(target = "remark", ignore = true) @Mapping(target = "createTime", ignore = true) @Mapping(target = "createBy", ignore = true) - AppPermissionPolicyEntity policyUpdateParamConvertToEntity(PermissionPolicyUpdateParam param); + PermissionPolicyEntity policyUpdateParamConvertToEntity(PermissionPolicyUpdateParam param); /** * 资源转换为资源列表结果 @@ -75,9 +75,9 @@ public interface PermissionPolicyConverter { * @param page {@link Page} * @return {@link Page} */ - default Page entityConvertToPolicyListResult(org.springframework.data.domain.Page page) { + default Page entityConvertToPolicyListResult(org.springframework.data.domain.Page page) { Page result = new Page<>(); - List pageList = page.getContent(); + List pageList = page.getContent(); if (!CollectionUtils.isEmpty(pageList)) { //@formatter:off result.setPagination(Page.Pagination.builder() @@ -87,7 +87,7 @@ public interface PermissionPolicyConverter { .build()); //@formatter:on List list = new ArrayList<>(); - for (AppPermissionPolicyPO po : pageList) { + for (PermissionPolicyPO po : pageList) { list.add(entityConvertToPolicyListResult(po)); } result.setList(list); @@ -99,7 +99,7 @@ public interface PermissionPolicyConverter { * entityConvertToPolicyListResult * * @param entity {@link PermissionPolicyListResult} - * @return {@link AppPermissionPolicyPO} + * @return {@link PermissionPolicyPO} */ - PermissionPolicyListResult entityConvertToPolicyListResult(AppPermissionPolicyPO entity); + PermissionPolicyListResult entityConvertToPolicyListResult(PermissionPolicyPO entity); } diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/converter/permission/PermissionResourceConverter.java b/eiam-console/src/main/java/cn/topiam/employee/console/converter/permission/PermissionResourceConverter.java index e840c3d8..ce6df9ea 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/converter/permission/PermissionResourceConverter.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/converter/permission/PermissionResourceConverter.java @@ -20,6 +20,7 @@ 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; @@ -33,7 +34,6 @@ import com.querydsl.core.types.ExpressionUtils; import com.querydsl.core.types.Predicate; import cn.topiam.employee.common.entity.app.QAppPermissionResourceEntity; -import cn.topiam.employee.common.entity.permission.AppPermissionResourceEntity; 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; @@ -71,7 +71,7 @@ public interface PermissionResourceConverter { * 资源创建参数转实体类 * * @param param {@link PermissionResourceCreateParam} - * @return {@link AppPermissionResourceEntity} + * @return {@link PermissionResourceEntity} */ @Mapping(target = "deleted", ignore = true) @Mapping(target = "actions", ignore = true) @@ -81,13 +81,13 @@ public interface PermissionResourceConverter { @Mapping(target = "remark", ignore = true) @Mapping(target = "createTime", ignore = true) @Mapping(target = "createBy", ignore = true) - AppPermissionResourceEntity resourceCreateParamConvertToEntity(PermissionResourceCreateParam param); + PermissionResourceEntity resourceCreateParamConvertToEntity(PermissionResourceCreateParam param); /** * 资源修改参数转实体类 * * @param param {@link PermissionResourceCreateParam} - * @return {@link AppPermissionResourceEntity} + * @return {@link PermissionResourceEntity} */ @Mapping(target = "deleted", ignore = true) @Mapping(target = "actions", ignore = true) @@ -96,7 +96,7 @@ public interface PermissionResourceConverter { @Mapping(target = "remark", ignore = true) @Mapping(target = "createTime", ignore = true) @Mapping(target = "createBy", ignore = true) - AppPermissionResourceEntity resourceUpdateParamConvertToEntity(PermissionResourceUpdateParam param); + PermissionResourceEntity resourceUpdateParamConvertToEntity(PermissionResourceUpdateParam param); /** * 资源转换为资源列表结果 @@ -104,12 +104,12 @@ public interface PermissionResourceConverter { * @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 @@ -127,17 +127,17 @@ public interface PermissionResourceConverter { /** * 实体转换为资源列表结果 * - * @param data {@link AppPermissionResourceEntity} + * @param data {@link PermissionResourceEntity} * @return {@link PermissionResourceListResult} */ - PermissionResourceListResult entityConvertToResourceListResult(AppPermissionResourceEntity data); + PermissionResourceListResult entityConvertToResourceListResult(PermissionResourceEntity data); /** * 实体转获取详情返回 * - * @param resource {@link AppPermissionResourceEntity} + * @param resource {@link PermissionResourceEntity} * @return {@link PermissionResourceGetResult} */ @Mapping(target = "actions", source = "actions") - PermissionResourceGetResult entityConvertToResourceGetResult(AppPermissionResourceEntity resource); + PermissionResourceGetResult entityConvertToResourceGetResult(PermissionResourceEntity resource); } diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/converter/permission/PermissionRoleConverter.java b/eiam-console/src/main/java/cn/topiam/employee/console/converter/permission/PermissionRoleConverter.java index d37c3e0a..18b1310a 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/converter/permission/PermissionRoleConverter.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/converter/permission/PermissionRoleConverter.java @@ -31,7 +31,7 @@ import com.querydsl.core.types.ExpressionUtils; import com.querydsl.core.types.Predicate; import cn.topiam.employee.common.entity.app.QAppPermissionRoleEntity; -import cn.topiam.employee.common.entity.permission.AppPermissionRoleEntity; +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; @@ -53,11 +53,11 @@ public interface PermissionRoleConverter { * @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 PermissionRoleConverter { /** * 角色实体转换为角色分页结果 * - * @param page {@link AppPermissionRoleEntity} + * @param page {@link PermissionRoleEntity} * @return {@link PermissionRoleListResult} */ - PermissionRoleListResult entityConvertToRolePaginationResult(AppPermissionRoleEntity page); + PermissionRoleListResult entityConvertToRolePaginationResult(PermissionRoleEntity page); /** * 角色创建参数转换为角色实体 * * @param param {@link PermissionRoleCreateParam} - * @return {@link AppPermissionRoleEntity} + * @return {@link PermissionRoleEntity} */ @Mapping(target = "deleted", ignore = true) @Mapping(target = "id", ignore = true) @@ -93,13 +93,13 @@ public interface PermissionRoleConverter { @Mapping(target = "updateBy", ignore = true) @Mapping(target = "createTime", ignore = true) @Mapping(target = "createBy", ignore = true) - AppPermissionRoleEntity roleCreateParamConvertToEntity(PermissionRoleCreateParam 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,21 +108,21 @@ public interface PermissionRoleConverter { @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 PermissionRoleResult} */ - PermissionRoleResult entityConvertToRoleDetailResult(AppPermissionRoleEntity role); + PermissionRoleResult entityConvertToRoleDetailResult(PermissionRoleEntity role); /** * 角色分页查询参数转实体 * * @param query {@link PermissionRoleListQuery} - * @return {@link AppPermissionRoleEntity} + * @return {@link PermissionRoleEntity} */ default Predicate rolePaginationParamConvertToPredicate(PermissionRoleListQuery query) { QAppPermissionRoleEntity role = QAppPermissionRoleEntity.appPermissionRoleEntity; diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/service/permission/impl/PermissionActionServiceImpl.java b/eiam-console/src/main/java/cn/topiam/employee/console/service/permission/impl/PermissionActionServiceImpl.java index ae818747..e4220d5a 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/service/permission/impl/PermissionActionServiceImpl.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/service/permission/impl/PermissionActionServiceImpl.java @@ -19,12 +19,12 @@ 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.permission.AppPermissionResourceEntity; 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; @@ -54,7 +54,7 @@ public class PermissionActionServiceImpl implements PermissionActionService { public List getPermissionActionList(PermissionActionListQuery query) { Predicate predicate = permissionActionConverter .appPermissionActionListQueryConvertToPredicate(query); - List list = (List) appPermissionResourceRepository + List list = (List) appPermissionResourceRepository .findAll(predicate); return permissionActionConverter.entityConvertToResourceActionListResult(list); } diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/service/permission/impl/PermissionPolicyServiceImpl.java b/eiam-console/src/main/java/cn/topiam/employee/console/service/permission/impl/PermissionPolicyServiceImpl.java index a3534a8f..d5759175 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/service/permission/impl/PermissionPolicyServiceImpl.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/service/permission/impl/PermissionPolicyServiceImpl.java @@ -24,8 +24,8 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import cn.topiam.employee.common.entity.app.query.AppPolicyQuery; -import cn.topiam.employee.common.entity.permission.AppPermissionPolicyEntity; -import cn.topiam.employee.common.entity.permission.po.AppPermissionPolicyPO; +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.permission.AppPermissionPolicyRepository; import cn.topiam.employee.console.converter.permission.PermissionPolicyConverter; @@ -59,7 +59,7 @@ public class PermissionPolicyServiceImpl implements PermissionPolicyService { @Override public Page getPermissionPolicyList(PageModel page, AppPolicyQuery query) { - org.springframework.data.domain.Page data; + org.springframework.data.domain.Page data; QPageRequest request = QPageRequest.of(page.getCurrent(), page.getPageSize()); data = appPermissionPolicyRepository.findPage(query, request); return permissionPolicyConverter.entityConvertToPolicyListResult(data); @@ -100,7 +100,7 @@ public class PermissionPolicyServiceImpl implements PermissionPolicyService { @Override @Transactional(rollbackFor = Exception.class) public Boolean createPermissionPolicy(PermissionPolicyCreateParam param) { - AppPermissionPolicyEntity resource = permissionPolicyConverter + PermissionPolicyEntity resource = permissionPolicyConverter .policyCreateParamConvertToEntity(param); // 新增策略 appPermissionPolicyRepository.save(resource); @@ -115,7 +115,7 @@ public class PermissionPolicyServiceImpl implements PermissionPolicyService { */ @Override public Boolean updatePermissionPolicy(PermissionPolicyUpdateParam param) { - AppPermissionPolicyEntity resource = permissionPolicyConverter + PermissionPolicyEntity resource = permissionPolicyConverter .policyUpdateParamConvertToEntity(param); // 更新策略 appPermissionPolicyRepository.save(resource); diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/service/permission/impl/PermissionResourceServiceImpl.java b/eiam-console/src/main/java/cn/topiam/employee/console/service/permission/impl/PermissionResourceServiceImpl.java index 0cba28a0..5e274505 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/service/permission/impl/PermissionResourceServiceImpl.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/service/permission/impl/PermissionResourceServiceImpl.java @@ -23,6 +23,8 @@ 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; @@ -39,8 +41,6 @@ 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.QAppPermissionResourceEntity; -import cn.topiam.employee.common.entity.permission.AppPermissionActionEntity; -import cn.topiam.employee.common.entity.permission.AppPermissionResourceEntity; import cn.topiam.employee.common.enums.CheckValidityType; import cn.topiam.employee.common.exception.app.AppResourceNotExistException; import cn.topiam.employee.common.repository.permission.AppPermissionActionRepository; @@ -81,7 +81,7 @@ public class PermissionResourceServiceImpl implements PermissionResourceService @Override public Page getPermissionResourceList(PageModel page, PermissionResourceListQuery query) { - org.springframework.data.domain.Page data; + org.springframework.data.domain.Page data; Predicate predicate = permissionResourceConverter .resourcePaginationParamConvertToPredicate(query); QPageRequest request = QPageRequest.of(page.getCurrent(), page.getPageSize()); @@ -97,7 +97,7 @@ public class PermissionResourceServiceImpl implements PermissionResourceService */ @Override public PermissionResourceGetResult getPermissionResource(String id) { - AppPermissionResourceEntity resource = appResourceRepository.findById(Long.valueOf(id)) + PermissionResourceEntity resource = appResourceRepository.findById(Long.valueOf(id)) .orElseThrow(AppResourceNotExistException::new); return permissionResourceConverter.entityConvertToResourceGetResult(resource); } @@ -112,12 +112,12 @@ public class PermissionResourceServiceImpl implements PermissionResourceService @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 PermissionResourceServiceImpl implements PermissionResourceService */ @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()); @@ -151,7 +151,7 @@ public class PermissionResourceServiceImpl implements PermissionResourceService @Override @Transactional(rollbackFor = Exception.class) public Boolean createPermissionResource(PermissionResourceCreateParam param) { - AppPermissionResourceEntity resource = permissionResourceConverter + PermissionResourceEntity resource = permissionResourceConverter .resourceCreateParamConvertToEntity(param); buildActions(param.getActions(), resource); // 新增资源 @@ -170,22 +170,22 @@ public class PermissionResourceServiceImpl implements PermissionResourceService @Override @Transactional(rollbackFor = Exception.class) public Boolean updatePermissionResource(PermissionResourceUpdateParam param) { - AppPermissionResourceEntity resource = permissionResourceConverter + 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 PermissionResourceServiceImpl implements PermissionResourceService * 获取应用权限资源 * * @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 PermissionResourceServiceImpl implements PermissionResourceService 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)) { @@ -249,14 +249,14 @@ public class PermissionResourceServiceImpl implements PermissionResourceService * 批量处理actions * * @param permissions {@link List< PermissionsActionParam >} - * @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 (PermissionsActionParam p : permissions) { - AppPermissionActionEntity entity = new AppPermissionActionEntity(); + PermissionActionEntity entity = new PermissionActionEntity(); entity.setResource(resource); entity.setType(p.getType()); entity.setName(p.getName()); diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/service/permission/impl/PermissionRoleServiceImpl.java b/eiam-console/src/main/java/cn/topiam/employee/console/service/permission/impl/PermissionRoleServiceImpl.java index ff69b12a..23fd1101 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/service/permission/impl/PermissionRoleServiceImpl.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/service/permission/impl/PermissionRoleServiceImpl.java @@ -38,7 +38,7 @@ 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.QAppPermissionRoleEntity; -import cn.topiam.employee.common.entity.permission.AppPermissionRoleEntity; +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.permission.AppPermissionPolicyRepository; @@ -75,7 +75,7 @@ public class PermissionRoleServiceImpl implements PermissionRoleService { @Override public Page getPermissionRoleList(PageModel page, PermissionRoleListQuery query) { - org.springframework.data.domain.Page data; + org.springframework.data.domain.Page data; Predicate predicate = permissionRoleConverter .rolePaginationParamConvertToPredicate(query); QPageRequest request = QPageRequest.of(page.getCurrent(), page.getPageSize()); @@ -91,7 +91,7 @@ public class PermissionRoleServiceImpl implements PermissionRoleService { */ @Override public boolean createPermissionRole(PermissionRoleCreateParam param) { - AppPermissionRoleEntity entity = permissionRoleConverter + PermissionRoleEntity entity = permissionRoleConverter .roleCreateParamConvertToEntity(param); appPermissionRoleRepository.save(entity); AuditContext.setTarget(Target.builder().id(entity.getId().toString()) @@ -105,9 +105,9 @@ public class PermissionRoleServiceImpl implements PermissionRoleService { */ @Override public boolean updatePermissionRole(PermissionRoleUpdateParam param) { - AppPermissionRoleEntity source = permissionRoleConverter + 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); @@ -145,7 +145,7 @@ public class PermissionRoleServiceImpl implements PermissionRoleService { @Override public PermissionRoleResult getPermissionRole(Long id) { //查询 - Optional entity = appPermissionRoleRepository.findById(id); + Optional entity = appPermissionRoleRepository.findById(id); //映射 return permissionRoleConverter.entityConvertToRoleDetailResult(entity.orElse(null)); } @@ -164,7 +164,7 @@ public class PermissionRoleServiceImpl implements PermissionRoleService { 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)) { 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/app/PermissionActionConverter.java similarity index 85% 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/app/PermissionActionConverter.java index fab71c28..2376960f 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/app/PermissionActionConverter.java @@ -17,10 +17,10 @@ */ package cn.topiam.employee.openapi.converter.app; +import cn.topiam.employee.common.entity.permission.PermissionActionEntity; import org.mapstruct.Mapper; import org.mapstruct.Mapping; -import cn.topiam.employee.common.entity.permission.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/app/PermissionPolicyConverter.java similarity index 76% 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/app/PermissionPolicyConverter.java index 9302c07f..0bf5f68b 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/app/PermissionPolicyConverter.java @@ -19,12 +19,12 @@ package cn.topiam.employee.openapi.converter.app; 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.permission.AppPermissionPolicyEntity; -import cn.topiam.employee.common.entity.permission.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/app/PermissionResourceConverter.java similarity index 84% 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/app/PermissionResourceConverter.java index d92bbcf8..c04c44ec 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/app/PermissionResourceConverter.java @@ -20,6 +20,7 @@ package cn.topiam.employee.openapi.converter.app; 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; @@ -29,7 +30,6 @@ import com.querydsl.core.types.ExpressionUtils; import com.querydsl.core.types.Predicate; import cn.topiam.employee.common.entity.app.QAppPermissionResourceEntity; -import cn.topiam.employee.common.entity.permission.AppPermissionResourceEntity; import cn.topiam.employee.openapi.pojo.request.app.query.AppResourceListQuery; import cn.topiam.employee.openapi.pojo.request.app.save.AppPermissionResourceCreateParam; import cn.topiam.employee.openapi.pojo.request.app.update.AppPermissionResourceUpdateParam; @@ -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/app/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/app/PermissionRoleConverter.java index 0bb1b79a..ca8ee842 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/app/PermissionRoleConverter.java @@ -30,7 +30,7 @@ import com.querydsl.core.types.ExpressionUtils; import com.querydsl.core.types.Predicate; import cn.topiam.employee.common.entity.app.QAppPermissionRoleEntity; -import cn.topiam.employee.common.entity.permission.AppPermissionRoleEntity; +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/AppPermissionPolicyEndpoint.java index 4a13be00..12f5572d 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/AppPermissionPolicyEndpoint.java @@ -17,12 +17,12 @@ */ 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.permission.po.AppPermissionPolicyPO; import cn.topiam.employee.openapi.pojo.request.app.query.OpenApiPolicyQuery; import cn.topiam.employee.openapi.service.AppPermissionPolicyService; import cn.topiam.employee.support.repository.page.domain.Page; @@ -48,15 +48,15 @@ public class AppPermissionPolicyEndpoint { * 获取所有策略(分页) * * @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; 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/AppPermissionPolicyService.java index 55d623f3..7aa62cff 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/AppPermissionPolicyService.java @@ -17,7 +17,7 @@ */ package cn.topiam.employee.openapi.service; -import cn.topiam.employee.common.entity.permission.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; @@ -39,9 +39,9 @@ public interface AppPermissionPolicyService { * * @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/impl/AppPermissionPolicyServiceImpl.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/impl/AppPermissionPolicyServiceImpl.java index 57590c05..14d76bc8 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/AppPermissionPolicyServiceImpl.java @@ -17,16 +17,16 @@ */ 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.query.AppPolicyQuery; -import cn.topiam.employee.common.entity.permission.AppPermissionPolicyEntity; -import cn.topiam.employee.common.entity.permission.po.AppPermissionPolicyPO; +import cn.topiam.employee.common.entity.permission.PermissionPolicyEntity; import cn.topiam.employee.common.exception.app.AppPolicyNotExistException; import cn.topiam.employee.common.repository.permission.AppPermissionPolicyRepository; -import cn.topiam.employee.openapi.converter.app.AppPermissionPolicyConverter; +import cn.topiam.employee.openapi.converter.app.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; @@ -54,11 +54,11 @@ public class AppPermissionPolicyServiceImpl implements AppPermissionPolicyServic * * @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/AppPermissionResourceServiceImpl.java index 8c48d2ee..48f6afc7 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/AppPermissionResourceServiceImpl.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.app.PermissionResourceConverter; import org.apache.commons.lang3.StringUtils; import org.springframework.data.querydsl.QPageRequest; import org.springframework.stereotype.Service; @@ -32,14 +35,11 @@ import com.querydsl.core.types.Predicate; import com.querydsl.core.types.dsl.BooleanExpression; import cn.topiam.employee.common.entity.app.QAppPermissionResourceEntity; -import cn.topiam.employee.common.entity.permission.AppPermissionActionEntity; -import cn.topiam.employee.common.entity.permission.AppPermissionResourceEntity; import cn.topiam.employee.common.enums.CheckValidityType; import cn.topiam.employee.common.exception.app.AppResourceNotExistException; 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.converter.app.AppPermissionResourceConverter; 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; @@ -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/AppPermissionRoleServiceImpl.java index 23742471..b0cb1485 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/AppPermissionRoleServiceImpl.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; @@ -31,12 +32,11 @@ import com.querydsl.core.types.Predicate; import com.querydsl.core.types.dsl.BooleanExpression; import cn.topiam.employee.common.entity.app.QAppPermissionRoleEntity; -import cn.topiam.employee.common.entity.permission.AppPermissionRoleEntity; import cn.topiam.employee.common.enums.CheckValidityType; import cn.topiam.employee.common.exception.app.AppRoleNotExistException; import cn.topiam.employee.common.repository.permission.AppPermissionPolicyRepository; import cn.topiam.employee.common.repository.permission.AppPermissionRoleRepository; -import cn.topiam.employee.openapi.converter.app.AppPermissionRoleConverter; +import cn.topiam.employee.openapi.converter.app.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; @@ -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 */ diff --git a/eiam-openapi/target/generated-sources/annotations/cn/topiam/employee/openapi/converter/app/PermissionActionConverterImpl.java b/eiam-openapi/target/generated-sources/annotations/cn/topiam/employee/openapi/converter/app/PermissionActionConverterImpl.java new file mode 100644 index 00000000..117ff330 --- /dev/null +++ b/eiam-openapi/target/generated-sources/annotations/cn/topiam/employee/openapi/converter/app/PermissionActionConverterImpl.java @@ -0,0 +1,45 @@ +package cn.topiam.employee.openapi.converter.app; + +import cn.topiam.employee.common.entity.permission.PermissionActionEntity; +import cn.topiam.employee.openapi.pojo.request.app.AppPermissionsActionParam; +import javax.annotation.processing.Generated; +import org.springframework.stereotype.Component; + +@Generated( + value = "org.mapstruct.ap.MappingProcessor", + date = "2023-09-18T13:28:50+0800", + comments = "version: 1.5.5.Final, compiler: javac, environment: Java 17.0.8 (Azul Systems, Inc.)" +) +@Component +public class PermissionActionConverterImpl implements PermissionActionConverter { + + @Override + public PermissionActionEntity toEntity(AppPermissionsActionParam dto) { + if ( dto == null ) { + return null; + } + + PermissionActionEntity permissionActionEntity = new PermissionActionEntity(); + + permissionActionEntity.setValue( dto.getValue() ); + permissionActionEntity.setName( dto.getName() ); + permissionActionEntity.setType( dto.getType() ); + + return permissionActionEntity; + } + + @Override + public AppPermissionsActionParam toDTO(PermissionActionEntity entities) { + if ( entities == null ) { + return null; + } + + AppPermissionsActionParam appPermissionsActionParam = new AppPermissionsActionParam(); + + appPermissionsActionParam.setType( entities.getType() ); + appPermissionsActionParam.setValue( entities.getValue() ); + appPermissionsActionParam.setName( entities.getName() ); + + return appPermissionsActionParam; + } +} diff --git a/eiam-openapi/target/generated-sources/annotations/cn/topiam/employee/openapi/converter/app/PermissionPolicyConverterImpl.java b/eiam-openapi/target/generated-sources/annotations/cn/topiam/employee/openapi/converter/app/PermissionPolicyConverterImpl.java new file mode 100644 index 00000000..cb62f290 --- /dev/null +++ b/eiam-openapi/target/generated-sources/annotations/cn/topiam/employee/openapi/converter/app/PermissionPolicyConverterImpl.java @@ -0,0 +1,53 @@ +package cn.topiam.employee.openapi.converter.app; + +import cn.topiam.employee.common.entity.permission.PermissionPolicyEntity; +import cn.topiam.employee.openapi.pojo.request.app.save.AppPermissionPolicyCreateParam; +import cn.topiam.employee.openapi.pojo.request.app.update.AppPermissionPolicyUpdateParam; +import javax.annotation.processing.Generated; +import org.springframework.stereotype.Component; + +@Generated( + value = "org.mapstruct.ap.MappingProcessor", + date = "2023-09-18T13:28:50+0800", + comments = "version: 1.5.5.Final, compiler: javac, environment: Java 17.0.8 (Azul Systems, Inc.)" +) +@Component +public class PermissionPolicyConverterImpl implements PermissionPolicyConverter { + + @Override + public PermissionPolicyEntity policyCreateParamConvertToEntity(AppPermissionPolicyCreateParam param) { + if ( param == null ) { + return null; + } + + PermissionPolicyEntity permissionPolicyEntity = new PermissionPolicyEntity(); + + permissionPolicyEntity.setAppId( param.getAppId() ); + permissionPolicyEntity.setSubjectId( param.getSubjectId() ); + permissionPolicyEntity.setSubjectType( param.getSubjectType() ); + permissionPolicyEntity.setObjectId( param.getObjectId() ); + permissionPolicyEntity.setObjectType( param.getObjectType() ); + permissionPolicyEntity.setEffect( param.getEffect() ); + + return permissionPolicyEntity; + } + + @Override + public PermissionPolicyEntity policyUpdateParamConvertToEntity(AppPermissionPolicyUpdateParam param) { + if ( param == null ) { + return null; + } + + PermissionPolicyEntity permissionPolicyEntity = new PermissionPolicyEntity(); + + permissionPolicyEntity.setId( param.getId() ); + permissionPolicyEntity.setAppId( param.getAppId() ); + permissionPolicyEntity.setSubjectId( param.getSubjectId() ); + permissionPolicyEntity.setSubjectType( param.getSubjectType() ); + permissionPolicyEntity.setObjectId( param.getObjectId() ); + permissionPolicyEntity.setObjectType( param.getObjectType() ); + permissionPolicyEntity.setEffect( param.getEffect() ); + + return permissionPolicyEntity; + } +} diff --git a/eiam-openapi/target/generated-sources/annotations/cn/topiam/employee/openapi/converter/app/PermissionResourceConverterImpl.java b/eiam-openapi/target/generated-sources/annotations/cn/topiam/employee/openapi/converter/app/PermissionResourceConverterImpl.java new file mode 100644 index 00000000..1e6cad19 --- /dev/null +++ b/eiam-openapi/target/generated-sources/annotations/cn/topiam/employee/openapi/converter/app/PermissionResourceConverterImpl.java @@ -0,0 +1,125 @@ +package cn.topiam.employee.openapi.converter.app; + +import cn.topiam.employee.common.entity.permission.PermissionActionEntity; +import cn.topiam.employee.common.entity.permission.PermissionResourceEntity; +import cn.topiam.employee.openapi.pojo.request.app.save.AppPermissionResourceCreateParam; +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 java.util.ArrayList; +import java.util.List; +import javax.annotation.processing.Generated; +import org.springframework.stereotype.Component; + +@Generated( + value = "org.mapstruct.ap.MappingProcessor", + date = "2023-09-18T13:44:04+0800", + comments = "version: 1.5.5.Final, compiler: javac, environment: Java 17.0.8 (Azul Systems, Inc.)" +) +@Component +public class PermissionResourceConverterImpl implements PermissionResourceConverter { + + @Override + public PermissionResourceEntity resourceCreateParamConvertToEntity(AppPermissionResourceCreateParam param) { + if ( param == null ) { + return null; + } + + PermissionResourceEntity permissionResourceEntity = new PermissionResourceEntity(); + + permissionResourceEntity.setCode( param.getCode() ); + permissionResourceEntity.setName( param.getName() ); + permissionResourceEntity.setAppId( param.getAppId() ); + permissionResourceEntity.setDesc( param.getDesc() ); + permissionResourceEntity.setEnabled( param.getEnabled() ); + + return permissionResourceEntity; + } + + @Override + public PermissionResourceEntity resourceUpdateParamConvertToEntity(AppPermissionResourceUpdateParam param) { + if ( param == null ) { + return null; + } + + PermissionResourceEntity permissionResourceEntity = new PermissionResourceEntity(); + + if ( param.getId() != null ) { + permissionResourceEntity.setId( Long.parseLong( param.getId() ) ); + } + permissionResourceEntity.setName( param.getName() ); + permissionResourceEntity.setDesc( param.getDesc() ); + + permissionResourceEntity.setEnabled( Boolean.TRUE ); + + return permissionResourceEntity; + } + + @Override + public AppPermissionResourceListResult entityConvertToResourceListResult(PermissionResourceEntity data) { + if ( data == null ) { + return null; + } + + AppPermissionResourceListResult appPermissionResourceListResult = new AppPermissionResourceListResult(); + + if ( data.getId() != null ) { + appPermissionResourceListResult.setId( String.valueOf( data.getId() ) ); + } + appPermissionResourceListResult.setName( data.getName() ); + appPermissionResourceListResult.setCode( data.getCode() ); + if ( data.getAppId() != null ) { + appPermissionResourceListResult.setAppId( String.valueOf( data.getAppId() ) ); + } + appPermissionResourceListResult.setDesc( data.getDesc() ); + + return appPermissionResourceListResult; + } + + @Override + public AppPermissionResourceGetResult entityConvertToResourceGetResult(PermissionResourceEntity resource) { + if ( resource == null ) { + return null; + } + + AppPermissionResourceGetResult appPermissionResourceGetResult = new AppPermissionResourceGetResult(); + + appPermissionResourceGetResult.setActions( appPermissionActionEntityListToAppPermissionsActionList( resource.getActions() ) ); + appPermissionResourceGetResult.setName( resource.getName() ); + appPermissionResourceGetResult.setCode( resource.getCode() ); + appPermissionResourceGetResult.setDesc( resource.getDesc() ); + appPermissionResourceGetResult.setAppId( resource.getAppId() ); + + return appPermissionResourceGetResult; + } + + protected AppPermissionResourceGetResult.AppPermissionsAction appPermissionActionEntityToAppPermissionsAction(PermissionActionEntity permissionActionEntity) { + if ( permissionActionEntity == null ) { + return null; + } + + AppPermissionResourceGetResult.AppPermissionsAction appPermissionsAction = new AppPermissionResourceGetResult.AppPermissionsAction(); + + if ( permissionActionEntity.getId() != null ) { + appPermissionsAction.setId( String.valueOf( permissionActionEntity.getId() ) ); + } + appPermissionsAction.setType( permissionActionEntity.getType() ); + appPermissionsAction.setValue( permissionActionEntity.getValue() ); + appPermissionsAction.setName( permissionActionEntity.getName() ); + + return appPermissionsAction; + } + + protected List appPermissionActionEntityListToAppPermissionsActionList(List list) { + if ( list == null ) { + return null; + } + + List list1 = new ArrayList( list.size() ); + for ( PermissionActionEntity permissionActionEntity : list ) { + list1.add( appPermissionActionEntityToAppPermissionsAction(permissionActionEntity) ); + } + + return list1; + } +} diff --git a/eiam-openapi/target/generated-sources/annotations/cn/topiam/employee/openapi/converter/app/PermissionRoleConverterImpl.java b/eiam-openapi/target/generated-sources/annotations/cn/topiam/employee/openapi/converter/app/PermissionRoleConverterImpl.java new file mode 100644 index 00000000..d962eada --- /dev/null +++ b/eiam-openapi/target/generated-sources/annotations/cn/topiam/employee/openapi/converter/app/PermissionRoleConverterImpl.java @@ -0,0 +1,98 @@ +package cn.topiam.employee.openapi.converter.app; + +import cn.topiam.employee.common.entity.permission.PermissionRoleEntity; +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 javax.annotation.processing.Generated; +import org.springframework.stereotype.Component; + +@Generated( + value = "org.mapstruct.ap.MappingProcessor", + date = "2023-09-18T13:44:04+0800", + comments = "version: 1.5.5.Final, compiler: javac, environment: Java 17.0.8 (Azul Systems, Inc.)" +) +@Component +public class PermissionRoleConverterImpl implements PermissionRoleConverter { + + @Override + public AppPermissionRoleListResult entityConvertToRolePaginationResult(PermissionRoleEntity page) { + if ( page == null ) { + return null; + } + + AppPermissionRoleListResult appPermissionRoleListResult = new AppPermissionRoleListResult(); + + if ( page.getId() != null ) { + appPermissionRoleListResult.setId( String.valueOf( page.getId() ) ); + } + appPermissionRoleListResult.setName( page.getName() ); + appPermissionRoleListResult.setCode( page.getCode() ); + if ( page.getAppId() != null ) { + appPermissionRoleListResult.setAppId( String.valueOf( page.getAppId() ) ); + } + appPermissionRoleListResult.setEnabled( page.getEnabled() ); + appPermissionRoleListResult.setRemark( page.getRemark() ); + + return appPermissionRoleListResult; + } + + @Override + public PermissionRoleEntity roleCreateParamConvertToEntity(AppPermissionRoleCreateParam param) { + if ( param == null ) { + return null; + } + + PermissionRoleEntity permissionRoleEntity = new PermissionRoleEntity(); + + permissionRoleEntity.setRemark( param.getRemark() ); + permissionRoleEntity.setName( param.getName() ); + permissionRoleEntity.setCode( param.getCode() ); + permissionRoleEntity.setAppId( param.getAppId() ); + + permissionRoleEntity.setEnabled( Boolean.TRUE ); + + return permissionRoleEntity; + } + + @Override + public PermissionRoleEntity roleUpdateParamConvertToEntity(PermissionRoleUpdateParam param) { + if ( param == null ) { + return null; + } + + PermissionRoleEntity permissionRoleEntity = new PermissionRoleEntity(); + + if ( param.getId() != null ) { + permissionRoleEntity.setId( Long.parseLong( param.getId() ) ); + } + permissionRoleEntity.setRemark( param.getRemark() ); + permissionRoleEntity.setName( param.getName() ); + permissionRoleEntity.setCode( param.getCode() ); + + return permissionRoleEntity; + } + + @Override + public AppPermissionRoleResult entityConvertToRoleDetailResult(PermissionRoleEntity role) { + if ( role == null ) { + return null; + } + + AppPermissionRoleResult appPermissionRoleResult = new AppPermissionRoleResult(); + + if ( role.getId() != null ) { + appPermissionRoleResult.setId( String.valueOf( role.getId() ) ); + } + if ( role.getAppId() != null ) { + appPermissionRoleResult.setAppId( String.valueOf( role.getAppId() ) ); + } + appPermissionRoleResult.setName( role.getName() ); + appPermissionRoleResult.setCode( role.getCode() ); + appPermissionRoleResult.setEnabled( role.getEnabled() ); + appPermissionRoleResult.setRemark( role.getRemark() ); + + return appPermissionRoleResult; + } +} From dfd899914dd10c38e9014723c7ac1f54df218582 Mon Sep 17 00:00:00 2001 From: smallbun <2689170096@qq.com> Date: Mon, 18 Sep 2023 23:43:49 +0800 Subject: [PATCH 3/3] =?UTF-8?q?:zap:=20=E4=BC=98=E5=8C=96=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PermissionActionConverter.java | 2 +- .../PermissionPolicyConverter.java | 2 +- .../PermissionResourceConverter.java | 2 +- .../PermissionRoleConverter.java | 2 +- ...int.java => PermissionPolicyEndpoint.java} | 6 +- ...t.java => PermissionResourceEndpoint.java} | 8 +- ...point.java => PermissionRoleEndpoint.java} | 8 +- ...vice.java => PermissionActionService.java} | 2 +- ...vice.java => PermissionPolicyService.java} | 2 +- ...ce.java => PermissionResourceService.java} | 2 +- ...ervice.java => PermissionRoleService.java} | 2 +- ....java => PermissionActionServiceImpl.java} | 4 +- ....java => PermissionPolicyServiceImpl.java} | 6 +- ...ava => PermissionResourceServiceImpl.java} | 6 +- ...pl.java => PermissionRoleServiceImpl.java} | 6 +- .../app/PermissionActionConverterImpl.java | 45 ------- .../app/PermissionPolicyConverterImpl.java | 53 -------- .../app/PermissionResourceConverterImpl.java | 125 ------------------ .../app/PermissionRoleConverterImpl.java | 98 -------------- 19 files changed, 30 insertions(+), 351 deletions(-) rename eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/{app => permission}/PermissionActionConverter.java (96%) rename eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/{app => permission}/PermissionPolicyConverter.java (98%) rename eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/{app => permission}/PermissionResourceConverter.java (99%) rename eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/{app => permission}/PermissionRoleConverter.java (99%) rename eiam-openapi/src/main/java/cn/topiam/employee/openapi/endpoint/permission/{AppPermissionPolicyEndpoint.java => PermissionPolicyEndpoint.java} (93%) rename eiam-openapi/src/main/java/cn/topiam/employee/openapi/endpoint/permission/{AppPermissionResourceEndpoint.java => PermissionResourceEndpoint.java} (90%) rename eiam-openapi/src/main/java/cn/topiam/employee/openapi/endpoint/permission/{AppPermissionRoleEndpoint.java => PermissionRoleEndpoint.java} (91%) rename eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/{AppPermissionActionService.java => PermissionActionService.java} (98%) rename eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/{AppPermissionPolicyService.java => PermissionPolicyService.java} (98%) rename eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/{AppPermissionResourceService.java => PermissionResourceService.java} (98%) rename eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/{AppPermissionRoleService.java => PermissionRoleService.java} (98%) rename eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/impl/{AppPermissionActionServiceImpl.java => PermissionActionServiceImpl.java} (94%) rename eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/impl/{AppPermissionPolicyServiceImpl.java => PermissionPolicyServiceImpl.java} (95%) rename eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/impl/{AppPermissionResourceServiceImpl.java => PermissionResourceServiceImpl.java} (97%) rename eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/impl/{AppPermissionRoleServiceImpl.java => PermissionRoleServiceImpl.java} (97%) delete mode 100644 eiam-openapi/target/generated-sources/annotations/cn/topiam/employee/openapi/converter/app/PermissionActionConverterImpl.java delete mode 100644 eiam-openapi/target/generated-sources/annotations/cn/topiam/employee/openapi/converter/app/PermissionPolicyConverterImpl.java delete mode 100644 eiam-openapi/target/generated-sources/annotations/cn/topiam/employee/openapi/converter/app/PermissionResourceConverterImpl.java delete mode 100644 eiam-openapi/target/generated-sources/annotations/cn/topiam/employee/openapi/converter/app/PermissionRoleConverterImpl.java diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/app/PermissionActionConverter.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/permission/PermissionActionConverter.java similarity index 96% rename from eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/app/PermissionActionConverter.java rename to eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/permission/PermissionActionConverter.java index 2376960f..c79aa6eb 100644 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/app/PermissionActionConverter.java +++ b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/permission/PermissionActionConverter.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 cn.topiam.employee.common.entity.permission.PermissionActionEntity; import org.mapstruct.Mapper; diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/app/PermissionPolicyConverter.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/permission/PermissionPolicyConverter.java similarity index 98% rename from eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/app/PermissionPolicyConverter.java rename to eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/permission/PermissionPolicyConverter.java index 0bf5f68b..cd3c8a24 100644 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/app/PermissionPolicyConverter.java +++ b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/permission/PermissionPolicyConverter.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.List; diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/app/PermissionResourceConverter.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/permission/PermissionResourceConverter.java similarity index 99% rename from eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/app/PermissionResourceConverter.java rename to eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/permission/PermissionResourceConverter.java index c04c44ec..2bd5543f 100644 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/app/PermissionResourceConverter.java +++ b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/permission/PermissionResourceConverter.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; diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/app/PermissionRoleConverter.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/permission/PermissionRoleConverter.java similarity index 99% rename from eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/app/PermissionRoleConverter.java rename to eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/permission/PermissionRoleConverter.java index ca8ee842..bb8e5cf5 100644 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/app/PermissionRoleConverter.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; 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 93% 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 12f5572d..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 @@ -24,7 +24,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; 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,7 +43,7 @@ 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 { /** * 获取所有策略(分页) * @@ -59,5 +59,5 @@ public class AppPermissionPolicyEndpoint { 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 98% 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 7aa62cff..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 @@ -33,7 +33,7 @@ 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 { /** * 获取资源列表 * 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 95% 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 14d76bc8..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 @@ -26,12 +26,12 @@ 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.permission.AppPermissionPolicyRepository; -import cn.topiam.employee.openapi.converter.app.PermissionPolicyConverter; +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,7 +47,7 @@ import lombok.RequiredArgsConstructor; */ @Service @RequiredArgsConstructor -public class AppPermissionPolicyServiceImpl implements AppPermissionPolicyService { +public class PermissionPolicyServiceImpl implements PermissionPolicyService { /** * 获取策略列表 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 97% 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 48f6afc7..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 @@ -25,7 +25,7 @@ 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.app.PermissionResourceConverter; +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; @@ -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 { /** * 获取资源列表 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 97% 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 b0cb1485..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 @@ -36,13 +36,13 @@ import cn.topiam.employee.common.enums.CheckValidityType; import cn.topiam.employee.common.exception.app.AppRoleNotExistException; import cn.topiam.employee.common.repository.permission.AppPermissionPolicyRepository; import cn.topiam.employee.common.repository.permission.AppPermissionRoleRepository; -import cn.topiam.employee.openapi.converter.app.PermissionRoleConverter; +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 { /** * 获取所有角色(分页) diff --git a/eiam-openapi/target/generated-sources/annotations/cn/topiam/employee/openapi/converter/app/PermissionActionConverterImpl.java b/eiam-openapi/target/generated-sources/annotations/cn/topiam/employee/openapi/converter/app/PermissionActionConverterImpl.java deleted file mode 100644 index 117ff330..00000000 --- a/eiam-openapi/target/generated-sources/annotations/cn/topiam/employee/openapi/converter/app/PermissionActionConverterImpl.java +++ /dev/null @@ -1,45 +0,0 @@ -package cn.topiam.employee.openapi.converter.app; - -import cn.topiam.employee.common.entity.permission.PermissionActionEntity; -import cn.topiam.employee.openapi.pojo.request.app.AppPermissionsActionParam; -import javax.annotation.processing.Generated; -import org.springframework.stereotype.Component; - -@Generated( - value = "org.mapstruct.ap.MappingProcessor", - date = "2023-09-18T13:28:50+0800", - comments = "version: 1.5.5.Final, compiler: javac, environment: Java 17.0.8 (Azul Systems, Inc.)" -) -@Component -public class PermissionActionConverterImpl implements PermissionActionConverter { - - @Override - public PermissionActionEntity toEntity(AppPermissionsActionParam dto) { - if ( dto == null ) { - return null; - } - - PermissionActionEntity permissionActionEntity = new PermissionActionEntity(); - - permissionActionEntity.setValue( dto.getValue() ); - permissionActionEntity.setName( dto.getName() ); - permissionActionEntity.setType( dto.getType() ); - - return permissionActionEntity; - } - - @Override - public AppPermissionsActionParam toDTO(PermissionActionEntity entities) { - if ( entities == null ) { - return null; - } - - AppPermissionsActionParam appPermissionsActionParam = new AppPermissionsActionParam(); - - appPermissionsActionParam.setType( entities.getType() ); - appPermissionsActionParam.setValue( entities.getValue() ); - appPermissionsActionParam.setName( entities.getName() ); - - return appPermissionsActionParam; - } -} diff --git a/eiam-openapi/target/generated-sources/annotations/cn/topiam/employee/openapi/converter/app/PermissionPolicyConverterImpl.java b/eiam-openapi/target/generated-sources/annotations/cn/topiam/employee/openapi/converter/app/PermissionPolicyConverterImpl.java deleted file mode 100644 index cb62f290..00000000 --- a/eiam-openapi/target/generated-sources/annotations/cn/topiam/employee/openapi/converter/app/PermissionPolicyConverterImpl.java +++ /dev/null @@ -1,53 +0,0 @@ -package cn.topiam.employee.openapi.converter.app; - -import cn.topiam.employee.common.entity.permission.PermissionPolicyEntity; -import cn.topiam.employee.openapi.pojo.request.app.save.AppPermissionPolicyCreateParam; -import cn.topiam.employee.openapi.pojo.request.app.update.AppPermissionPolicyUpdateParam; -import javax.annotation.processing.Generated; -import org.springframework.stereotype.Component; - -@Generated( - value = "org.mapstruct.ap.MappingProcessor", - date = "2023-09-18T13:28:50+0800", - comments = "version: 1.5.5.Final, compiler: javac, environment: Java 17.0.8 (Azul Systems, Inc.)" -) -@Component -public class PermissionPolicyConverterImpl implements PermissionPolicyConverter { - - @Override - public PermissionPolicyEntity policyCreateParamConvertToEntity(AppPermissionPolicyCreateParam param) { - if ( param == null ) { - return null; - } - - PermissionPolicyEntity permissionPolicyEntity = new PermissionPolicyEntity(); - - permissionPolicyEntity.setAppId( param.getAppId() ); - permissionPolicyEntity.setSubjectId( param.getSubjectId() ); - permissionPolicyEntity.setSubjectType( param.getSubjectType() ); - permissionPolicyEntity.setObjectId( param.getObjectId() ); - permissionPolicyEntity.setObjectType( param.getObjectType() ); - permissionPolicyEntity.setEffect( param.getEffect() ); - - return permissionPolicyEntity; - } - - @Override - public PermissionPolicyEntity policyUpdateParamConvertToEntity(AppPermissionPolicyUpdateParam param) { - if ( param == null ) { - return null; - } - - PermissionPolicyEntity permissionPolicyEntity = new PermissionPolicyEntity(); - - permissionPolicyEntity.setId( param.getId() ); - permissionPolicyEntity.setAppId( param.getAppId() ); - permissionPolicyEntity.setSubjectId( param.getSubjectId() ); - permissionPolicyEntity.setSubjectType( param.getSubjectType() ); - permissionPolicyEntity.setObjectId( param.getObjectId() ); - permissionPolicyEntity.setObjectType( param.getObjectType() ); - permissionPolicyEntity.setEffect( param.getEffect() ); - - return permissionPolicyEntity; - } -} diff --git a/eiam-openapi/target/generated-sources/annotations/cn/topiam/employee/openapi/converter/app/PermissionResourceConverterImpl.java b/eiam-openapi/target/generated-sources/annotations/cn/topiam/employee/openapi/converter/app/PermissionResourceConverterImpl.java deleted file mode 100644 index 1e6cad19..00000000 --- a/eiam-openapi/target/generated-sources/annotations/cn/topiam/employee/openapi/converter/app/PermissionResourceConverterImpl.java +++ /dev/null @@ -1,125 +0,0 @@ -package cn.topiam.employee.openapi.converter.app; - -import cn.topiam.employee.common.entity.permission.PermissionActionEntity; -import cn.topiam.employee.common.entity.permission.PermissionResourceEntity; -import cn.topiam.employee.openapi.pojo.request.app.save.AppPermissionResourceCreateParam; -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 java.util.ArrayList; -import java.util.List; -import javax.annotation.processing.Generated; -import org.springframework.stereotype.Component; - -@Generated( - value = "org.mapstruct.ap.MappingProcessor", - date = "2023-09-18T13:44:04+0800", - comments = "version: 1.5.5.Final, compiler: javac, environment: Java 17.0.8 (Azul Systems, Inc.)" -) -@Component -public class PermissionResourceConverterImpl implements PermissionResourceConverter { - - @Override - public PermissionResourceEntity resourceCreateParamConvertToEntity(AppPermissionResourceCreateParam param) { - if ( param == null ) { - return null; - } - - PermissionResourceEntity permissionResourceEntity = new PermissionResourceEntity(); - - permissionResourceEntity.setCode( param.getCode() ); - permissionResourceEntity.setName( param.getName() ); - permissionResourceEntity.setAppId( param.getAppId() ); - permissionResourceEntity.setDesc( param.getDesc() ); - permissionResourceEntity.setEnabled( param.getEnabled() ); - - return permissionResourceEntity; - } - - @Override - public PermissionResourceEntity resourceUpdateParamConvertToEntity(AppPermissionResourceUpdateParam param) { - if ( param == null ) { - return null; - } - - PermissionResourceEntity permissionResourceEntity = new PermissionResourceEntity(); - - if ( param.getId() != null ) { - permissionResourceEntity.setId( Long.parseLong( param.getId() ) ); - } - permissionResourceEntity.setName( param.getName() ); - permissionResourceEntity.setDesc( param.getDesc() ); - - permissionResourceEntity.setEnabled( Boolean.TRUE ); - - return permissionResourceEntity; - } - - @Override - public AppPermissionResourceListResult entityConvertToResourceListResult(PermissionResourceEntity data) { - if ( data == null ) { - return null; - } - - AppPermissionResourceListResult appPermissionResourceListResult = new AppPermissionResourceListResult(); - - if ( data.getId() != null ) { - appPermissionResourceListResult.setId( String.valueOf( data.getId() ) ); - } - appPermissionResourceListResult.setName( data.getName() ); - appPermissionResourceListResult.setCode( data.getCode() ); - if ( data.getAppId() != null ) { - appPermissionResourceListResult.setAppId( String.valueOf( data.getAppId() ) ); - } - appPermissionResourceListResult.setDesc( data.getDesc() ); - - return appPermissionResourceListResult; - } - - @Override - public AppPermissionResourceGetResult entityConvertToResourceGetResult(PermissionResourceEntity resource) { - if ( resource == null ) { - return null; - } - - AppPermissionResourceGetResult appPermissionResourceGetResult = new AppPermissionResourceGetResult(); - - appPermissionResourceGetResult.setActions( appPermissionActionEntityListToAppPermissionsActionList( resource.getActions() ) ); - appPermissionResourceGetResult.setName( resource.getName() ); - appPermissionResourceGetResult.setCode( resource.getCode() ); - appPermissionResourceGetResult.setDesc( resource.getDesc() ); - appPermissionResourceGetResult.setAppId( resource.getAppId() ); - - return appPermissionResourceGetResult; - } - - protected AppPermissionResourceGetResult.AppPermissionsAction appPermissionActionEntityToAppPermissionsAction(PermissionActionEntity permissionActionEntity) { - if ( permissionActionEntity == null ) { - return null; - } - - AppPermissionResourceGetResult.AppPermissionsAction appPermissionsAction = new AppPermissionResourceGetResult.AppPermissionsAction(); - - if ( permissionActionEntity.getId() != null ) { - appPermissionsAction.setId( String.valueOf( permissionActionEntity.getId() ) ); - } - appPermissionsAction.setType( permissionActionEntity.getType() ); - appPermissionsAction.setValue( permissionActionEntity.getValue() ); - appPermissionsAction.setName( permissionActionEntity.getName() ); - - return appPermissionsAction; - } - - protected List appPermissionActionEntityListToAppPermissionsActionList(List list) { - if ( list == null ) { - return null; - } - - List list1 = new ArrayList( list.size() ); - for ( PermissionActionEntity permissionActionEntity : list ) { - list1.add( appPermissionActionEntityToAppPermissionsAction(permissionActionEntity) ); - } - - return list1; - } -} diff --git a/eiam-openapi/target/generated-sources/annotations/cn/topiam/employee/openapi/converter/app/PermissionRoleConverterImpl.java b/eiam-openapi/target/generated-sources/annotations/cn/topiam/employee/openapi/converter/app/PermissionRoleConverterImpl.java deleted file mode 100644 index d962eada..00000000 --- a/eiam-openapi/target/generated-sources/annotations/cn/topiam/employee/openapi/converter/app/PermissionRoleConverterImpl.java +++ /dev/null @@ -1,98 +0,0 @@ -package cn.topiam.employee.openapi.converter.app; - -import cn.topiam.employee.common.entity.permission.PermissionRoleEntity; -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 javax.annotation.processing.Generated; -import org.springframework.stereotype.Component; - -@Generated( - value = "org.mapstruct.ap.MappingProcessor", - date = "2023-09-18T13:44:04+0800", - comments = "version: 1.5.5.Final, compiler: javac, environment: Java 17.0.8 (Azul Systems, Inc.)" -) -@Component -public class PermissionRoleConverterImpl implements PermissionRoleConverter { - - @Override - public AppPermissionRoleListResult entityConvertToRolePaginationResult(PermissionRoleEntity page) { - if ( page == null ) { - return null; - } - - AppPermissionRoleListResult appPermissionRoleListResult = new AppPermissionRoleListResult(); - - if ( page.getId() != null ) { - appPermissionRoleListResult.setId( String.valueOf( page.getId() ) ); - } - appPermissionRoleListResult.setName( page.getName() ); - appPermissionRoleListResult.setCode( page.getCode() ); - if ( page.getAppId() != null ) { - appPermissionRoleListResult.setAppId( String.valueOf( page.getAppId() ) ); - } - appPermissionRoleListResult.setEnabled( page.getEnabled() ); - appPermissionRoleListResult.setRemark( page.getRemark() ); - - return appPermissionRoleListResult; - } - - @Override - public PermissionRoleEntity roleCreateParamConvertToEntity(AppPermissionRoleCreateParam param) { - if ( param == null ) { - return null; - } - - PermissionRoleEntity permissionRoleEntity = new PermissionRoleEntity(); - - permissionRoleEntity.setRemark( param.getRemark() ); - permissionRoleEntity.setName( param.getName() ); - permissionRoleEntity.setCode( param.getCode() ); - permissionRoleEntity.setAppId( param.getAppId() ); - - permissionRoleEntity.setEnabled( Boolean.TRUE ); - - return permissionRoleEntity; - } - - @Override - public PermissionRoleEntity roleUpdateParamConvertToEntity(PermissionRoleUpdateParam param) { - if ( param == null ) { - return null; - } - - PermissionRoleEntity permissionRoleEntity = new PermissionRoleEntity(); - - if ( param.getId() != null ) { - permissionRoleEntity.setId( Long.parseLong( param.getId() ) ); - } - permissionRoleEntity.setRemark( param.getRemark() ); - permissionRoleEntity.setName( param.getName() ); - permissionRoleEntity.setCode( param.getCode() ); - - return permissionRoleEntity; - } - - @Override - public AppPermissionRoleResult entityConvertToRoleDetailResult(PermissionRoleEntity role) { - if ( role == null ) { - return null; - } - - AppPermissionRoleResult appPermissionRoleResult = new AppPermissionRoleResult(); - - if ( role.getId() != null ) { - appPermissionRoleResult.setId( String.valueOf( role.getId() ) ); - } - if ( role.getAppId() != null ) { - appPermissionRoleResult.setAppId( String.valueOf( role.getAppId() ) ); - } - appPermissionRoleResult.setName( role.getName() ); - appPermissionRoleResult.setCode( role.getCode() ); - appPermissionRoleResult.setEnabled( role.getEnabled() ); - appPermissionRoleResult.setRemark( role.getRemark() ); - - return appPermissionRoleResult; - } -}