mirror of https://gitee.com/topiam/eiam
⚡ 代码解耦
parent
31eb5cb0cc
commit
77226ad523
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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;
|
||||
}
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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;
|
||||
}
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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;
|
||||
}
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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;
|
||||
|
||||
}
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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;
|
||||
|
||||
}
|
|
@ -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<AppAccessPolicyPO> getAppPolicyList(AppAccessPolicyQuery query, Pageable pageable);
|
||||
Page<AppAccessPolicyPO> getAppPolicyList(AppAccessPolicyQueryParam query, Pageable pageable);
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ public interface AppAccountRepository extends JpaRepository<AppAccountEntity, St
|
|||
* @param userId {@link String}
|
||||
* @return {@link Optional}
|
||||
*/
|
||||
@Cacheable(key = "#p0+':'+#p1", unless = "#result==null || #result.isEmpty()")
|
||||
@Cacheable(key = "#p0+':'+#p1", unless = "#result == null || #result.isEmpty()")
|
||||
List<AppAccountEntity> findByAppIdAndUserId(String appId, String userId);
|
||||
|
||||
/**
|
||||
|
@ -81,7 +81,7 @@ public interface AppAccountRepository extends JpaRepository<AppAccountEntity, St
|
|||
* @param userId {@link String}
|
||||
* @return {@link Optional}
|
||||
*/
|
||||
@Cacheable(key = "'default:'+#p0+':'+#p1", unless = "#result == null")
|
||||
@Cacheable(key = "'default:'+#p0+':'+#p1", unless = "#result==null")
|
||||
Optional<AppAccountEntity> findByAppIdAndUserIdAndDefaultedIsTrue(String appId, String userId);
|
||||
|
||||
/**
|
||||
|
@ -92,7 +92,7 @@ public interface AppAccountRepository extends JpaRepository<AppAccountEntity, St
|
|||
* @param account {@link String}
|
||||
* @return {@link Optional}
|
||||
*/
|
||||
@Cacheable(key = "#p0+':'+#p1+':'+#p2", unless = "#result == null")
|
||||
@Cacheable(key = "#p0+':'+#p1+':'+#p2", unless = "#result==null")
|
||||
Optional<AppAccountEntity> findByAppIdAndUserIdAndAccount(String appId, String userId,
|
||||
String account);
|
||||
|
||||
|
|
|
@ -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<AppAccountPO> getAppAccountList(AppAccountQuery query, Pageable pageable);
|
||||
Page<AppAccountPO> getAppAccountList(AppAccountQueryParam query, Pageable pageable);
|
||||
}
|
||||
|
|
|
@ -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<AppEntity> getAppGroupAssociationList(AppGroupAssociationListQuery query,
|
||||
Page<AppEntity> getAppGroupAssociationList(AppGroupAssociationListQueryParam query,
|
||||
Pageable pageable);
|
||||
}
|
||||
|
|
|
@ -85,4 +85,12 @@ public interface AppGroupRepository extends JpaRepository<AppGroupEntity, String
|
|||
* @return {@link AppGroupEntity}
|
||||
*/
|
||||
Optional<AppGroupEntity> findByCode(@Param("code") String code);
|
||||
|
||||
/**
|
||||
* 编码存在校验
|
||||
*
|
||||
* @param code {@link String}
|
||||
* @return {@link boolean}
|
||||
*/
|
||||
boolean existsByCode(String code);
|
||||
}
|
||||
|
|
|
@ -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<AppGroupPO> getAppGroupList(AppGroupQuery query, Pageable pageable);
|
||||
Page<AppGroupPO> getAppGroupList(AppGroupQueryParam query, Pageable pageable);
|
||||
|
||||
/**
|
||||
* 查询应用组列表
|
||||
*
|
||||
* @param subjectIds {@link List}
|
||||
* @param query {@link AppGroupQuery}
|
||||
* @param query {@link AppGroupQueryParam}
|
||||
* @return {@link List}
|
||||
*/
|
||||
List<AppGroupPO> getAppGroupList(List<String> subjectIds, AppGroupQuery query);
|
||||
List<AppGroupPO> getAppGroupList(List<String> subjectIds, AppGroupQueryParam query);
|
||||
|
||||
/**
|
||||
* 根据当前用户和分组获取应用数量
|
||||
|
|
|
@ -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<AppEntity> getAppList(List<String> subjectIds, GetAppListQuery query, Pageable pageable);
|
||||
Page<AppEntity> getAppList(List<String> subjectIds, GetAppListQueryParam query,
|
||||
Pageable pageable);
|
||||
|
||||
/**
|
||||
* 获取用户应用数量
|
||||
|
|
|
@ -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<AppAccessPolicyPO> getAppPolicyList(AppAccessPolicyQuery query, Pageable pageable) {
|
||||
public Page<AppAccessPolicyPO> getAppPolicyList(AppAccessPolicyQueryParam query,
|
||||
Pageable pageable) {
|
||||
Map<String, Object> args = new HashMap<>();
|
||||
//@formatter:off
|
||||
String hql = """
|
||||
|
|
|
@ -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<AppAccountPO> getAppAccountList(AppAccountQuery query, Pageable pageable) {
|
||||
public Page<AppAccountPO> getAppAccountList(AppAccountQueryParam query, Pageable pageable) {
|
||||
Map<String, Object> args = new HashMap<>();
|
||||
//@formatter:off
|
||||
String hql = """
|
||||
|
|
|
@ -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<AppEntity> getAppGroupAssociationList(AppGroupAssociationListQuery query,
|
||||
public Page<AppEntity> getAppGroupAssociationList(AppGroupAssociationListQueryParam query,
|
||||
Pageable pageable) {
|
||||
Map<String, Object> args = new HashMap<>();
|
||||
//@formatter:off
|
||||
|
|
|
@ -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<AppGroupPO> getAppGroupList(AppGroupQuery query, Pageable pageable) {
|
||||
public Page<AppGroupPO> getAppGroupList(AppGroupQueryParam query, Pageable pageable) {
|
||||
Map<String, Object> 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<Long> 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<AppGroupPO> getAppGroupList(List<String> subjectIds, AppGroupQuery query) {
|
||||
public List<AppGroupPO> getAppGroupList(List<String> subjectIds, AppGroupQueryParam query) {
|
||||
Map<String, Object> 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<AppGroupPO> listQuery = entityManager.createQuery(hql + whereSql,
|
||||
AppGroupPO.class);
|
||||
args.put("subjectIds", subjectIds);
|
||||
|
|
|
@ -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<AppEntity> getAppList(List<String> subjectIds, GetAppListQuery query,
|
||||
public Page<AppEntity> getAppList(List<String> subjectIds, GetAppListQueryParam query,
|
||||
Pageable pageable) {
|
||||
Map<String, Object> args = new HashMap<>();
|
||||
//@formatter:off
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<Page<AppGroupListResult>> getAppGroupList(PageModel page,
|
||||
AppGroupQuery query) {
|
||||
AppGroupListQuery query) {
|
||||
Page<AppGroupListResult> list = appGroupService.getAppGroupList(page, query);
|
||||
return ApiRestResult.<Page<AppGroupListResult>> builder().result(list).build();
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
|
|
@ -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<AppAccountListResult> appAccountEntityConvertToAppAccountResult(org.springframework.data.domain.Page<AppAccountPO> page) {
|
||||
cn.topiam.employee.support.repository.page.domain.Page<AppAccountListResult> result = new cn.topiam.employee.support.repository.page.domain.Page<>();
|
||||
Page<AppAccountListResult> result = new Page<>();
|
||||
if (!CollectionUtils.isEmpty(page.getContent())) {
|
||||
List<AppAccountListResult> 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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.common.entity.app.query;
|
||||
package cn.topiam.employee.console.pojo.query.app;
|
||||
|
||||
import org.springdoc.core.annotations.ParameterObject;
|
||||
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.common.entity.app.query;
|
||||
package cn.topiam.employee.console.pojo.query.app;
|
||||
|
||||
import org.springdoc.core.annotations.ParameterObject;
|
||||
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.common.entity.app.query;
|
||||
package cn.topiam.employee.console.pojo.query.app;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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;
|
||||
|
||||
}
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.common.entity.app.query;
|
||||
package cn.topiam.employee.console.pojo.query.app;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
|
@ -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;
|
||||
|
|
|
@ -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<AppAccountListResult> getAppAccountList(PageModel pageModel, AppAccountQuery query);
|
||||
|
|
|
@ -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<AppGroupListResult> getAppGroupList(PageModel pageModel, AppGroupQuery query);
|
||||
Page<AppGroupListResult> getAppGroupList(PageModel pageModel, AppGroupListQuery query);
|
||||
|
||||
/**
|
||||
* 创建应用分组
|
||||
|
|
|
@ -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<AppAccessPolicyResult> 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<AppAccessPolicyPO> list = appAccessPolicyRepository
|
||||
.getAppPolicyList(query, request);
|
||||
.getAppPolicyList(param, request);
|
||||
return appAccessPolicyConverter.appPolicyEntityListConvertToAppPolicyResult(list);
|
||||
}
|
||||
|
||||
|
|
|
@ -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<AppAccountListResult> getAppAccountList(PageModel pageModel,
|
||||
AppAccountQuery query) {
|
||||
AppAccountQueryParam param = appAccountConverter.appAccountQueryToQueryParam(query);
|
||||
//分页条件
|
||||
PageRequest request = PageRequest.of(pageModel.getCurrent(), pageModel.getPageSize());
|
||||
//查询映射
|
||||
org.springframework.data.domain.Page<AppAccountPO> list = appAccountRepository
|
||||
.getAppAccountList(query, request);
|
||||
.getAppAccountList(param, request);
|
||||
return appAccountConverter.appAccountEntityConvertToAppAccountResult(list);
|
||||
}
|
||||
|
||||
|
|
|
@ -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<AppGroupListResult> getAppGroupList(PageModel pageModel, AppGroupQuery query) {
|
||||
public Page<AppGroupListResult> getAppGroupList(PageModel pageModel, AppGroupListQuery query) {
|
||||
AppGroupQueryParam param = appGroupConverter.appGroupQueryToQueryParam(query);
|
||||
//查询映射
|
||||
org.springframework.data.domain.Page<AppGroupPO> 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<AppListResult> getAppGroupAssociationList(PageModel model,
|
||||
AppGroupAssociationListQuery query) {
|
||||
//@formatter:off
|
||||
AppGroupAssociationListQueryParam param = appConverter.appGroupAssociationListQueryToQueryParam(query);
|
||||
//@formatter:on
|
||||
org.springframework.data.domain.Page<AppEntity> page = appGroupAssociationRepository
|
||||
.getAppGroupAssociationList(query,
|
||||
.getAppGroupAssociationList(param,
|
||||
PageRequest.of(model.getCurrent(), model.getPageSize()));
|
||||
return appConverter.entityConvertToAppListResult(page);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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<Page<AppAccountListResult>> getAppAccountList(PageModel page,
|
||||
@Validated AppAccountQuery query) {
|
||||
@Validated OapiV1AppAccountQuery query) {
|
||||
return OpenApiResponse.success((appAccountService.getAppAccountList(page, query)));
|
||||
}
|
||||
|
||||
|
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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;
|
||||
}
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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;
|
||||
}
|
|
@ -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<AppAccountListResult> getAppAccountList(PageModel pageModel, AppAccountQuery query);
|
||||
Page<AppAccountListResult> getAppAccountList(PageModel pageModel, OapiV1AppAccountQuery query);
|
||||
|
||||
/**
|
||||
* 新增应用账户
|
||||
|
|
|
@ -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<AppAccountListResult> 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<AppAccountPO> list = appAccountRepository
|
||||
.getAppAccountList(query, request);
|
||||
.getAppAccountList(param, request);
|
||||
return appAccountConverter.appAccountEntityConvertToAppAccountResult(list);
|
||||
}
|
||||
|
||||
|
|
|
@ -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<List<AppGroupListResult>> getAppGroupList(AppGroupQuery appGroupQuery) {
|
||||
public ApiRestResult<List<AppGroupListResult>> getAppGroupList(GetAppGroupListQuery appGroupQuery) {
|
||||
List<AppGroupListResult> list = appService.getAppGroupList(appGroupQuery);
|
||||
return ApiRestResult.ok(list);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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;
|
||||
|
||||
/**
|
||||
* 分组编码
|
||||
*/
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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;
|
||||
|
||||
}
|
|
@ -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<GetAppListResult> getAppList(GetAppListQuery query, PageModel pageModel);
|
||||
Page<GetAppListResult> getAppList(cn.topiam.employee.portal.pojo.query.GetAppListQuery query,
|
||||
PageModel pageModel);
|
||||
|
||||
/**
|
||||
* 查询应用分组
|
||||
*
|
||||
* @param appGroupQuery {@link AppGroupQuery}
|
||||
* @param appGroupQuery {@link GetAppGroupListQuery}
|
||||
* @return {@link AppGroupListResult}
|
||||
*/
|
||||
List<AppGroupListResult> getAppGroupList(AppGroupQuery appGroupQuery);
|
||||
List<AppGroupListResult> getAppGroupList(GetAppGroupListQuery appGroupQuery);
|
||||
|
||||
/**
|
||||
* 获取应用数量
|
||||
|
|
|
@ -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<AppGroupListResult> getAppGroupList(AppGroupQuery appGroupQuery) {
|
||||
public List<AppGroupListResult> getAppGroupList(GetAppGroupListQuery query) {
|
||||
//查询映射
|
||||
//@formatter:off
|
||||
AppGroupQueryParam param = appGroupConverter.appGroupQueryToQueryParam(query);
|
||||
//@formatter:on
|
||||
String userId = SecurityUtils.getCurrentUserId();
|
||||
List<AppGroupPO> list = appGroupRepository.getAppGroupList(getSubjectIds(userId),
|
||||
appGroupQuery);
|
||||
List<AppGroupPO> list = appGroupRepository.getAppGroupList(getSubjectIds(userId), param);
|
||||
return appGroupConverter.entityConvertToAppGroupListResult(list);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue