Browse Source

添加应用功能优化

pull/44/head
shao1121353141 1 year ago
parent
commit
e976af0188
  1. 7
      eiam-audit/src/main/java/cn/topiam/employee/audit/event/type/AppEventType.java
  2. 4
      eiam-audit/src/main/java/cn/topiam/employee/audit/event/type/EventType.java
  3. 19
      eiam-console/src/main/java/cn/topiam/employee/console/controller/app/AppGroupController.java
  4. 6
      eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/app/AppGroupGetResult.java
  5. 6
      eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/app/AppGroupListResult.java
  6. 7
      eiam-console/src/main/java/cn/topiam/employee/console/pojo/save/app/AppGroupCreateParam.java
  7. 13
      eiam-console/src/main/java/cn/topiam/employee/console/service/app/impl/AppGroupServiceImpl.java

7
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));
/**
* 移除应用分组关联
*/

4
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),
/**
* 移除应用组关联
*/

19
eiam-console/src/main/java/cn/topiam/employee/console/controller/app/AppGroupController.java

@ -176,25 +176,6 @@ public class AppGroupController {
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();
}
/**
* 移除分组用户
*

6
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;
/**
* 创建时间
*/

6
eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/app/AppGroupListResult.java

@ -53,12 +53,6 @@ public class AppGroupListResult implements Serializable {
@Parameter(description = "分组编码")
private String code;
/**
* 是否启用
*/
@Parameter(description = "是否启用")
private Boolean enabled;
/**
* 创建时间
*/

7
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;
}

13
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<AppGroupListResult> getAppGroupList(PageModel pageModel, AppGroupQuery query) {
//查询映射
org.springframework.data.domain.Page<AppGroupPO> list = appGroupRepository
.getAppGroupList(query, PageRequest.of(pageModel.getCurrent(), pageModel.getPageSize()));
org.springframework.data.domain.Page<AppGroupPO> 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<AppGroupAssociationEntity> 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;

Loading…
Cancel
Save