diff --git a/eiam-audit/src/main/java/cn/topiam/employee/audit/event/type/AppEventType.java b/eiam-audit/src/main/java/cn/topiam/employee/audit/event/type/AppEventType.java index e0c83e44..547d2fdf 100644 --- a/eiam-audit/src/main/java/cn/topiam/employee/audit/event/type/AppEventType.java +++ b/eiam-audit/src/main/java/cn/topiam/employee/audit/event/type/AppEventType.java @@ -182,13 +182,6 @@ public class AppEventType { public static Type DELETE_APP_GROUP = new Type("eiam:event:app_group:delete", "删除应用分组", 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)); - /** * 移除应用分组关联 */ diff --git a/eiam-audit/src/main/java/cn/topiam/employee/audit/event/type/EventType.java b/eiam-audit/src/main/java/cn/topiam/employee/audit/event/type/EventType.java index a68bc15a..ea823c25 100644 --- a/eiam-audit/src/main/java/cn/topiam/employee/audit/event/type/EventType.java +++ b/eiam-audit/src/main/java/cn/topiam/employee/audit/event/type/EventType.java @@ -504,10 +504,6 @@ public enum EventType { * 删除应用分组 */ DELETE_APP_GROUP(AppEventType.DELETE_APP_GROUP), - /** - * 添加应用组关联 - */ - ADD_APP_GROUP_ASSOCIATION(AppEventType.ADD_APP_GROUP_ASSOCIATION), /** * 移除应用组关联 */ diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/controller/app/AppGroupController.java b/eiam-console/src/main/java/cn/topiam/employee/console/controller/app/AppGroupController.java index a82533b1..4969c3fd 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/controller/app/AppGroupController.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/controller/app/AppGroupController.java @@ -176,25 +176,6 @@ public class AppGroupController { return ApiRestResult. 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 addAssociation(@PathVariable(value = "id") String id, - @Parameter(description = "应用ID") String[] appIds) { - return ApiRestResult. builder().result(appGroupService.addAssociation(id, appIds)) - .build(); - } - /** * 移除分组用户 * diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/converter/app/AppGroupConverter.java b/eiam-console/src/main/java/cn/topiam/employee/console/converter/app/AppGroupConverter.java index 7385c535..3315f0f4 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/converter/app/AppGroupConverter.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/converter/app/AppGroupConverter.java @@ -73,7 +73,7 @@ public interface AppGroupConverter { * @param appGroupPo {@link AppGroupPO} * @return {@link AppGroupListResult} */ - AppGroupListResult entityConvertToAppGroupListResult(AppGroupPO appGroupPo); + AppGroupListResult entityConvertToAppGroupListResult(AppGroupPO appGroupPo); /** * 实体转分组返回 @@ -81,7 +81,7 @@ public interface AppGroupConverter { * @param entity {@link AppGroupEntity} * @return {@link AppGroupGetResult} */ - AppGroupGetResult entityConvertToAppGroupResult(AppGroupEntity entity); + AppGroupGetResult entityConvertToAppGroupResult(AppGroupEntity entity); /** * 将分组修改对象转换为entity diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/app/AppGroupGetResult.java b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/app/AppGroupGetResult.java index df29ba2f..d90f56cf 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/app/AppGroupGetResult.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/app/AppGroupGetResult.java @@ -51,12 +51,6 @@ public class AppGroupGetResult implements Serializable { @Parameter(description = "分组编码") private String code; - /** - * 是否启用 - */ - @Parameter(description = "分组是否启用") - private Boolean enabled; - /** * 创建时间 */ diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/app/AppGroupListResult.java b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/app/AppGroupListResult.java index e32cf3a6..cc845b88 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/app/AppGroupListResult.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/app/AppGroupListResult.java @@ -39,25 +39,19 @@ public class AppGroupListResult implements Serializable { * ID */ @Parameter(description = "ID") - private String id; + private String id; /** * 分组名称 */ @Parameter(description = "分组名称") - private String name; + private String name; /** * 分组编码 */ @Parameter(description = "分组编码") - private String code; - - /** - * 是否启用 - */ - @Parameter(description = "是否启用") - private Boolean enabled; + private String code; /** * 创建时间 @@ -69,6 +63,6 @@ public class AppGroupListResult implements Serializable { * 备注 */ @Parameter(description = "备注") - private String remark; + private String remark; } diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/save/app/AppGroupCreateParam.java b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/save/app/AppGroupCreateParam.java index 580f59d2..4e94a894 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/save/app/AppGroupCreateParam.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/save/app/AppGroupCreateParam.java @@ -21,6 +21,7 @@ import java.io.Serializable; import lombok.Data; +import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; @@ -54,4 +55,10 @@ public class AppGroupCreateParam implements Serializable { @Schema(description = "备注") private String remark; + /** + * 应用分组ID + */ + @Parameter(description = "应用分组ID") + private String[] groupId; + } diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/update/app/AppGroupUpdateParam.java b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/update/app/AppGroupUpdateParam.java index 903d74f1..ec5282b8 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/update/app/AppGroupUpdateParam.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/update/app/AppGroupUpdateParam.java @@ -39,23 +39,23 @@ public class AppGroupUpdateParam implements Serializable { */ @Schema(description = "分组id") @NotNull(message = "ID不能为空") - private Long id; + private Long id; /** * 分组名称 */ @Schema(description = "分组名称") - private String name; + private String name; /** * 分组排序 */ @Schema(description = "分组编码") - private String code; + private String code; /** * 备注 */ @Schema(description = "备注") - private String remark; + private String remark; } diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/service/app/impl/AppGroupServiceImpl.java b/eiam-console/src/main/java/cn/topiam/employee/console/service/app/impl/AppGroupServiceImpl.java index 338be68b..d614399e 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/service/app/impl/AppGroupServiceImpl.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/service/app/impl/AppGroupServiceImpl.java @@ -78,8 +78,8 @@ public class AppGroupServiceImpl implements AppGroupService { @Override public Page getAppGroupList(PageModel pageModel, AppGroupQuery query) { //查询映射 - org.springframework.data.domain.Page list = appGroupRepository - .getAppGroupList(query, PageRequest.of(pageModel.getCurrent(), pageModel.getPageSize())); + org.springframework.data.domain.Page list = appGroupRepository.getAppGroupList( + query, PageRequest.of(pageModel.getCurrent(), pageModel.getPageSize())); return appGroupConverter.entityConvertToAppGroupListResult(list); } @@ -92,9 +92,16 @@ public class AppGroupServiceImpl implements AppGroupService { @Override @Transactional(rollbackFor = Exception.class) public Boolean createAppGroup(AppGroupCreateParam param) { - // TODO 创建后没有数据权限 AppGroupEntity entity = appGroupConverter.appGroupCreateParamConvertToEntity(param); appGroupRepository.save(entity); + List list = new ArrayList<>(); + for (String groupId : param.getGroupId()) { + AppGroupAssociationEntity appGroupAssociationEntity = new AppGroupAssociationEntity(); + appGroupAssociationEntity.setGroupId(Long.valueOf(groupId)); + appGroupAssociationEntity.setAppId(entity.getId()); + list.add(appGroupAssociationEntity); + } + appGroupAssociationRepository.saveAll(list); AuditContext.setTarget( Target.builder().id(String.valueOf(entity.getId())).type(TargetType.APP_GROUP).build()); return true; @@ -230,7 +237,7 @@ public class AppGroupServiceImpl implements AppGroupService { * 批量移除应用 * * @param appIds {@link String} - * @param id {@link String} + * @param id {@link String} * @return {@link Boolean} */ @Override