diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/query/AppAccessPolicyQueryParam.java b/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/query/AppAccessPolicyQueryParam.java new file mode 100644 index 00000000..06dd6898 --- /dev/null +++ b/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/query/AppAccessPolicyQueryParam.java @@ -0,0 +1,57 @@ +/* + * eiam-common - Employee Identity and Access Management + * Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +package cn.topiam.employee.common.entity.app.query; + +import cn.topiam.employee.common.enums.app.AppPolicySubjectType; + +import lombok.Data; + +/** + * 应用授权策略查询参数 + * + * @author TopIAM + * Created by support@topiam.cn on 2020/9/27 21:29 + */ +@Data +public class AppAccessPolicyQueryParam { + + /** + * 应用id + */ + private String appId; + + /** + * 授权主体 + */ + private String subjectName; + + /** + * 授权主体ID + */ + private String subjectId; + + /** + * 主体类型(用户、分组、组织机构) + */ + private AppPolicySubjectType subjectType; + + /** + * 应用名称 + */ + private String appName; +} diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/query/AppAccountQueryParam.java b/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/query/AppAccountQueryParam.java new file mode 100644 index 00000000..f413af94 --- /dev/null +++ b/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/query/AppAccountQueryParam.java @@ -0,0 +1,52 @@ +/* + * eiam-common - Employee Identity and Access Management + * Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +package cn.topiam.employee.common.entity.app.query; + +import lombok.Data; + +/** + * 应用账户查询入参 + * + * @author TOPIAM + * Created by support@topiam.cn on 2024/11/4 14:26 + */ +@Data +public class AppAccountQueryParam { + + /** + * appId + */ + private String appId; + /** + * 用户ID + */ + private String userId; + /** + * 用户名 + */ + private String username; + /** + * 账户名称 + */ + private String account; + + /** + * 应用名称 + */ + private String appName; +} diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/query/AppGroupAssociationListQueryParam.java b/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/query/AppGroupAssociationListQueryParam.java new file mode 100644 index 00000000..24e03c27 --- /dev/null +++ b/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/query/AppGroupAssociationListQueryParam.java @@ -0,0 +1,44 @@ +/* + * eiam-common - Employee Identity and Access Management + * Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +package cn.topiam.employee.common.entity.app.query; + +import java.io.Serial; +import java.io.Serializable; + +import lombok.Data; + +/** + * 查询应用列表入参 + * + * @author TOPIAM + * Created by support@topiam.cn on 2024/11/4 14:24 + */ +@Data +public class AppGroupAssociationListQueryParam implements Serializable { + @Serial + private static final long serialVersionUID = -7110595216804896858L; + /** + * 组ID + */ + private String id; + + /** + * 应用名称 + */ + private String appName; +} diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/query/AppGroupQueryParam.java b/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/query/AppGroupQueryParam.java new file mode 100644 index 00000000..aa5f589d --- /dev/null +++ b/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/query/AppGroupQueryParam.java @@ -0,0 +1,55 @@ +/* + * eiam-common - Employee Identity and Access Management + * Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +package cn.topiam.employee.common.entity.app.query; + +import java.io.Serializable; + +import cn.topiam.employee.common.enums.app.AppGroupType; + +import lombok.Data; + +/** + * 查询分组列表入参 + * + * @author TOPIAM + * Created by support@topiam.cn on 2024/11/4 14:23 + */ +@Data +public class AppGroupQueryParam implements Serializable { + + /** + * 分组名称 + */ + private String name; + + /** + * 应用名称 + */ + private String appName; + + /** + * 分组编码 + */ + private String code; + + /** + * 分组类型 + */ + private AppGroupType type; + +} diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/query/GetAppListQueryParam.java b/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/query/GetAppListQueryParam.java new file mode 100644 index 00000000..2b075507 --- /dev/null +++ b/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/query/GetAppListQueryParam.java @@ -0,0 +1,47 @@ +/* + * eiam-common - Employee Identity and Access Management + * Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +package cn.topiam.employee.common.entity.app.query; + +import java.io.Serial; +import java.io.Serializable; + +import lombok.Data; + +/** + * 查询应用列表 + * + * @author TOPIAM + * Created by support@topiam.cn on 2024/11/4 14:22 + */ +@Data +public class GetAppListQueryParam implements Serializable { + + @Serial + private static final long serialVersionUID = -4981513177967939516L; + + /** + * 应用名称 + */ + private String name; + + /** + * 应用分组ID + */ + private String groupId; + +} diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppAccessPolicyRepositoryCustomized.java b/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppAccessPolicyRepositoryCustomized.java index 4dff2526..1ad6ea93 100644 --- a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppAccessPolicyRepositoryCustomized.java +++ b/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppAccessPolicyRepositoryCustomized.java @@ -20,9 +20,8 @@ package cn.topiam.employee.common.repository.app; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; -import cn.topiam.employee.common.entity.account.query.UserListQuery; import cn.topiam.employee.common.entity.app.po.AppAccessPolicyPO; -import cn.topiam.employee.common.entity.app.query.AppAccessPolicyQuery; +import cn.topiam.employee.common.entity.app.query.AppAccessPolicyQueryParam; /** * 应用访问策略 Repository Customized @@ -36,8 +35,8 @@ public interface AppAccessPolicyRepositoryCustomized { * 获取应用授权策略列表 * * @param pageable {@link Pageable} - * @param query {@link UserListQuery} + * @param query {@link AppAccessPolicyQueryParam} * @return {@link Page} */ - Page getAppPolicyList(AppAccessPolicyQuery query, Pageable pageable); + Page getAppPolicyList(AppAccessPolicyQueryParam query, Pageable pageable); } diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppAccountRepository.java b/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppAccountRepository.java index 259ac424..8f8483a1 100644 --- a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppAccountRepository.java +++ b/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppAccountRepository.java @@ -71,7 +71,7 @@ public interface AppAccountRepository extends JpaRepository findByAppIdAndUserId(String appId, String userId); /** @@ -81,7 +81,7 @@ public interface AppAccountRepository extends JpaRepository findByAppIdAndUserIdAndDefaultedIsTrue(String appId, String userId); /** @@ -92,7 +92,7 @@ public interface AppAccountRepository extends JpaRepository findByAppIdAndUserIdAndAccount(String appId, String userId, String account); diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppAccountRepositoryCustomized.java b/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppAccountRepositoryCustomized.java index 79867de9..0997be00 100644 --- a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppAccountRepositoryCustomized.java +++ b/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppAccountRepositoryCustomized.java @@ -20,9 +20,8 @@ package cn.topiam.employee.common.repository.app; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; -import cn.topiam.employee.common.entity.account.query.UserListQuery; import cn.topiam.employee.common.entity.app.po.AppAccountPO; -import cn.topiam.employee.common.entity.app.query.AppAccountQuery; +import cn.topiam.employee.common.entity.app.query.AppAccountQueryParam; /** * 应用账户 Repository Customized @@ -36,8 +35,8 @@ public interface AppAccountRepositoryCustomized { * 获取应用账户列表 * * @param pageable {@link Pageable} - * @param query {@link UserListQuery} + * @param query {@link AppAccountQueryParam} * @return {@link Page} */ - Page getAppAccountList(AppAccountQuery query, Pageable pageable); + Page getAppAccountList(AppAccountQueryParam query, Pageable pageable); } diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppGroupAssociationRepositoryCustomized.java b/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppGroupAssociationRepositoryCustomized.java index 8090af8b..981cab8e 100644 --- a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppGroupAssociationRepositoryCustomized.java +++ b/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppGroupAssociationRepositoryCustomized.java @@ -21,7 +21,7 @@ import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import cn.topiam.employee.common.entity.app.AppEntity; -import cn.topiam.employee.common.entity.app.query.AppGroupAssociationListQuery; +import cn.topiam.employee.common.entity.app.query.AppGroupAssociationListQueryParam; /** * @author TopIAM @@ -32,10 +32,10 @@ public interface AppGroupAssociationRepositoryCustomized { /** * 获取应用组应用列表 * - * @param query {@link AppGroupAssociationListQuery} + * @param query {@link AppGroupAssociationListQueryParam} * @param pageable {@link Pageable} * @return {@link Page} */ - Page getAppGroupAssociationList(AppGroupAssociationListQuery query, + Page getAppGroupAssociationList(AppGroupAssociationListQueryParam query, Pageable pageable); } diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppGroupRepository.java b/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppGroupRepository.java index 5c791439..25f2d927 100644 --- a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppGroupRepository.java +++ b/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppGroupRepository.java @@ -85,4 +85,12 @@ public interface AppGroupRepository extends JpaRepository findByCode(@Param("code") String code); + + /** + * 编码存在校验 + * + * @param code {@link String} + * @return {@link boolean} + */ + boolean existsByCode(String code); } diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppGroupRepositoryCustomized.java b/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppGroupRepositoryCustomized.java index 0a651963..f99e3701 100644 --- a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppGroupRepositoryCustomized.java +++ b/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppGroupRepositoryCustomized.java @@ -23,8 +23,8 @@ import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import cn.topiam.employee.common.entity.app.po.AppGroupPO; -import cn.topiam.employee.common.entity.app.query.AppGroupAssociationListQuery; -import cn.topiam.employee.common.entity.app.query.AppGroupQuery; +import cn.topiam.employee.common.entity.app.query.AppGroupAssociationListQueryParam; +import cn.topiam.employee.common.entity.app.query.AppGroupQueryParam; /** * @author TopIAM @@ -35,20 +35,20 @@ public interface AppGroupRepositoryCustomized { /** * 获取应用组应用列表 * - * @param query {@link AppGroupAssociationListQuery} + * @param query {@link AppGroupAssociationListQueryParam} * @param pageable {@link Pageable} * @return {@link Page} */ - Page getAppGroupList(AppGroupQuery query, Pageable pageable); + Page getAppGroupList(AppGroupQueryParam query, Pageable pageable); /** * 查询应用组列表 * * @param subjectIds {@link List} - * @param query {@link AppGroupQuery} + * @param query {@link AppGroupQueryParam} * @return {@link List} */ - List getAppGroupList(List subjectIds, AppGroupQuery query); + List getAppGroupList(List subjectIds, AppGroupQueryParam query); /** * 根据当前用户和分组获取应用数量 diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppRepositoryCustomized.java b/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppRepositoryCustomized.java index 60e433e7..cf0eb33c 100644 --- a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppRepositoryCustomized.java +++ b/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppRepositoryCustomized.java @@ -24,7 +24,7 @@ import org.springframework.data.domain.Pageable; import cn.topiam.employee.common.entity.app.AppEntity; import cn.topiam.employee.common.entity.app.po.AppPO; -import cn.topiam.employee.common.entity.app.query.GetAppListQuery; +import cn.topiam.employee.common.entity.app.query.GetAppListQueryParam; /** * 应用 Repository Customized @@ -45,11 +45,12 @@ public interface AppRepositoryCustomized { * 根据主体ID,查询参数、分页条件获取应用列表 * * @param subjectIds {@link List} - * @param query {@link GetAppListQuery} + * @param query {@link GetAppListQueryParam} * @param pageable {@link Pageable} * @return {@link Page} */ - Page getAppList(List subjectIds, GetAppListQuery query, Pageable pageable); + Page getAppList(List subjectIds, GetAppListQueryParam query, + Pageable pageable); /** * 获取用户应用数量 diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/impl/AppAccessPolicyRepositoryCustomizedImpl.java b/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/impl/AppAccessPolicyRepositoryCustomizedImpl.java index 5a6723ac..63e1b426 100644 --- a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/impl/AppAccessPolicyRepositoryCustomizedImpl.java +++ b/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/impl/AppAccessPolicyRepositoryCustomizedImpl.java @@ -27,9 +27,8 @@ import org.springframework.data.domain.PageImpl; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Repository; -import cn.topiam.employee.common.entity.account.query.UserListQuery; import cn.topiam.employee.common.entity.app.po.AppAccessPolicyPO; -import cn.topiam.employee.common.entity.app.query.AppAccessPolicyQuery; +import cn.topiam.employee.common.entity.app.query.AppAccessPolicyQueryParam; import cn.topiam.employee.common.repository.app.AppAccessPolicyRepositoryCustomized; import cn.topiam.employee.support.exception.TopIamException; @@ -50,11 +49,12 @@ public class AppAccessPolicyRepositoryCustomizedImpl implements * 获取应用授权策略列表 * * @param pageable {@link Pageable} - * @param query {@link UserListQuery} + * @param query {@link AppAccessPolicyQueryParam} * @return {@link Page} */ @Override - public Page getAppPolicyList(AppAccessPolicyQuery query, Pageable pageable) { + public Page getAppPolicyList(AppAccessPolicyQueryParam query, + Pageable pageable) { Map args = new HashMap<>(); //@formatter:off String hql = """ diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/impl/AppAccountRepositoryCustomizedImpl.java b/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/impl/AppAccountRepositoryCustomizedImpl.java index 05cbd861..6e865ac2 100644 --- a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/impl/AppAccountRepositoryCustomizedImpl.java +++ b/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/impl/AppAccountRepositoryCustomizedImpl.java @@ -26,9 +26,8 @@ import org.springframework.data.domain.PageImpl; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Repository; -import cn.topiam.employee.common.entity.account.query.UserListQuery; import cn.topiam.employee.common.entity.app.po.AppAccountPO; -import cn.topiam.employee.common.entity.app.query.AppAccountQuery; +import cn.topiam.employee.common.entity.app.query.AppAccountQueryParam; import cn.topiam.employee.common.repository.app.AppAccountRepositoryCustomized; import lombok.AllArgsConstructor; @@ -50,11 +49,11 @@ public class AppAccountRepositoryCustomizedImpl implements AppAccountRepositoryC * 获取应用账户列表 * * @param pageable {@link Pageable} - * @param query {@link UserListQuery} + * @param query {@link AppAccountQueryParam} * @return {@link Page} */ @Override - public Page getAppAccountList(AppAccountQuery query, Pageable pageable) { + public Page getAppAccountList(AppAccountQueryParam query, Pageable pageable) { Map args = new HashMap<>(); //@formatter:off String hql = """ diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/impl/AppGroupAssociationRepositoryCustomizedImpl.java b/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/impl/AppGroupAssociationRepositoryCustomizedImpl.java index fbc39323..2e7edbca 100644 --- a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/impl/AppGroupAssociationRepositoryCustomizedImpl.java +++ b/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/impl/AppGroupAssociationRepositoryCustomizedImpl.java @@ -26,9 +26,8 @@ import org.springframework.data.domain.PageImpl; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Repository; -import cn.topiam.employee.common.entity.account.query.UserGroupMemberListQuery; import cn.topiam.employee.common.entity.app.AppEntity; -import cn.topiam.employee.common.entity.app.query.AppGroupAssociationListQuery; +import cn.topiam.employee.common.entity.app.query.AppGroupAssociationListQueryParam; import cn.topiam.employee.common.repository.app.AppGroupAssociationRepositoryCustomized; import lombok.AllArgsConstructor; @@ -48,13 +47,13 @@ public class AppGroupAssociationRepositoryCustomizedImpl implements /** * 获取应用组应用列表 * - * @param query {@link UserGroupMemberListQuery} + * @param query {@link AppGroupAssociationListQueryParam} * @param pageable {@link Pageable} * @return {@link Page} */ @SuppressWarnings("DuplicatedCode") @Override - public Page getAppGroupAssociationList(AppGroupAssociationListQuery query, + public Page getAppGroupAssociationList(AppGroupAssociationListQueryParam query, Pageable pageable) { Map args = new HashMap<>(); //@formatter:off diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/impl/AppGroupRepositoryCustomizedImpl.java b/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/impl/AppGroupRepositoryCustomizedImpl.java index d439f290..502792c8 100644 --- a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/impl/AppGroupRepositoryCustomizedImpl.java +++ b/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/impl/AppGroupRepositoryCustomizedImpl.java @@ -28,9 +28,8 @@ import org.springframework.data.domain.PageImpl; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Repository; -import cn.topiam.employee.common.entity.account.query.UserGroupMemberListQuery; import cn.topiam.employee.common.entity.app.po.AppGroupPO; -import cn.topiam.employee.common.entity.app.query.AppGroupQuery; +import cn.topiam.employee.common.entity.app.query.AppGroupQueryParam; import cn.topiam.employee.common.repository.app.AppGroupRepositoryCustomized; import cn.topiam.employee.support.repository.aspect.query.QuerySingleResult; @@ -51,13 +50,13 @@ public class AppGroupRepositoryCustomizedImpl implements AppGroupRepositoryCusto /** * 获取应用组应用列表 * - * @param query {@link UserGroupMemberListQuery} + * @param query {@link AppGroupQueryParam} * @param pageable {@link Pageable} * @return {@link Page} */ @SuppressWarnings("DuplicatedCode") @Override - public Page getAppGroupList(AppGroupQuery query, Pageable pageable) { + public Page getAppGroupList(AppGroupQueryParam query, Pageable pageable) { Map args = new HashMap<>(); //@formatter:off String hql = """ @@ -121,7 +120,7 @@ public class AppGroupRepositoryCustomizedImpl implements AppGroupRepositoryCusto GROUP BY aga.groupId ) ass ON group.id = ass.groupId - """; + """; TypedQuery countQuery = entityManager.createQuery(countSql + whereSql, Long.class); args.forEach(countQuery::setParameter); return new PageImpl<>(listQuery.getResultList(), pageable, countQuery.getSingleResult()); @@ -131,11 +130,11 @@ public class AppGroupRepositoryCustomizedImpl implements AppGroupRepositoryCusto * 查询应用组列表 * * @param subjectIds {@link List} - * @param query {@link AppGroupQuery} + * @param query {@link AppGroupQueryParam} * @return {@link List} */ @Override - public List getAppGroupList(List subjectIds, AppGroupQuery query) { + public List getAppGroupList(List subjectIds, AppGroupQueryParam query) { Map args = new HashMap<>(); //@formatter:off String hql = """ @@ -156,12 +155,12 @@ public class AppGroupRepositoryCustomizedImpl implements AppGroupRepositoryCusto FROM AppGroupAssociationEntity aga LEFT JOIN AppEntity app ON aga.app.id = app.id - LEFT JOIN AppAccessPolicyEntity app_acce ON app.id = app_acce.appId - WHERE (app_acce.subjectId IN (:subjectIds) OR app.authorizationType = :type) + LEFT JOIN AppAccessPolicyEntity app_acce ON app.id = app_acce.appId AND app_acce.enabled = true + WHERE (app_acce.subjectId IN (:subjectIds) OR app.authorizationType = :type) %s GROUP BY aga.groupId ) ass ON group.id = ass.groupId - """; + """.formatted(StringUtils.isNoneBlank(query.getAppName()) ? " AND app.name LIKE :appName " : ""); //@formatter:on String whereSql = " WHERE 1 = 1 "; //分组名称 @@ -179,6 +178,10 @@ public class AppGroupRepositoryCustomizedImpl implements AppGroupRepositoryCusto whereSql += "AND group.type =:type"; args.put("type", query); } + //应用名称 + if (StringUtils.isNoneBlank(query.getAppName())) { + args.put("appName", "%" + query.getAppName() + "%"); + } TypedQuery listQuery = entityManager.createQuery(hql + whereSql, AppGroupPO.class); args.put("subjectIds", subjectIds); diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/impl/AppRepositoryCustomizedImpl.java b/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/impl/AppRepositoryCustomizedImpl.java index 3af37b89..9388a55a 100644 --- a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/impl/AppRepositoryCustomizedImpl.java +++ b/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/impl/AppRepositoryCustomizedImpl.java @@ -17,7 +17,10 @@ */ package cn.topiam.employee.common.repository.app.impl; -import java.util.*; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageImpl; @@ -26,7 +29,7 @@ import org.springframework.stereotype.Repository; import cn.topiam.employee.common.entity.app.AppEntity; import cn.topiam.employee.common.entity.app.po.AppPO; -import cn.topiam.employee.common.entity.app.query.GetAppListQuery; +import cn.topiam.employee.common.entity.app.query.GetAppListQueryParam; import cn.topiam.employee.common.repository.app.AppRepositoryCustomized; import cn.topiam.employee.support.repository.aspect.query.QuerySingleResult; @@ -81,12 +84,12 @@ public class AppRepositoryCustomizedImpl implements AppRepositoryCustomized { * 根据主体ID,查询参数、分页条件获取应用列表 * * @param subjectIds {@link List} - * @param query {@link GetAppListQuery} + * @param query {@link GetAppListQueryParam} * @param pageable {@link String} * @return {@link List} */ @Override - public Page getAppList(List subjectIds, GetAppListQuery query, + public Page getAppList(List subjectIds, GetAppListQueryParam query, Pageable pageable) { Map args = new HashMap<>(); //@formatter:off diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/controller/app/AppAccessPolicyController.java b/eiam-console/src/main/java/cn/topiam/employee/console/controller/app/AppAccessPolicyController.java index a450105c..e3fa68d2 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/controller/app/AppAccessPolicyController.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/controller/app/AppAccessPolicyController.java @@ -24,7 +24,7 @@ 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.entity.app.query.AppAccessPolicyQuery; +import cn.topiam.employee.console.pojo.query.app.AppAccessPolicyQuery; import cn.topiam.employee.console.pojo.result.app.AppAccessPolicyResult; import cn.topiam.employee.console.pojo.save.app.AppAccessPolicyCreateParam; import cn.topiam.employee.console.pojo.save.app.AppAccountCreateParam; diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/controller/app/AppAccountController.java b/eiam-console/src/main/java/cn/topiam/employee/console/controller/app/AppAccountController.java index b637a4e7..951a7f01 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/controller/app/AppAccountController.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/controller/app/AppAccountController.java @@ -24,7 +24,7 @@ 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.entity.app.query.AppAccountQuery; +import cn.topiam.employee.console.pojo.query.app.AppAccountQuery; import cn.topiam.employee.console.pojo.result.app.AppAccountListResult; import cn.topiam.employee.console.pojo.save.app.AppAccountCreateParam; import cn.topiam.employee.console.service.app.AppAccountService; diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/controller/app/AppGroupController.java b/eiam-console/src/main/java/cn/topiam/employee/console/controller/app/AppGroupController.java index 1ce85ad5..0a370b73 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/controller/app/AppGroupController.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/controller/app/AppGroupController.java @@ -27,8 +27,8 @@ import com.google.common.collect.Lists; import cn.topiam.employee.audit.annotation.Audit; import cn.topiam.employee.audit.event.type.EventType; import cn.topiam.employee.common.entity.account.query.UserGroupMemberListQuery; -import cn.topiam.employee.common.entity.app.query.AppGroupAssociationListQuery; -import cn.topiam.employee.common.entity.app.query.AppGroupQuery; +import cn.topiam.employee.console.pojo.query.app.AppGroupAssociationListQuery; +import cn.topiam.employee.console.pojo.query.app.AppGroupListQuery; import cn.topiam.employee.console.pojo.result.app.AppGroupGetResult; import cn.topiam.employee.console.pojo.result.app.AppGroupListResult; import cn.topiam.employee.console.pojo.result.app.AppListResult; @@ -66,13 +66,13 @@ public class AppGroupController { * 获取应用分组列表 * * @param page {@link PageModel} - * @return {@link AppGroupQuery} + * @return {@link AppGroupListQuery} */ @Operation(summary = "获取分组列表") @GetMapping(value = "/list") @PreAuthorize(value = "authenticated and @sae.hasAuthority(T(cn.topiam.employee.support.security.userdetails.UserType).ADMIN)") public ApiRestResult> getAppGroupList(PageModel page, - AppGroupQuery query) { + AppGroupListQuery query) { Page list = appGroupService.getAppGroupList(page, query); return ApiRestResult.> builder().result(list).build(); } diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/converter/app/AppAccessPolicyConverter.java b/eiam-console/src/main/java/cn/topiam/employee/console/converter/app/AppAccessPolicyConverter.java index fbb3a86b..80a61eda 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/converter/app/AppAccessPolicyConverter.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/converter/app/AppAccessPolicyConverter.java @@ -28,6 +28,8 @@ import cn.topiam.employee.application.ApplicationService; import cn.topiam.employee.application.ApplicationServiceLoader; import cn.topiam.employee.common.entity.app.AppAccessPolicyEntity; import cn.topiam.employee.common.entity.app.po.AppAccessPolicyPO; +import cn.topiam.employee.common.entity.app.query.AppAccessPolicyQueryParam; +import cn.topiam.employee.console.pojo.query.app.AppAccessPolicyQuery; import cn.topiam.employee.console.pojo.result.app.AppAccessPolicyResult; import cn.topiam.employee.console.pojo.save.app.AppAccessPolicyCreateParam; import cn.topiam.employee.support.context.ApplicationContextService; @@ -112,4 +114,13 @@ public interface AppAccessPolicyConverter { private ApplicationServiceLoader getApplicationServiceLoader() { return ApplicationContextService.getBean(ApplicationServiceLoader.class); } + + /** + * 转查询参数 + * + * @param query {@link AppAccessPolicyQuery} + * @return {@link AppAccessPolicyQueryParam} + */ + AppAccessPolicyQueryParam appAccessPolicyQueryToQueryParam(AppAccessPolicyQuery query); + } diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/converter/app/AppAccountConverter.java b/eiam-console/src/main/java/cn/topiam/employee/console/converter/app/AppAccountConverter.java index ae61c47b..1f5fd7ac 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/converter/app/AppAccountConverter.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/converter/app/AppAccountConverter.java @@ -26,6 +26,8 @@ import org.springframework.util.CollectionUtils; import cn.topiam.employee.common.entity.app.AppAccountEntity; import cn.topiam.employee.common.entity.app.po.AppAccountPO; +import cn.topiam.employee.common.entity.app.query.AppAccountQueryParam; +import cn.topiam.employee.console.pojo.query.app.AppAccountQuery; import cn.topiam.employee.console.pojo.result.app.AppAccountListResult; import cn.topiam.employee.console.pojo.save.app.AppAccountCreateParam; import cn.topiam.employee.support.repository.page.domain.Page; @@ -46,14 +48,14 @@ public interface AppAccountConverter { * @return {@link Page} */ default Page appAccountEntityConvertToAppAccountResult(org.springframework.data.domain.Page page) { - cn.topiam.employee.support.repository.page.domain.Page result = new cn.topiam.employee.support.repository.page.domain.Page<>(); + Page result = new Page<>(); if (!CollectionUtils.isEmpty(page.getContent())) { List list = new ArrayList<>(); for (AppAccountPO po : page.getContent()) { list.add(entityConvertToAppAccountResult(po)); } //@formatter:off - result.setPagination(cn.topiam.employee.support.repository.page.domain.Page.Pagination.builder() + result.setPagination(Page.Pagination.builder() .total(page.getTotalElements()) .totalPages(page.getTotalPages()) .current(page.getPageable().getPageNumber() + 1) @@ -87,4 +89,11 @@ public interface AppAccountConverter { @Mapping(target = "createBy", ignore = true) AppAccountEntity appAccountCreateParamConvertToEntity(AppAccountCreateParam param); + /** + * 查询参数转换 + * + * @param query {@link AppAccountQuery} + * @return {@link AppAccountQueryParam} + */ + AppAccountQueryParam appAccountQueryToQueryParam(AppAccountQuery query); } diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/converter/app/AppConverter.java b/eiam-console/src/main/java/cn/topiam/employee/console/converter/app/AppConverter.java index 6f4adf51..6c35e30a 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/converter/app/AppConverter.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/converter/app/AppConverter.java @@ -29,6 +29,8 @@ import com.google.common.collect.Lists; import cn.topiam.employee.application.ApplicationService; import cn.topiam.employee.application.ApplicationServiceLoader; import cn.topiam.employee.common.entity.app.AppEntity; +import cn.topiam.employee.common.entity.app.query.AppGroupAssociationListQueryParam; +import cn.topiam.employee.console.pojo.query.app.AppGroupAssociationListQuery; import cn.topiam.employee.console.pojo.query.app.AppQuery; import cn.topiam.employee.console.pojo.result.app.AppGetResult; import cn.topiam.employee.console.pojo.result.app.AppListResult; @@ -208,4 +210,12 @@ public interface AppConverter { private ApplicationServiceLoader getApplicationServiceLoader() { return ApplicationContextService.getBean(ApplicationServiceLoader.class); } + + /** + * 转查询参数 + * + * @param query {@link AppGroupAssociationListQuery} + * @return {@link AppGroupAssociationListQueryParam} + */ + AppGroupAssociationListQueryParam appGroupAssociationListQueryToQueryParam(AppGroupAssociationListQuery query); } diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/converter/app/AppGroupConverter.java b/eiam-console/src/main/java/cn/topiam/employee/console/converter/app/AppGroupConverter.java index c7b7c8e9..32b9f7b2 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/converter/app/AppGroupConverter.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/converter/app/AppGroupConverter.java @@ -27,6 +27,8 @@ import com.google.common.collect.Lists; import cn.topiam.employee.common.entity.app.AppAccountEntity; import cn.topiam.employee.common.entity.app.AppGroupEntity; import cn.topiam.employee.common.entity.app.po.AppGroupPO; +import cn.topiam.employee.common.entity.app.query.AppGroupQueryParam; +import cn.topiam.employee.console.pojo.query.app.AppGroupListQuery; import cn.topiam.employee.console.pojo.result.app.AppGroupGetResult; import cn.topiam.employee.console.pojo.result.app.AppGroupListResult; import cn.topiam.employee.console.pojo.save.app.AppAccountCreateParam; @@ -112,4 +114,11 @@ public interface AppGroupConverter { @Mapping(target = "createBy", ignore = true) AppGroupEntity appGroupCreateParamConvertToEntity(AppGroupCreateParam param); + /** + * 转查询参数 + * + * @param query {@link AppGroupListQuery} + * @return {@link AppGroupQueryParam} + */ + AppGroupQueryParam appGroupQueryToQueryParam(AppGroupListQuery query); } diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/query/AppAccessPolicyQuery.java b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/query/app/AppAccessPolicyQuery.java similarity index 94% rename from eiam-common/src/main/java/cn/topiam/employee/common/entity/app/query/AppAccessPolicyQuery.java rename to eiam-console/src/main/java/cn/topiam/employee/console/pojo/query/app/AppAccessPolicyQuery.java index d909f055..8e54433a 100644 --- a/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/query/AppAccessPolicyQuery.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/query/app/AppAccessPolicyQuery.java @@ -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,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.query; +package cn.topiam.employee.console.pojo.query.app; import org.springdoc.core.annotations.ParameterObject; diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/query/AppAccountQuery.java b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/query/app/AppAccountQuery.java similarity index 93% rename from eiam-common/src/main/java/cn/topiam/employee/common/entity/app/query/AppAccountQuery.java rename to eiam-console/src/main/java/cn/topiam/employee/console/pojo/query/app/AppAccountQuery.java index 0eb3d971..22d40b71 100644 --- a/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/query/AppAccountQuery.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/query/app/AppAccountQuery.java @@ -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,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.query; +package cn.topiam.employee.console.pojo.query.app; import org.springdoc.core.annotations.ParameterObject; diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/query/AppGroupAssociationListQuery.java b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/query/app/AppGroupAssociationListQuery.java similarity index 93% rename from eiam-common/src/main/java/cn/topiam/employee/common/entity/app/query/AppGroupAssociationListQuery.java rename to eiam-console/src/main/java/cn/topiam/employee/console/pojo/query/app/AppGroupAssociationListQuery.java index 708a9559..309b9bc5 100644 --- a/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/query/AppGroupAssociationListQuery.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/query/app/AppGroupAssociationListQuery.java @@ -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,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.query; +package cn.topiam.employee.console.pojo.query.app; import java.io.Serial; import java.io.Serializable; diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/query/app/AppGroupListQuery.java b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/query/app/AppGroupListQuery.java new file mode 100644 index 00000000..d6ab1e3c --- /dev/null +++ b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/query/app/AppGroupListQuery.java @@ -0,0 +1,66 @@ +/* + * eiam-console - Employee Identity and Access Management + * Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +package cn.topiam.employee.console.pojo.query.app; + +import java.io.Serializable; + +import org.springdoc.core.annotations.ParameterObject; + +import cn.topiam.employee.common.enums.app.AppGroupType; + +import lombok.Data; + +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Schema; + +/** + * 查询分组列表入参 + * + * @author TopIAM + * Created by support@topiam.cn on 2023/8/31 9:08 + */ +@Data +@Schema(description = "查询分组列表入参") +@ParameterObject +public class AppGroupListQuery implements Serializable { + + /** + * 分组名称 + */ + @Parameter(description = "分组名称") + private String name; + + /** + * 应用名称 + */ + @Parameter(description = "应用名称") + private String appName; + + /** + * 分组编码 + */ + @Parameter(description = "分组编码") + private String code; + + /** + * 分组类型 + */ + @Parameter(description = "分组类型") + private AppGroupType type; + +} diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/query/GetAppListQuery.java b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/query/app/GetAppListQuery.java similarity index 93% rename from eiam-common/src/main/java/cn/topiam/employee/common/entity/app/query/GetAppListQuery.java rename to eiam-console/src/main/java/cn/topiam/employee/console/pojo/query/app/GetAppListQuery.java index c6da9cd3..14233445 100644 --- a/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/query/GetAppListQuery.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/query/app/GetAppListQuery.java @@ -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,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.query; +package cn.topiam.employee.console.pojo.query.app; import java.io.Serial; import java.io.Serializable; diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/service/app/AppAccessPolicyService.java b/eiam-console/src/main/java/cn/topiam/employee/console/service/app/AppAccessPolicyService.java index abecf820..48cd6404 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/service/app/AppAccessPolicyService.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/service/app/AppAccessPolicyService.java @@ -17,7 +17,7 @@ */ package cn.topiam.employee.console.service.app; -import cn.topiam.employee.common.entity.app.query.AppAccessPolicyQuery; +import cn.topiam.employee.console.pojo.query.app.AppAccessPolicyQuery; import cn.topiam.employee.console.pojo.result.app.AppAccessPolicyResult; import cn.topiam.employee.console.pojo.save.app.AppAccessPolicyCreateParam; import cn.topiam.employee.support.repository.page.domain.Page; diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/service/app/AppAccountService.java b/eiam-console/src/main/java/cn/topiam/employee/console/service/app/AppAccountService.java index e3366a57..ee58ed70 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/service/app/AppAccountService.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/service/app/AppAccountService.java @@ -17,7 +17,8 @@ */ package cn.topiam.employee.console.service.app; -import cn.topiam.employee.common.entity.app.query.AppAccountQuery; +import cn.topiam.employee.common.entity.app.query.AppAccountQueryParam; +import cn.topiam.employee.console.pojo.query.app.AppAccountQuery; import cn.topiam.employee.console.pojo.result.app.AppAccountListResult; import cn.topiam.employee.console.pojo.save.app.AppAccountCreateParam; import cn.topiam.employee.support.repository.page.domain.Page; @@ -35,7 +36,7 @@ public interface AppAccountService { * 查询应用账户 * * @param pageModel {@link PageModel} - * @param query {@link AppAccountQuery} + * @param query {@link AppAccountQueryParam} * @return {@link Page} */ Page getAppAccountList(PageModel pageModel, AppAccountQuery query); diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/service/app/AppGroupService.java b/eiam-console/src/main/java/cn/topiam/employee/console/service/app/AppGroupService.java index 3821d4f3..cf7a3d82 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/service/app/AppGroupService.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/service/app/AppGroupService.java @@ -19,8 +19,8 @@ package cn.topiam.employee.console.service.app; import java.util.List; -import cn.topiam.employee.common.entity.app.query.AppGroupAssociationListQuery; -import cn.topiam.employee.common.entity.app.query.AppGroupQuery; +import cn.topiam.employee.console.pojo.query.app.AppGroupAssociationListQuery; +import cn.topiam.employee.console.pojo.query.app.AppGroupListQuery; import cn.topiam.employee.console.pojo.result.app.AppGroupGetResult; import cn.topiam.employee.console.pojo.result.app.AppGroupListResult; import cn.topiam.employee.console.pojo.result.app.AppListResult; @@ -43,10 +43,10 @@ public interface AppGroupService { * 获取应用分组(分页) * * @param pageModel {@link PageModel} - * @param query {@link AppGroupQuery} + * @param query {@link AppGroupListQuery} * @return {@link AppGroupListResult} */ - Page getAppGroupList(PageModel pageModel, AppGroupQuery query); + Page getAppGroupList(PageModel pageModel, AppGroupListQuery query); /** * 创建应用分组 diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/service/app/impl/AppAccessPolicyServiceImpl.java b/eiam-console/src/main/java/cn/topiam/employee/console/service/app/impl/AppAccessPolicyServiceImpl.java index 39ff82c0..35123718 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/service/app/impl/AppAccessPolicyServiceImpl.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/service/app/impl/AppAccessPolicyServiceImpl.java @@ -30,13 +30,14 @@ import cn.topiam.employee.audit.enums.TargetType; import cn.topiam.employee.common.entity.app.AppAccessPolicyEntity; import cn.topiam.employee.common.entity.app.AppEntity; import cn.topiam.employee.common.entity.app.po.AppAccessPolicyPO; -import cn.topiam.employee.common.entity.app.query.AppAccessPolicyQuery; +import cn.topiam.employee.common.entity.app.query.AppAccessPolicyQueryParam; import cn.topiam.employee.common.repository.account.OrganizationRepository; import cn.topiam.employee.common.repository.account.UserGroupRepository; import cn.topiam.employee.common.repository.account.UserRepository; import cn.topiam.employee.common.repository.app.AppAccessPolicyRepository; import cn.topiam.employee.common.repository.app.AppRepository; import cn.topiam.employee.console.converter.app.AppAccessPolicyConverter; +import cn.topiam.employee.console.pojo.query.app.AppAccessPolicyQuery; import cn.topiam.employee.console.pojo.result.app.AppAccessPolicyResult; import cn.topiam.employee.console.pojo.save.app.AppAccessPolicyCreateParam; import cn.topiam.employee.console.service.app.AppAccessPolicyService; @@ -60,7 +61,6 @@ import static cn.topiam.employee.support.repository.base.BaseEntity.LAST_MODIFIE @Slf4j @AllArgsConstructor public class AppAccessPolicyServiceImpl implements AppAccessPolicyService { - /** * 查询应用授权策略列表 * @@ -71,11 +71,14 @@ public class AppAccessPolicyServiceImpl implements AppAccessPolicyService { @Override public Page getAppAccessPolicyList(PageModel pageModel, AppAccessPolicyQuery query) { + //@formatter:off + AppAccessPolicyQueryParam param = appAccessPolicyConverter.appAccessPolicyQueryToQueryParam(query); + //@formatter:on //分页条件 PageRequest request = PageRequest.of(pageModel.getCurrent(), pageModel.getPageSize()); //查询映射 org.springframework.data.domain.Page list = appAccessPolicyRepository - .getAppPolicyList(query, request); + .getAppPolicyList(param, request); return appAccessPolicyConverter.appPolicyEntityListConvertToAppPolicyResult(list); } diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/service/app/impl/AppAccountServiceImpl.java b/eiam-console/src/main/java/cn/topiam/employee/console/service/app/impl/AppAccountServiceImpl.java index 8db0d362..c4ffd6bc 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/service/app/impl/AppAccountServiceImpl.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/service/app/impl/AppAccountServiceImpl.java @@ -35,7 +35,7 @@ import cn.topiam.employee.common.entity.account.UserEntity; import cn.topiam.employee.common.entity.app.AppAccountEntity; import cn.topiam.employee.common.entity.app.AppEntity; import cn.topiam.employee.common.entity.app.po.AppAccountPO; -import cn.topiam.employee.common.entity.app.query.AppAccountQuery; +import cn.topiam.employee.common.entity.app.query.AppAccountQueryParam; import cn.topiam.employee.common.exception.app.AppAccountExistException; import cn.topiam.employee.common.exception.app.AppAccountNotExistException; import cn.topiam.employee.common.exception.app.AppDefaultAccountExistException; @@ -44,6 +44,7 @@ import cn.topiam.employee.common.repository.account.UserRepository; import cn.topiam.employee.common.repository.app.AppAccountRepository; import cn.topiam.employee.common.repository.app.AppRepository; import cn.topiam.employee.console.converter.app.AppAccountConverter; +import cn.topiam.employee.console.pojo.query.app.AppAccountQuery; import cn.topiam.employee.console.pojo.result.app.AppAccountListResult; import cn.topiam.employee.console.pojo.save.app.AppAccountCreateParam; import cn.topiam.employee.console.service.app.AppAccountService; @@ -75,11 +76,12 @@ public class AppAccountServiceImpl implements AppAccountService { @Override public Page getAppAccountList(PageModel pageModel, AppAccountQuery query) { + AppAccountQueryParam param = appAccountConverter.appAccountQueryToQueryParam(query); //分页条件 PageRequest request = PageRequest.of(pageModel.getCurrent(), pageModel.getPageSize()); //查询映射 org.springframework.data.domain.Page list = appAccountRepository - .getAppAccountList(query, request); + .getAppAccountList(param, request); return appAccountConverter.appAccountEntityConvertToAppAccountResult(list); } diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/service/app/impl/AppGroupServiceImpl.java b/eiam-console/src/main/java/cn/topiam/employee/console/service/app/impl/AppGroupServiceImpl.java index d1546549..f566aebd 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/service/app/impl/AppGroupServiceImpl.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/service/app/impl/AppGroupServiceImpl.java @@ -34,14 +34,16 @@ import cn.topiam.employee.audit.enums.TargetType; import cn.topiam.employee.common.entity.app.AppEntity; import cn.topiam.employee.common.entity.app.AppGroupEntity; import cn.topiam.employee.common.entity.app.po.AppGroupPO; -import cn.topiam.employee.common.entity.app.query.AppGroupAssociationListQuery; -import cn.topiam.employee.common.entity.app.query.AppGroupQuery; +import cn.topiam.employee.common.entity.app.query.AppGroupAssociationListQueryParam; +import cn.topiam.employee.common.entity.app.query.AppGroupQueryParam; import cn.topiam.employee.common.enums.CheckValidityType; import cn.topiam.employee.common.enums.app.AppGroupType; import cn.topiam.employee.common.repository.app.AppGroupAssociationRepository; import cn.topiam.employee.common.repository.app.AppGroupRepository; import cn.topiam.employee.console.converter.app.AppConverter; import cn.topiam.employee.console.converter.app.AppGroupConverter; +import cn.topiam.employee.console.pojo.query.app.AppGroupAssociationListQuery; +import cn.topiam.employee.console.pojo.query.app.AppGroupListQuery; import cn.topiam.employee.console.pojo.result.app.AppGroupGetResult; import cn.topiam.employee.console.pojo.result.app.AppGroupListResult; import cn.topiam.employee.console.pojo.result.app.AppListResult; @@ -74,14 +76,15 @@ public class AppGroupServiceImpl implements AppGroupService { * 获取应用分组(分页) * * @param pageModel {@link PageModel} - * @param query {@link AppGroupQuery} + * @param query {@link AppGroupListQuery} * @return {@link AppGroupListResult} */ @Override - public Page getAppGroupList(PageModel pageModel, AppGroupQuery query) { + public Page getAppGroupList(PageModel pageModel, AppGroupListQuery query) { + AppGroupQueryParam param = appGroupConverter.appGroupQueryToQueryParam(query); //查询映射 org.springframework.data.domain.Page list = appGroupRepository.getAppGroupList( - query, PageRequest.of(pageModel.getCurrent(), pageModel.getPageSize())); + param, PageRequest.of(pageModel.getCurrent(), pageModel.getPageSize())); return appGroupConverter.entityConvertToAppGroupListResult(list); } @@ -217,8 +220,11 @@ public class AppGroupServiceImpl implements AppGroupService { @Override public Page getAppGroupAssociationList(PageModel model, AppGroupAssociationListQuery query) { + //@formatter:off + AppGroupAssociationListQueryParam param = appConverter.appGroupAssociationListQueryToQueryParam(query); + //@formatter:on org.springframework.data.domain.Page page = appGroupAssociationRepository - .getAppGroupAssociationList(query, + .getAppGroupAssociationList(param, PageRequest.of(model.getCurrent(), model.getPageSize())); return appConverter.entityConvertToAppListResult(page); } diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/AppAccountConverter.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/AppAccountConverter.java index be1d05c1..a038c623 100644 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/AppAccountConverter.java +++ b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/AppAccountConverter.java @@ -26,6 +26,8 @@ import org.springframework.util.CollectionUtils; import cn.topiam.employee.common.entity.app.AppAccountEntity; import cn.topiam.employee.common.entity.app.po.AppAccountPO; +import cn.topiam.employee.common.entity.app.query.AppAccountQueryParam; +import cn.topiam.employee.openapi.pojo.query.OapiV1AppAccountQuery; import cn.topiam.employee.openapi.pojo.result.AppAccountListResult; import cn.topiam.employee.openapi.pojo.save.AppAccountCreateParam; import cn.topiam.employee.support.repository.page.domain.Page; @@ -87,4 +89,11 @@ public interface AppAccountConverter { @Mapping(target = "createBy", ignore = true) AppAccountEntity appAccountCreateParamConvertToEntity(AppAccountCreateParam param); + /** + * 查询参数转换 + * + * @param query {@link OapiV1AppAccountQuery} + * @return {@link AppAccountQueryParam} + */ + AppAccountQueryParam appAccountQueryToQueryParam(OapiV1AppAccountQuery query); } diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/endpoint/AppAccountController.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/endpoint/AppAccountController.java index bc5c145a..36925b61 100644 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/endpoint/AppAccountController.java +++ b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/endpoint/AppAccountController.java @@ -23,8 +23,8 @@ 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.entity.app.query.AppAccountQuery; import cn.topiam.employee.openapi.common.OpenApiResponse; +import cn.topiam.employee.openapi.pojo.query.OapiV1AppAccountQuery; import cn.topiam.employee.openapi.pojo.result.AppAccountListResult; import cn.topiam.employee.openapi.pojo.save.AppAccountCreateParam; import cn.topiam.employee.openapi.service.AppAccountService; @@ -56,13 +56,13 @@ public class AppAccountController { * 获取应用账户列表 * * @param page {@link PageModel} - * @param query {@link AppAccountQuery} + * @param query {@link OapiV1AppAccountQuery} * @return {@link AppAccountListResult} */ @Operation(summary = "获取应用账户列表") @GetMapping(value = "/list") public OpenApiResponse> getAppAccountList(PageModel page, - @Validated AppAccountQuery query) { + @Validated OapiV1AppAccountQuery query) { return OpenApiResponse.success((appAccountService.getAppAccountList(page, query))); } diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/query/OapiV1AppAccountQuery.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/query/OapiV1AppAccountQuery.java new file mode 100644 index 00000000..a1cc5056 --- /dev/null +++ b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/query/OapiV1AppAccountQuery.java @@ -0,0 +1,64 @@ +/* + * eiam-openapi - Employee Identity and Access Management + * Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +package cn.topiam.employee.openapi.pojo.query; + +import org.springdoc.core.annotations.ParameterObject; + +import lombok.Data; + +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Schema; + +/** + * AppAccountCreateParam 应用账户查询入参 + * + * @author TopIAM + * Created by support@topiam.cn on 2022/5/24 22:13 + */ +@Data +@Schema(description = "应用账户查询入参") +@ParameterObject +public class OapiV1AppAccountQuery { + + /** + * appId + */ + @Parameter(description = "appId") + private String appId; + /** + * 用户ID + */ + @Parameter(description = "用户ID") + private String userId; + /** + * 用户名 + */ + @Parameter(description = "用户名") + private String username; + /** + * 账户名称 + */ + @Parameter(description = "账户名称") + private String account; + + /** + * 应用名称 + */ + @Parameter(description = "应用名称") + private String appName; +} diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/query/OapiV1UserListQuery.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/query/OapiV1UserListQuery.java new file mode 100644 index 00000000..f2b85a8a --- /dev/null +++ b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/query/OapiV1UserListQuery.java @@ -0,0 +1,92 @@ +/* + * eiam-openapi - Employee Identity and Access Management + * Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +package cn.topiam.employee.openapi.pojo.query; + +import java.io.Serial; +import java.io.Serializable; + +import org.springdoc.core.annotations.ParameterObject; + +import cn.topiam.employee.common.enums.UserStatus; + +import lombok.Data; + +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Schema; + +/** + * 查询用户列表入参 + * + * @author TopIAM + * Created by support@topiam.cn on 2020/8/11 23:08 + */ +@Data +@Schema(description = "查询用户列表入参") +@ParameterObject +public class OapiV1UserListQuery implements Serializable { + @Serial + private static final long serialVersionUID = -7110595216804896858L; + + /** + * 用户名 + */ + @Parameter(description = "用户名") + private String username; + + /** + * 姓名 + */ + @Parameter(description = "姓名") + private String fullName; + + /** + * 邮箱 + */ + @Parameter(description = "邮箱") + private String email; + + /** + * 手机号 + */ + @Parameter(description = "手机号") + private String phone; + + /** + * 组织ID + */ + @Parameter(description = "组织ID") + private String organizationId; + + /** + * 包含子组织 + */ + @Parameter(description = "包含子组织") + private Boolean inclSubOrganization; + + /** + * 状态 + */ + @Parameter(description = "状态") + private UserStatus status; + + /** + * 数据来源 + */ + @Parameter(description = "数据来源") + private String dataOrigin; +} diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/AppAccountService.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/AppAccountService.java index 59e52c06..f72b5bbe 100644 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/AppAccountService.java +++ b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/AppAccountService.java @@ -17,7 +17,7 @@ */ package cn.topiam.employee.openapi.service; -import cn.topiam.employee.common.entity.app.query.AppAccountQuery; +import cn.topiam.employee.openapi.pojo.query.OapiV1AppAccountQuery; import cn.topiam.employee.openapi.pojo.result.AppAccountListResult; import cn.topiam.employee.openapi.pojo.save.AppAccountCreateParam; import cn.topiam.employee.support.repository.page.domain.Page; @@ -35,10 +35,10 @@ public interface AppAccountService { * 查询应用账户 * * @param pageModel {@link PageModel} - * @param query {@link AppAccountQuery} + * @param query {@link OapiV1AppAccountQuery} * @return {@link Page} */ - Page getAppAccountList(PageModel pageModel, AppAccountQuery query); + Page getAppAccountList(PageModel pageModel, OapiV1AppAccountQuery query); /** * 新增应用账户 diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/impl/AppAccountServiceImpl.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/impl/AppAccountServiceImpl.java index 060ec839..56e1c212 100644 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/impl/AppAccountServiceImpl.java +++ b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/impl/AppAccountServiceImpl.java @@ -30,11 +30,12 @@ import cn.topiam.employee.audit.entity.Target; import cn.topiam.employee.audit.enums.TargetType; import cn.topiam.employee.common.entity.app.AppAccountEntity; import cn.topiam.employee.common.entity.app.po.AppAccountPO; -import cn.topiam.employee.common.entity.app.query.AppAccountQuery; +import cn.topiam.employee.common.entity.app.query.AppAccountQueryParam; import cn.topiam.employee.common.exception.app.AppAccountExistException; import cn.topiam.employee.common.exception.app.AppDefaultAccountExistException; import cn.topiam.employee.common.repository.app.AppAccountRepository; import cn.topiam.employee.openapi.converter.AppAccountConverter; +import cn.topiam.employee.openapi.pojo.query.OapiV1AppAccountQuery; import cn.topiam.employee.openapi.pojo.result.AppAccountListResult; import cn.topiam.employee.openapi.pojo.save.AppAccountCreateParam; import cn.topiam.employee.openapi.service.AppAccountService; @@ -60,17 +61,20 @@ public class AppAccountServiceImpl implements AppAccountService { * 查询应用账户 * * @param pageModel {@link PageModel} - * @param query {@link AppAccountQuery} + * @param query {@link OapiV1AppAccountQuery} * @return {@link Page} */ @Override public Page getAppAccountList(PageModel pageModel, - AppAccountQuery query) { + OapiV1AppAccountQuery query) { + //@formatter:off + AppAccountQueryParam param = appAccountConverter.appAccountQueryToQueryParam(query); + //@formatter:on //分页条件 PageRequest request = PageRequest.of(pageModel.getCurrent(), pageModel.getPageSize()); //查询映射 org.springframework.data.domain.Page list = appAccountRepository - .getAppAccountList(query, request); + .getAppAccountList(param, request); return appAccountConverter.appAccountEntityConvertToAppAccountResult(list); } diff --git a/eiam-portal/src/main/java/cn/topiam/employee/portal/controller/AppController.java b/eiam-portal/src/main/java/cn/topiam/employee/portal/controller/AppController.java index 6e15e6ee..1baab915 100644 --- a/eiam-portal/src/main/java/cn/topiam/employee/portal/controller/AppController.java +++ b/eiam-portal/src/main/java/cn/topiam/employee/portal/controller/AppController.java @@ -24,8 +24,8 @@ 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.query.AppGroupQuery; -import cn.topiam.employee.common.entity.app.query.GetAppListQuery; +import cn.topiam.employee.portal.pojo.query.GetAppGroupListQuery; +import cn.topiam.employee.portal.pojo.query.GetAppListQuery; import cn.topiam.employee.portal.pojo.result.AppGroupListResult; import cn.topiam.employee.portal.pojo.result.GetAppListResult; import cn.topiam.employee.portal.service.AppService; @@ -88,7 +88,7 @@ public class AppController { */ @Operation(summary = "获取分组应用列表") @GetMapping(value = "/group_list") - public ApiRestResult> getAppGroupList(AppGroupQuery appGroupQuery) { + public ApiRestResult> getAppGroupList(GetAppGroupListQuery appGroupQuery) { List list = appService.getAppGroupList(appGroupQuery); return ApiRestResult.ok(list); } diff --git a/eiam-portal/src/main/java/cn/topiam/employee/portal/converter/AppGroupConverter.java b/eiam-portal/src/main/java/cn/topiam/employee/portal/converter/AppGroupConverter.java index 2985cf87..0934fbd0 100644 --- a/eiam-portal/src/main/java/cn/topiam/employee/portal/converter/AppGroupConverter.java +++ b/eiam-portal/src/main/java/cn/topiam/employee/portal/converter/AppGroupConverter.java @@ -24,6 +24,8 @@ import org.mapstruct.Mapper; import com.google.common.collect.Lists; import cn.topiam.employee.common.entity.app.po.AppGroupPO; +import cn.topiam.employee.common.entity.app.query.AppGroupQueryParam; +import cn.topiam.employee.portal.pojo.query.GetAppGroupListQuery; import cn.topiam.employee.portal.pojo.result.AppGroupListResult; /** @@ -58,4 +60,11 @@ public interface AppGroupConverter { */ AppGroupListResult entityConvertToAppGroupListResult(AppGroupPO appGroupPo); + /** + * 查询参数转换 + * + * @param query {@link GetAppGroupListQuery} + * @return {@link AppGroupQueryParam} + */ + AppGroupQueryParam appGroupQueryToQueryParam(GetAppGroupListQuery query); } diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/query/AppGroupQuery.java b/eiam-portal/src/main/java/cn/topiam/employee/portal/pojo/query/GetAppGroupListQuery.java similarity index 84% rename from eiam-common/src/main/java/cn/topiam/employee/common/entity/app/query/AppGroupQuery.java rename to eiam-portal/src/main/java/cn/topiam/employee/portal/pojo/query/GetAppGroupListQuery.java index 4b8ecb6b..a106b5f1 100644 --- a/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/query/AppGroupQuery.java +++ b/eiam-portal/src/main/java/cn/topiam/employee/portal/pojo/query/GetAppGroupListQuery.java @@ -1,5 +1,5 @@ /* - * eiam-common - Employee Identity and Access Management + * eiam-portal - 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,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.query; +package cn.topiam.employee.portal.pojo.query; import java.io.Serializable; @@ -37,7 +37,7 @@ import io.swagger.v3.oas.annotations.media.Schema; @Data @Schema(description = "查询分组列表入参") @ParameterObject -public class AppGroupQuery implements Serializable { +public class GetAppGroupListQuery implements Serializable { /** * 分组名称 @@ -45,6 +45,12 @@ public class AppGroupQuery implements Serializable { @Parameter(description = "分组名称") private String name; + /** + * 应用名称 + */ + @Parameter(description = "应用名称") + private String appName; + /** * 分组编码 */ diff --git a/eiam-portal/src/main/java/cn/topiam/employee/portal/pojo/query/GetAppListQuery.java b/eiam-portal/src/main/java/cn/topiam/employee/portal/pojo/query/GetAppListQuery.java new file mode 100644 index 00000000..b9cea0ec --- /dev/null +++ b/eiam-portal/src/main/java/cn/topiam/employee/portal/pojo/query/GetAppListQuery.java @@ -0,0 +1,56 @@ +/* + * eiam-portal - Employee Identity and Access Management + * Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +package cn.topiam.employee.portal.pojo.query; + +import java.io.Serial; +import java.io.Serializable; + +import org.springdoc.core.annotations.ParameterObject; + +import lombok.Data; + +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Schema; + +/** + * 查询应用列表 + * + * @author TopIAM + * Created by support@topiam.cn on 2022/7/6 22:38 + */ +@Data +@Schema(description = "查询应用列表") +@ParameterObject +public class GetAppListQuery implements Serializable { + + @Serial + private static final long serialVersionUID = -4981513177967939516L; + + /** + * 应用名称 + */ + @Parameter(description = "应用名称") + private String name; + + /** + * 应用分组ID + */ + @Parameter(description = "应用分组ID") + private String groupId; + +} diff --git a/eiam-portal/src/main/java/cn/topiam/employee/portal/service/AppService.java b/eiam-portal/src/main/java/cn/topiam/employee/portal/service/AppService.java index 8c776125..da335cca 100644 --- a/eiam-portal/src/main/java/cn/topiam/employee/portal/service/AppService.java +++ b/eiam-portal/src/main/java/cn/topiam/employee/portal/service/AppService.java @@ -19,8 +19,7 @@ package cn.topiam.employee.portal.service; import java.util.List; -import cn.topiam.employee.common.entity.app.query.AppGroupQuery; -import cn.topiam.employee.common.entity.app.query.GetAppListQuery; +import cn.topiam.employee.portal.pojo.query.GetAppGroupListQuery; import cn.topiam.employee.portal.pojo.result.AppGroupListResult; import cn.topiam.employee.portal.pojo.result.GetAppListResult; import cn.topiam.employee.support.repository.page.domain.Page; @@ -36,19 +35,20 @@ public interface AppService { /** * 获取应用列表 * - * @param query {@link GetAppListQuery} + * @param query {@link cn.topiam.employee.portal.pojo.query.GetAppListQuery} * @param pageModel {@link PageModel} * @return {@link Page} */ - Page getAppList(GetAppListQuery query, PageModel pageModel); + Page getAppList(cn.topiam.employee.portal.pojo.query.GetAppListQuery query, + PageModel pageModel); /** * 查询应用分组 * - * @param appGroupQuery {@link AppGroupQuery} + * @param appGroupQuery {@link GetAppGroupListQuery} * @return {@link AppGroupListResult} */ - List getAppGroupList(AppGroupQuery appGroupQuery); + List getAppGroupList(GetAppGroupListQuery appGroupQuery); /** * 获取应用数量 diff --git a/eiam-portal/src/main/java/cn/topiam/employee/portal/service/impl/AppServiceImpl.java b/eiam-portal/src/main/java/cn/topiam/employee/portal/service/impl/AppServiceImpl.java index 574a942b..9d1e60a2 100644 --- a/eiam-portal/src/main/java/cn/topiam/employee/portal/service/impl/AppServiceImpl.java +++ b/eiam-portal/src/main/java/cn/topiam/employee/portal/service/impl/AppServiceImpl.java @@ -30,14 +30,15 @@ import cn.topiam.employee.common.entity.account.UserGroupMemberEntity; import cn.topiam.employee.common.entity.account.po.OrganizationMemberPO; import cn.topiam.employee.common.entity.app.AppEntity; import cn.topiam.employee.common.entity.app.po.AppGroupPO; -import cn.topiam.employee.common.entity.app.query.AppGroupQuery; -import cn.topiam.employee.common.entity.app.query.GetAppListQuery; +import cn.topiam.employee.common.entity.app.query.AppGroupQueryParam; import cn.topiam.employee.common.repository.account.OrganizationMemberRepository; import cn.topiam.employee.common.repository.account.UserGroupMemberRepository; import cn.topiam.employee.common.repository.app.AppGroupRepository; import cn.topiam.employee.common.repository.app.AppRepository; import cn.topiam.employee.portal.converter.AppConverter; import cn.topiam.employee.portal.converter.AppGroupConverter; +import cn.topiam.employee.portal.pojo.query.GetAppGroupListQuery; +import cn.topiam.employee.portal.pojo.query.GetAppListQuery; import cn.topiam.employee.portal.pojo.result.AppGroupListResult; import cn.topiam.employee.portal.pojo.result.GetAppListResult; import cn.topiam.employee.portal.service.AppService; @@ -87,15 +88,17 @@ public class AppServiceImpl implements AppService { /** * 查询应用分组 * - * @param appGroupQuery {@link AppGroupQuery} + * @param query {@link GetAppGroupListQuery} * @return {@link AppGroupListResult} */ @Override - public List getAppGroupList(AppGroupQuery appGroupQuery) { + public List getAppGroupList(GetAppGroupListQuery query) { //查询映射 + //@formatter:off + AppGroupQueryParam param = appGroupConverter.appGroupQueryToQueryParam(query); + //@formatter:on String userId = SecurityUtils.getCurrentUserId(); - List list = appGroupRepository.getAppGroupList(getSubjectIds(userId), - appGroupQuery); + List list = appGroupRepository.getAppGroupList(getSubjectIds(userId), param); return appGroupConverter.entityConvertToAppGroupListResult(list); } diff --git a/eiam-synchronizer/src/main/java/cn/topiam/employee/synchronizer/configuration/IdentitySourceBeanRegistry.java b/eiam-synchronizer/src/main/java/cn/topiam/employee/synchronizer/configuration/IdentitySourceBeanRegistry.java index 651dfb37..b13542e0 100644 --- a/eiam-synchronizer/src/main/java/cn/topiam/employee/synchronizer/configuration/IdentitySourceBeanRegistry.java +++ b/eiam-synchronizer/src/main/java/cn/topiam/employee/synchronizer/configuration/IdentitySourceBeanRegistry.java @@ -158,13 +158,13 @@ public class IdentitySourceBeanRegistry implements IdentitySourceEventListener { try{ switch (entity.getProvider()) { case DINGTALK -> { - DingTalkConfig config=objectMapper.readValue(entity.getBasicConfig(), DingTalkConfig.class); + DingTalkConfig config = objectMapper.readValue(entity.getBasicConfig(), DingTalkConfig.class); identitySourceClient = new DingTalkClient(config); definitionBuilder = BeanDefinitionBuilder.genericBeanDefinition(DingTalkIdentitySource.class); return getDefinitionHolder(entity, identitySourceSyncUserPostProcessor, identitySourceSyncDeptPostProcessor, identitySourceEventPostProcessor, identitySourceClient, definitionBuilder, config); } case FEISHU -> { - FeiShuConfig config=objectMapper.readValue(entity.getBasicConfig(), FeiShuConfig.class); + FeiShuConfig config = objectMapper.readValue(entity.getBasicConfig(), FeiShuConfig.class); identitySourceClient = new FeiShuClient(config); definitionBuilder = BeanDefinitionBuilder.genericBeanDefinition(FieShuIdentitySource.class); return getDefinitionHolder(entity, identitySourceSyncUserPostProcessor, identitySourceSyncDeptPostProcessor, identitySourceEventPostProcessor, identitySourceClient, definitionBuilder, config);