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. 4
      eiam-console/src/main/java/cn/topiam/employee/console/converter/app/AppGroupConverter.java
  5. 6
      eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/app/AppGroupGetResult.java
  6. 14
      eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/app/AppGroupListResult.java
  7. 7
      eiam-console/src/main/java/cn/topiam/employee/console/pojo/save/app/AppGroupCreateParam.java
  8. 8
      eiam-console/src/main/java/cn/topiam/employee/console/pojo/update/app/AppGroupUpdateParam.java
  9. 15
      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();
}
/**
* 移除分组用户
*

4
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

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

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

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

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

15
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;
@ -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…
Cancel
Save