mirror of https://gitee.com/topiam/eiam
应用分组优化
parent
7943717b3a
commit
dac0eb6342
|
@ -60,7 +60,6 @@ public abstract class AbstractApplicationService implements ApplicationService {
|
||||||
AppEntity appEntity = new AppEntity();
|
AppEntity appEntity = new AppEntity();
|
||||||
appEntity.setName(name);
|
appEntity.setName(name);
|
||||||
appEntity.setIcon(icon);
|
appEntity.setIcon(icon);
|
||||||
appEntity.setGroupId(null == groupId ? 0L : groupId);
|
|
||||||
appEntity.setCode(RandomStringUtils.randomAlphanumeric(32).toLowerCase());
|
appEntity.setCode(RandomStringUtils.randomAlphanumeric(32).toLowerCase());
|
||||||
appEntity.setTemplate(getCode());
|
appEntity.setTemplate(getCode());
|
||||||
appEntity.setType(getType());
|
appEntity.setType(getType());
|
||||||
|
|
|
@ -182,4 +182,18 @@ public class AppEventType {
|
||||||
public static Type DELETE_APP_GROUP = new Type("eiam:event:app_group:delete",
|
public static Type DELETE_APP_GROUP = new Type("eiam:event:app_group:delete",
|
||||||
"删除应用分组", APP_GROUP_RESOURCE, List.of(UserType.ADMIN));
|
"删除应用分组", APP_GROUP_RESOURCE, List.of(UserType.ADMIN));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加应用分组关联
|
||||||
|
*/
|
||||||
|
public static Type ADD_APP_GROUP_ASSOCIATION = new Type(
|
||||||
|
"eiam:event:add_app_group_association", "添加应用分组关联", APP_GROUP_RESOURCE,
|
||||||
|
List.of(UserType.ADMIN));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 移除应用分组关联
|
||||||
|
*/
|
||||||
|
public static Type REMOVE_APP_GROUP_ASSOCIATION = new Type(
|
||||||
|
"eiam:event:remove_app_group_association", "移除应用分组关联", APP_GROUP_RESOURCE,
|
||||||
|
List.of(UserType.ADMIN));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -503,7 +503,15 @@ public enum EventType {
|
||||||
/**
|
/**
|
||||||
* 删除应用分组
|
* 删除应用分组
|
||||||
*/
|
*/
|
||||||
DELETE_APP_GROUP(AppEventType.DELETE_APP_GROUP);
|
DELETE_APP_GROUP(AppEventType.DELETE_APP_GROUP),
|
||||||
|
/**
|
||||||
|
* 添加应用组关联
|
||||||
|
*/
|
||||||
|
ADD_APP_GROUP_ASSOCIATION(AppEventType.ADD_APP_GROUP_ASSOCIATION),
|
||||||
|
/**
|
||||||
|
* 移除应用组关联
|
||||||
|
*/
|
||||||
|
REMOVE_APP_GROUP_ASSOCIATION(AppEventType.REMOVE_APP_GROUP_ASSOCIATION);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* code
|
* code
|
||||||
|
|
|
@ -100,12 +100,6 @@ public class AppEntity extends LogicDeleteEntity<Long> {
|
||||||
@Column(name = "icon_")
|
@Column(name = "icon_")
|
||||||
private String icon;
|
private String icon;
|
||||||
|
|
||||||
/**
|
|
||||||
* 应用分组id
|
|
||||||
*/
|
|
||||||
@Column(name = "group_id")
|
|
||||||
private Long groupId;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SSO 发起登录类型
|
* SSO 发起登录类型
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
import org.hibernate.annotations.SQLDelete;
|
||||||
|
import org.hibernate.annotations.Where;
|
||||||
|
|
||||||
|
import cn.topiam.employee.support.repository.domain.LogicDeleteEntity;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_SET;
|
||||||
|
import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_WHERE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 应用组关联
|
||||||
|
*
|
||||||
|
* @author TopIAM
|
||||||
|
* Created by support@topiam.cn on 2023年09月06日22:03:21
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@Entity
|
||||||
|
@Table(name = "app_group_association")
|
||||||
|
@SQLDelete(sql = "update app_group_association set " + SOFT_DELETE_SET + " where id_ = ?")
|
||||||
|
@Where(clause = SOFT_DELETE_WHERE)
|
||||||
|
public class AppGroupAssociationEntity extends LogicDeleteEntity<Long> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 应用组ID
|
||||||
|
*/
|
||||||
|
@Column(name = "group_id")
|
||||||
|
private Long groupId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 应用ID
|
||||||
|
*/
|
||||||
|
@Column(name = "app_id")
|
||||||
|
private Long appId;
|
||||||
|
}
|
|
@ -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.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;
|
||||||
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询应用列表入参
|
||||||
|
*
|
||||||
|
* @author TopIAM
|
||||||
|
* Created by support@topiam.cn on 2020/8/11 23:08
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Schema(description = "查询应用组应用列表入参")
|
||||||
|
@ParameterObject
|
||||||
|
public class AppGroupAssociationListQuery implements Serializable {
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = -7110595216804896858L;
|
||||||
|
/**
|
||||||
|
* 组ID
|
||||||
|
*/
|
||||||
|
@NotEmpty(message = "组ID不能为空")
|
||||||
|
@Parameter(description = "组ID")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 应用名称
|
||||||
|
*/
|
||||||
|
@Parameter(description = "应用名称")
|
||||||
|
private String appName;
|
||||||
|
}
|
|
@ -0,0 +1,54 @@
|
||||||
|
/*
|
||||||
|
* 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.repository.app;
|
||||||
|
|
||||||
|
import org.springframework.data.jpa.repository.Modifying;
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
|
||||||
|
import org.springframework.data.repository.query.Param;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import cn.topiam.employee.common.entity.app.AppGroupAssociationEntity;
|
||||||
|
import cn.topiam.employee.support.repository.LogicDeleteRepository;
|
||||||
|
import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_SET;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 应用组成员
|
||||||
|
*
|
||||||
|
* @author TopIAM
|
||||||
|
* Created by support@topiam.cn on 2023年09月06日22:03:18
|
||||||
|
*/
|
||||||
|
@Repository
|
||||||
|
public interface AppGroupAssociationRepository extends
|
||||||
|
LogicDeleteRepository<AppGroupAssociationEntity, Long>,
|
||||||
|
QuerydslPredicateExecutor<AppGroupAssociationEntity>,
|
||||||
|
AppGroupAssociationRepositoryCustomized {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据应用组ID和应用ID删除
|
||||||
|
*
|
||||||
|
* @param groupId {@link String}
|
||||||
|
* @param appId {@link String}
|
||||||
|
*/
|
||||||
|
@Modifying
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
@Query(value = "UPDATE app_group_association SET " + SOFT_DELETE_SET
|
||||||
|
+ " WHERE app_id = :appId and group_id = :groupId", nativeQuery = true)
|
||||||
|
void deleteByGroupIdAndAppId(@Param("groupId") Long groupId, @Param("appId") Long appId);
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
/*
|
||||||
|
* 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.repository.app;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author TopIAM
|
||||||
|
* Created by support@topiam.cn on 2023/9/7 21:27
|
||||||
|
*/
|
||||||
|
public interface AppGroupAssociationRepositoryCustomized {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取应用组应用列表
|
||||||
|
*
|
||||||
|
* @param query {@link AppGroupAssociationListQuery}
|
||||||
|
* @param pageable {@link Pageable}
|
||||||
|
* @return {@link Page}
|
||||||
|
*/
|
||||||
|
Page<AppEntity> getAppGroupAssociationList(AppGroupAssociationListQuery query,
|
||||||
|
Pageable pageable);
|
||||||
|
}
|
|
@ -0,0 +1,84 @@
|
||||||
|
/*
|
||||||
|
* 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.repository.app.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.data.domain.PageImpl;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
|
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.repository.app.AppGroupAssociationRepositoryCustomized;
|
||||||
|
import cn.topiam.employee.common.repository.app.impl.mapper.AppEntityMapper;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author TopIAM
|
||||||
|
* Created by support@topiam.cn on 2023/9/7 21:27
|
||||||
|
*/
|
||||||
|
@Repository
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class AppGroupAssociationRepositoryCustomizedImpl implements
|
||||||
|
AppGroupAssociationRepositoryCustomized {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取应用组应用列表
|
||||||
|
*
|
||||||
|
* @param query {@link UserGroupMemberListQuery}
|
||||||
|
* @param pageable {@link Pageable}
|
||||||
|
* @return {@link Page}
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("DuplicatedCode")
|
||||||
|
@Override
|
||||||
|
public Page<AppEntity> getAppGroupAssociationList(AppGroupAssociationListQuery query,
|
||||||
|
Pageable pageable) {
|
||||||
|
//@formatter:off
|
||||||
|
StringBuilder builder = new StringBuilder("""
|
||||||
|
SELECT
|
||||||
|
app.*
|
||||||
|
FROM
|
||||||
|
app app LEFT JOIN app_group_association ass ON app.id_ = ass.app_id AND app.is_deleted = 0 AND ass.is_deleted = 0
|
||||||
|
WHERE ass.group_id = '%s'
|
||||||
|
""".formatted(query.getId()));
|
||||||
|
//应用名称
|
||||||
|
if (StringUtils.isNoneBlank(query.getAppName())) {
|
||||||
|
builder.append(" AND app.name_ like '%").append(query.getAppName()).append("%'");
|
||||||
|
}
|
||||||
|
builder.append(" ORDER BY `app`.create_time DESC");
|
||||||
|
//@formatter:on
|
||||||
|
String sql = builder.toString();
|
||||||
|
List<AppEntity> list = jdbcTemplate.query(
|
||||||
|
builder.append(" LIMIT ").append(pageable.getPageNumber() * pageable.getPageSize())
|
||||||
|
.append(",").append(pageable.getPageSize()).toString(),
|
||||||
|
new AppEntityMapper());
|
||||||
|
//@formatter:off
|
||||||
|
String countSql = "SELECT count(*) FROM (" + sql + ") app_";
|
||||||
|
//@formatter:on
|
||||||
|
Integer count = jdbcTemplate.queryForObject(countSql, Integer.class);
|
||||||
|
return new PageImpl<>(list, pageable, count);
|
||||||
|
}
|
||||||
|
|
||||||
|
private final JdbcTemplate jdbcTemplate;
|
||||||
|
}
|
|
@ -79,6 +79,7 @@ public class AppRepositoryCustomizedImpl implements AppRepositoryCustomized {
|
||||||
FROM
|
FROM
|
||||||
app
|
app
|
||||||
LEFT JOIN app_access_policy app_acce ON app.id_ = app_acce.app_id AND app_acce.is_deleted = '0'
|
LEFT JOIN app_access_policy app_acce ON app.id_ = app_acce.app_id AND app_acce.is_deleted = '0'
|
||||||
|
LEFT JOIN app_group_association ass ON app.id_ = ass.app_id AND ass.is_deleted = '0'
|
||||||
WHERE
|
WHERE
|
||||||
app.is_enabled = 1
|
app.is_enabled = 1
|
||||||
AND app.is_deleted = '0'
|
AND app.is_deleted = '0'
|
||||||
|
@ -90,7 +91,7 @@ public class AppRepositoryCustomizedImpl implements AppRepositoryCustomized {
|
||||||
}
|
}
|
||||||
//分组id
|
//分组id
|
||||||
if (null!=groupId) {
|
if (null!=groupId) {
|
||||||
builder.append(" AND app.group_id = ").append(groupId);
|
builder.append(" AND ass.group_id = ").append(groupId);
|
||||||
}
|
}
|
||||||
//@formatter:on
|
//@formatter:on
|
||||||
String sql = builder.toString();
|
String sql = builder.toString();
|
||||||
|
|
|
@ -53,12 +53,33 @@
|
||||||
</column>
|
</column>
|
||||||
<column name="remark_" remarks="备注" type="TEXT"/>
|
<column name="remark_" remarks="备注" type="TEXT"/>
|
||||||
</createTable>
|
</createTable>
|
||||||
<!--应用表添加分组字段-->
|
<createTable remarks="应用组关联" tableName="app_group_association">
|
||||||
<addColumn tableName="app">
|
<column name="id_" remarks="主键ID" type="BIGINT">
|
||||||
|
<constraints nullable="false" primaryKey="true"/>
|
||||||
|
</column>
|
||||||
<column name="group_id" remarks="应用组ID" type="BIGINT">
|
<column name="group_id" remarks="应用组ID" type="BIGINT">
|
||||||
<constraints nullable="false"/>
|
<constraints nullable="false"/>
|
||||||
</column>
|
</column>
|
||||||
</addColumn>
|
<column name="app_id" remarks="应用ID" type="BIGINT">
|
||||||
|
<constraints nullable="false"/>
|
||||||
|
</column>
|
||||||
|
<column name="create_by" remarks="创建者" type="VARCHAR(64)">
|
||||||
|
<constraints nullable="false"/>
|
||||||
|
</column>
|
||||||
|
<column defaultValueComputed="CURRENT_TIMESTAMP" name="create_time" remarks="创建时间" type="datetime">
|
||||||
|
<constraints nullable="false"/>
|
||||||
|
</column>
|
||||||
|
<column name="update_by" remarks="修改者" type="VARCHAR(64)">
|
||||||
|
<constraints nullable="false"/>
|
||||||
|
</column>
|
||||||
|
<column defaultValueComputed="CURRENT_TIMESTAMP" name="update_time" remarks="修改时间" type="datetime">
|
||||||
|
<constraints nullable="false"/>
|
||||||
|
</column>
|
||||||
|
<column name="remark_" remarks="备注" type="TEXT"/>
|
||||||
|
<column name="is_deleted" remarks="删除标记" type="TINYINT(1)" defaultValueNumeric="0">
|
||||||
|
<constraints nullable="true"/>
|
||||||
|
</column>
|
||||||
|
</createTable>
|
||||||
<createTable remarks="应用权限资源" tableName="app_permission_resource">
|
<createTable remarks="应用权限资源" tableName="app_permission_resource">
|
||||||
<column name="id_" remarks="主键ID" type="BIGINT">
|
<column name="id_" remarks="主键ID" type="BIGINT">
|
||||||
<constraints nullable="false" primaryKey="true"/>
|
<constraints nullable="false" primaryKey="true"/>
|
||||||
|
@ -196,5 +217,10 @@
|
||||||
<constraints nullable="true"/>
|
<constraints nullable="true"/>
|
||||||
</column>
|
</column>
|
||||||
</createTable>
|
</createTable>
|
||||||
|
<createIndex tableName="app_group_association" indexName="uk_app_group_association" unique="true">
|
||||||
|
<column name="group_id"/>
|
||||||
|
<column name="app_id"/>
|
||||||
|
<column name="is_deleted"/>
|
||||||
|
</createIndex>
|
||||||
</changeSet>
|
</changeSet>
|
||||||
</databaseChangeLog>
|
</databaseChangeLog>
|
|
@ -22,11 +22,16 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import cn.topiam.employee.audit.annotation.Audit;
|
import cn.topiam.employee.audit.annotation.Audit;
|
||||||
import cn.topiam.employee.audit.event.type.EventType;
|
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.console.pojo.query.app.AppGroupQuery;
|
import cn.topiam.employee.console.pojo.query.app.AppGroupQuery;
|
||||||
import cn.topiam.employee.console.pojo.result.app.AppGroupGetResult;
|
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.AppGroupListResult;
|
||||||
|
import cn.topiam.employee.console.pojo.result.app.AppListResult;
|
||||||
import cn.topiam.employee.console.pojo.save.app.AppGroupCreateParam;
|
import cn.topiam.employee.console.pojo.save.app.AppGroupCreateParam;
|
||||||
import cn.topiam.employee.console.pojo.update.app.AppGroupUpdateParam;
|
import cn.topiam.employee.console.pojo.update.app.AppGroupUpdateParam;
|
||||||
import cn.topiam.employee.console.service.app.AppGroupService;
|
import cn.topiam.employee.console.service.app.AppGroupService;
|
||||||
|
@ -39,7 +44,9 @@ import cn.topiam.employee.support.result.ApiRestResult;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
import static cn.topiam.employee.common.constant.AppConstants.APP_PATH;
|
import static cn.topiam.employee.common.constant.AppConstants.APP_PATH;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -169,6 +176,58 @@ public class AppGroupController {
|
||||||
return ApiRestResult.<Boolean> builder().result(result).build();
|
return ApiRestResult.<Boolean> builder().result(result).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加分组用户
|
||||||
|
*
|
||||||
|
* @param appIds {@link String}
|
||||||
|
* @return {@link Boolean}
|
||||||
|
*/
|
||||||
|
@Lock
|
||||||
|
@Preview
|
||||||
|
@Validated
|
||||||
|
@Operation(summary = "添加应用组关联")
|
||||||
|
@Audit(type = EventType.ADD_APP_GROUP_ASSOCIATION)
|
||||||
|
@PostMapping(value = "/add_association/{id}")
|
||||||
|
@PreAuthorize(value = "authenticated and @sae.hasAuthority(T(cn.topiam.employee.support.security.userdetails.UserType).ADMIN)")
|
||||||
|
public ApiRestResult<Boolean> addAssociation(@PathVariable(value = "id") String id,
|
||||||
|
@Parameter(description = "应用ID") String[] appIds) {
|
||||||
|
return ApiRestResult.<Boolean> builder().result(appGroupService.addAssociation(id, appIds))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 移除分组用户
|
||||||
|
*
|
||||||
|
* @param id {@link String}
|
||||||
|
* @return {@link Boolean}
|
||||||
|
*/
|
||||||
|
@Lock
|
||||||
|
@Preview
|
||||||
|
@Operation(summary = "移除应用组关联")
|
||||||
|
@Audit(type = EventType.REMOVE_APP_GROUP_ASSOCIATION)
|
||||||
|
@DeleteMapping(value = "/remove_association/{id}")
|
||||||
|
@PreAuthorize(value = "authenticated and @sae.hasAuthority(T(cn.topiam.employee.support.security.userdetails.UserType).ADMIN)")
|
||||||
|
public ApiRestResult<Boolean> removeAssociation(@PathVariable(value = "id") String id,
|
||||||
|
@NotEmpty(message = "应用ID不能为空") @Parameter(description = "应用ID集合") String[] appIds) {
|
||||||
|
return ApiRestResult.<Boolean> builder()
|
||||||
|
.result(appGroupService.batchRemoveAssociation(id, Lists.newArrayList(appIds))).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取应用组内应用
|
||||||
|
*
|
||||||
|
* @param query {@link UserGroupMemberListQuery} 参数
|
||||||
|
* @return {@link Boolean}
|
||||||
|
*/
|
||||||
|
@Operation(summary = "获取应用组内应用")
|
||||||
|
@GetMapping(value = "/{id}/app_list")
|
||||||
|
@PreAuthorize(value = "authenticated and @sae.hasAuthority(T(cn.topiam.employee.support.security.userdetails.UserType).ADMIN)")
|
||||||
|
public ApiRestResult<Page<AppListResult>> getAppGroupAssociationList(PageModel model,
|
||||||
|
AppGroupAssociationListQuery query) {
|
||||||
|
return ApiRestResult.<Page<AppListResult>> builder()
|
||||||
|
.result(appGroupService.getAppGroupAssociationList(model, query)).build();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AppGroupService
|
* AppGroupService
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -17,9 +17,13 @@
|
||||||
*/
|
*/
|
||||||
package cn.topiam.employee.console.service.app;
|
package cn.topiam.employee.console.service.app;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import cn.topiam.employee.common.entity.app.query.AppGroupAssociationListQuery;
|
||||||
import cn.topiam.employee.console.pojo.query.app.AppGroupQuery;
|
import cn.topiam.employee.console.pojo.query.app.AppGroupQuery;
|
||||||
import cn.topiam.employee.console.pojo.result.app.AppGroupGetResult;
|
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.AppGroupListResult;
|
||||||
|
import cn.topiam.employee.console.pojo.result.app.AppListResult;
|
||||||
import cn.topiam.employee.console.pojo.save.app.AppGroupCreateParam;
|
import cn.topiam.employee.console.pojo.save.app.AppGroupCreateParam;
|
||||||
import cn.topiam.employee.console.pojo.update.app.AppGroupUpdateParam;
|
import cn.topiam.employee.console.pojo.update.app.AppGroupUpdateParam;
|
||||||
import cn.topiam.employee.support.repository.page.domain.Page;
|
import cn.topiam.employee.support.repository.page.domain.Page;
|
||||||
|
@ -91,4 +95,32 @@ public interface AppGroupService {
|
||||||
* @return {@link Boolean}
|
* @return {@link Boolean}
|
||||||
*/
|
*/
|
||||||
Boolean disableAppGroup(String id);
|
Boolean disableAppGroup(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加应用
|
||||||
|
*
|
||||||
|
* @param appIds {@link String}
|
||||||
|
* @param groupId {@link String}
|
||||||
|
* @return {@link Boolean}
|
||||||
|
*/
|
||||||
|
Boolean addAssociation(String groupId, String[] appIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量移除应用
|
||||||
|
*
|
||||||
|
* @param id {@link String}
|
||||||
|
* @param appIds {@link String}
|
||||||
|
* @return {@link Boolean}
|
||||||
|
*/
|
||||||
|
Boolean batchRemoveAssociation(String id, List<String> appIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取应用组内应用列表
|
||||||
|
*
|
||||||
|
* @param query {@link AppGroupAssociationListQuery}
|
||||||
|
* @param page {@link PageModel}
|
||||||
|
* @return {@link AppListResult}
|
||||||
|
*/
|
||||||
|
Page<AppListResult> getAppGroupAssociationList(PageModel page,
|
||||||
|
AppGroupAssociationListQuery query);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,25 +18,36 @@
|
||||||
package cn.topiam.employee.console.service.app.impl;
|
package cn.topiam.employee.console.service.app.impl;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.data.querydsl.QPageRequest;
|
import org.springframework.data.querydsl.QPageRequest;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
import com.querydsl.core.types.OrderSpecifier;
|
import com.querydsl.core.types.OrderSpecifier;
|
||||||
import com.querydsl.core.types.Predicate;
|
import com.querydsl.core.types.Predicate;
|
||||||
|
|
||||||
import cn.topiam.employee.audit.context.AuditContext;
|
import cn.topiam.employee.audit.context.AuditContext;
|
||||||
import cn.topiam.employee.audit.entity.Target;
|
import cn.topiam.employee.audit.entity.Target;
|
||||||
import cn.topiam.employee.audit.enums.TargetType;
|
import cn.topiam.employee.audit.enums.TargetType;
|
||||||
|
import cn.topiam.employee.common.entity.app.AppEntity;
|
||||||
|
import cn.topiam.employee.common.entity.app.AppGroupAssociationEntity;
|
||||||
import cn.topiam.employee.common.entity.app.AppGroupEntity;
|
import cn.topiam.employee.common.entity.app.AppGroupEntity;
|
||||||
import cn.topiam.employee.common.entity.app.QAppGroupEntity;
|
import cn.topiam.employee.common.entity.app.QAppGroupEntity;
|
||||||
|
import cn.topiam.employee.common.entity.app.query.AppGroupAssociationListQuery;
|
||||||
|
import cn.topiam.employee.common.repository.app.AppGroupAssociationRepository;
|
||||||
import cn.topiam.employee.common.repository.app.AppGroupRepository;
|
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.converter.app.AppGroupConverter;
|
||||||
import cn.topiam.employee.console.pojo.query.app.AppGroupQuery;
|
import cn.topiam.employee.console.pojo.query.app.AppGroupQuery;
|
||||||
import cn.topiam.employee.console.pojo.result.app.AppGroupGetResult;
|
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.AppGroupListResult;
|
||||||
|
import cn.topiam.employee.console.pojo.result.app.AppListResult;
|
||||||
import cn.topiam.employee.console.pojo.save.app.AppGroupCreateParam;
|
import cn.topiam.employee.console.pojo.save.app.AppGroupCreateParam;
|
||||||
import cn.topiam.employee.console.pojo.update.app.AppGroupUpdateParam;
|
import cn.topiam.employee.console.pojo.update.app.AppGroupUpdateParam;
|
||||||
import cn.topiam.employee.console.service.app.AppGroupService;
|
import cn.topiam.employee.console.service.app.AppGroupService;
|
||||||
|
@ -93,7 +104,6 @@ public class AppGroupServiceImpl implements AppGroupService {
|
||||||
public Boolean createAppGroup(AppGroupCreateParam param) {
|
public Boolean createAppGroup(AppGroupCreateParam param) {
|
||||||
// TODO 创建后没有数据权限
|
// TODO 创建后没有数据权限
|
||||||
AppGroupEntity entity = appGroupConverter.appGroupCreateParamConvertToEntity(param);
|
AppGroupEntity entity = appGroupConverter.appGroupCreateParamConvertToEntity(param);
|
||||||
entity.setEnabled(true);
|
|
||||||
appGroupRepository.save(entity);
|
appGroupRepository.save(entity);
|
||||||
AuditContext.setTarget(
|
AuditContext.setTarget(
|
||||||
Target.builder().id(String.valueOf(entity.getId())).type(TargetType.APP_GROUP).build());
|
Target.builder().id(String.valueOf(entity.getId())).type(TargetType.APP_GROUP).build());
|
||||||
|
@ -194,13 +204,92 @@ public class AppGroupServiceImpl implements AppGroupService {
|
||||||
return optional.get();
|
return optional.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加应用
|
||||||
|
*
|
||||||
|
* @param appIds {@link String}
|
||||||
|
* @param groupId {@link String}
|
||||||
|
* @return {@link Boolean}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean addAssociation(String groupId, String[] appIds) {
|
||||||
|
Optional<AppGroupEntity> optional = appGroupRepository.findById(Long.valueOf(groupId));
|
||||||
|
//用户组不存在
|
||||||
|
if (optional.isEmpty()) {
|
||||||
|
AuditContext.setContent("操作失败,应用组不存在");
|
||||||
|
log.warn(AuditContext.getContent());
|
||||||
|
throw new TopIamException(AuditContext.getContent());
|
||||||
|
}
|
||||||
|
List<AppGroupAssociationEntity> list = new ArrayList<>();
|
||||||
|
Lists.newArrayList(appIds).forEach(id -> {
|
||||||
|
AppGroupAssociationEntity member = new AppGroupAssociationEntity();
|
||||||
|
member.setGroupId(Long.valueOf(groupId));
|
||||||
|
member.setAppId(Long.valueOf(id));
|
||||||
|
list.add(member);
|
||||||
|
});
|
||||||
|
//添加
|
||||||
|
appGroupAssociationRepository.saveAll(list);
|
||||||
|
List<Target> targets = new ArrayList<>(Arrays.stream(appIds)
|
||||||
|
.map(i -> Target.builder().id(i).type(TargetType.APPLICATION).build()).toList());
|
||||||
|
targets.add(Target.builder().id(groupId).type(TargetType.APP_GROUP).build());
|
||||||
|
AuditContext.setTarget(targets);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量移除应用
|
||||||
|
*
|
||||||
|
* @param appIds {@link String}
|
||||||
|
* @param id {@link String}
|
||||||
|
* @return {@link Boolean}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean batchRemoveAssociation(String id, List<String> appIds) {
|
||||||
|
Optional<AppGroupEntity> optional = appGroupRepository.findById(Long.valueOf(id));
|
||||||
|
//用户组不存在
|
||||||
|
if (optional.isEmpty()) {
|
||||||
|
AuditContext.setContent("操作失败,应用组不存在");
|
||||||
|
log.warn(AuditContext.getContent());
|
||||||
|
throw new TopIamException(AuditContext.getContent());
|
||||||
|
}
|
||||||
|
appIds.forEach(userId -> appGroupAssociationRepository
|
||||||
|
.deleteByGroupIdAndAppId(Long.valueOf(id), Long.valueOf(userId)));
|
||||||
|
List<Target> targets = new ArrayList<>(appIds.stream()
|
||||||
|
.map(i -> Target.builder().id(i).type(TargetType.APPLICATION).build()).toList());
|
||||||
|
targets.add(Target.builder().id(id).type(TargetType.APP_GROUP).build());
|
||||||
|
AuditContext.setTarget(targets);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取应用组内应用列表
|
||||||
|
*
|
||||||
|
* @param query {@link AppGroupAssociationListQuery}
|
||||||
|
* @return {@link AppListResult}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Page<AppListResult> getAppGroupAssociationList(PageModel model,
|
||||||
|
AppGroupAssociationListQuery query) {
|
||||||
|
org.springframework.data.domain.Page<AppEntity> page = appGroupAssociationRepository
|
||||||
|
.getAppGroupAssociationList(query,
|
||||||
|
PageRequest.of(model.getCurrent(), model.getPageSize()));
|
||||||
|
return appConverter.entityConvertToAppListResult(page);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AppGroupRepository
|
* AppGroupRepository
|
||||||
*/
|
*/
|
||||||
private final AppGroupRepository appGroupRepository;
|
private final AppGroupRepository appGroupRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AppGroupConverter
|
* AppGroupConverter
|
||||||
*/
|
*/
|
||||||
private final AppGroupConverter appGroupConverter;
|
private final AppGroupConverter appGroupConverter;
|
||||||
|
|
||||||
|
private final AppConverter appConverter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AppGroupAssociationRepository
|
||||||
|
*/
|
||||||
|
private final AppGroupAssociationRepository appGroupAssociationRepository;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,8 +25,9 @@ import org.mapstruct.Mapper;
|
||||||
import com.querydsl.core.types.ExpressionUtils;
|
import com.querydsl.core.types.ExpressionUtils;
|
||||||
import com.querydsl.core.types.Predicate;
|
import com.querydsl.core.types.Predicate;
|
||||||
|
|
||||||
import cn.topiam.employee.common.entity.app.AppEntity;
|
import cn.topiam.employee.common.entity.app.AppGroupAssociationEntity;
|
||||||
import cn.topiam.employee.common.entity.app.AppGroupEntity;
|
import cn.topiam.employee.common.entity.app.AppGroupEntity;
|
||||||
|
import cn.topiam.employee.common.entity.app.QAppGroupAssociationEntity;
|
||||||
import cn.topiam.employee.common.entity.app.QAppGroupEntity;
|
import cn.topiam.employee.common.entity.app.QAppGroupEntity;
|
||||||
import cn.topiam.employee.portal.pojo.result.AppGroupListResult;
|
import cn.topiam.employee.portal.pojo.result.AppGroupListResult;
|
||||||
|
|
||||||
|
@ -53,20 +54,32 @@ public interface AppGroupConverter {
|
||||||
return predicate;
|
return predicate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 应用组与应用关联 Predicate
|
||||||
|
*
|
||||||
|
* @return {@link Predicate}
|
||||||
|
*/
|
||||||
|
default Predicate queryAppGroupAssociationPredicate() {
|
||||||
|
QAppGroupAssociationEntity appGroupAssociation = QAppGroupAssociationEntity.appGroupAssociationEntity;
|
||||||
|
Predicate predicate = appGroupAssociation.deleted.eq(Boolean.FALSE);
|
||||||
|
//@formatter:on
|
||||||
|
return predicate;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 实体转分组管理列表
|
* 实体转分组管理列表
|
||||||
*
|
*
|
||||||
* @param list {@link AppGroupEntity}
|
* @param list {@link AppGroupEntity}
|
||||||
* @param appList {@link AppEntity}
|
* @param appGroupAssociationList {@link AppGroupAssociationEntity}
|
||||||
* @return {@link AppGroupListResult}
|
* @return {@link AppGroupListResult}
|
||||||
*/
|
*/
|
||||||
default List<AppGroupListResult> entityConvertToAppGroupListResult(List<AppGroupEntity> list,
|
default List<AppGroupListResult> entityConvertToAppGroupListResult(List<AppGroupEntity> list,
|
||||||
List<AppEntity> appList) {
|
List<AppGroupAssociationEntity> appGroupAssociationList) {
|
||||||
List<AppGroupListResult> results = new ArrayList<>();
|
List<AppGroupListResult> results = new ArrayList<>();
|
||||||
for (AppGroupEntity entity : list) {
|
for (AppGroupEntity entity : list) {
|
||||||
AppGroupListResult result = appGroupEntityConverterToResult(entity);
|
AppGroupListResult result = appGroupEntityConverterToResult(entity);
|
||||||
Long count = appList.stream().filter(t -> t.getGroupId().equals(entity.getId()))
|
Long count = appGroupAssociationList.stream()
|
||||||
.count();
|
.filter(t -> t.getGroupId().equals(entity.getId())).count();
|
||||||
result.setAppCount(Integer.valueOf(count.toString()));
|
result.setAppCount(Integer.valueOf(count.toString()));
|
||||||
results.add(result);
|
results.add(result);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,9 @@ import org.springframework.stereotype.Service;
|
||||||
import com.querydsl.core.types.Predicate;
|
import com.querydsl.core.types.Predicate;
|
||||||
|
|
||||||
import cn.topiam.employee.common.entity.app.AppEntity;
|
import cn.topiam.employee.common.entity.app.AppEntity;
|
||||||
|
import cn.topiam.employee.common.entity.app.AppGroupAssociationEntity;
|
||||||
import cn.topiam.employee.common.entity.app.AppGroupEntity;
|
import cn.topiam.employee.common.entity.app.AppGroupEntity;
|
||||||
|
import cn.topiam.employee.common.repository.app.AppGroupAssociationRepository;
|
||||||
import cn.topiam.employee.common.repository.app.AppGroupRepository;
|
import cn.topiam.employee.common.repository.app.AppGroupRepository;
|
||||||
import cn.topiam.employee.common.repository.app.AppRepository;
|
import cn.topiam.employee.common.repository.app.AppRepository;
|
||||||
import cn.topiam.employee.portal.converter.AppConverter;
|
import cn.topiam.employee.portal.converter.AppConverter;
|
||||||
|
@ -70,36 +72,46 @@ public class AppServiceImpl implements AppService {
|
||||||
@Override
|
@Override
|
||||||
public List<AppGroupListResult> getAppGroupList() {
|
public List<AppGroupListResult> getAppGroupList() {
|
||||||
Predicate predicate = appGroupConverter.queryPredicate();
|
Predicate predicate = appGroupConverter.queryPredicate();
|
||||||
List<AppEntity> appList = appRepository.getAppListByGroup();
|
Predicate appGroupAssociationPredicate = appGroupConverter
|
||||||
|
.queryAppGroupAssociationPredicate();
|
||||||
|
List<AppGroupAssociationEntity> appGroupAssociationList = (List<AppGroupAssociationEntity>) appGroupAssociationRepository
|
||||||
|
.findAll(appGroupAssociationPredicate);
|
||||||
//查询映射
|
//查询映射
|
||||||
List<AppGroupEntity> list = (List<AppGroupEntity>) appGroupRepository.findAll(predicate);
|
List<AppGroupEntity> list = (List<AppGroupEntity>) appGroupRepository.findAll(predicate);
|
||||||
return appGroupConverter.entityConvertToAppGroupListResult(list, appList);
|
return appGroupConverter.entityConvertToAppGroupListResult(list, appGroupAssociationList);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AppRepository
|
* AppRepository
|
||||||
*/
|
*/
|
||||||
private final AppRepository appRepository;
|
private final AppRepository appRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AppGroupRepository
|
* AppGroupRepository
|
||||||
*/
|
*/
|
||||||
private final AppGroupRepository appGroupRepository;
|
private final AppGroupRepository appGroupRepository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AppGroupAssociationRepository
|
||||||
|
*/
|
||||||
|
private final AppGroupAssociationRepository appGroupAssociationRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AppConverter
|
* AppConverter
|
||||||
*/
|
*/
|
||||||
private final AppConverter appConverter;
|
private final AppConverter appConverter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AppGroupConverter
|
* AppGroupConverter
|
||||||
*/
|
*/
|
||||||
private final AppGroupConverter appGroupConverter;
|
private final AppGroupConverter appGroupConverter;
|
||||||
|
|
||||||
public AppServiceImpl(AppRepository appRepository, AppGroupRepository appGroupRepository,
|
public AppServiceImpl(AppRepository appRepository, AppGroupRepository appGroupRepository,
|
||||||
|
AppGroupAssociationRepository appGroupAssociationRepository,
|
||||||
AppConverter appConverter, AppGroupConverter appGroupConverter) {
|
AppConverter appConverter, AppGroupConverter appGroupConverter) {
|
||||||
this.appRepository = appRepository;
|
this.appRepository = appRepository;
|
||||||
this.appGroupRepository = appGroupRepository;
|
this.appGroupRepository = appGroupRepository;
|
||||||
|
this.appGroupAssociationRepository = appGroupAssociationRepository;
|
||||||
this.appConverter = appConverter;
|
this.appConverter = appConverter;
|
||||||
this.appGroupConverter = appGroupConverter;
|
this.appGroupConverter = appGroupConverter;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue