mirror of https://gitee.com/topiam/eiam
添加应用功能优化
parent
31b658372a
commit
e976af0188
|
@ -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));
|
||||
|
||||
/**
|
||||
* 移除应用分组关联
|
||||
*/
|
||||
|
|
|
@ -504,10 +504,6 @@ public enum EventType {
|
|||
* 删除应用分组
|
||||
*/
|
||||
DELETE_APP_GROUP(AppEventType.DELETE_APP_GROUP),
|
||||
/**
|
||||
* 添加应用组关联
|
||||
*/
|
||||
ADD_APP_GROUP_ASSOCIATION(AppEventType.ADD_APP_GROUP_ASSOCIATION),
|
||||
/**
|
||||
* 移除应用组关联
|
||||
*/
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除分组用户
|
||||
*
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -51,12 +51,6 @@ public class AppGroupGetResult implements Serializable {
|
|||
@Parameter(description = "分组编码")
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
@Parameter(description = "分组是否启用")
|
||||
private Boolean enabled;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
|
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue