fix(系统设置): 修复项目添加成员报错的缺陷

This commit is contained in:
wxg0103 2024-02-01 20:23:57 +08:00 committed by 刘瑞斌
parent 123fd03839
commit cf40902d99
3 changed files with 5 additions and 9 deletions

View File

@ -128,7 +128,7 @@ public class OrganizationProjectController {
@PostMapping("/add-members") @PostMapping("/add-members")
@RequiresPermissions(PermissionConstants.ORGANIZATION_PROJECT_MEMBER_ADD) @RequiresPermissions(PermissionConstants.ORGANIZATION_PROJECT_MEMBER_ADD)
@Operation(summary = "系统设置-组织-项目-添加成员") @Operation(summary = "系统设置-组织-项目-添加成员")
@CheckOwner(resourceId = "#request.id", resourceType = "project") @CheckOwner(resourceId = "#request.projectId", resourceType = "project")
public void addProjectMember(@Validated @RequestBody ProjectAddMemberRequest request) { public void addProjectMember(@Validated @RequestBody ProjectAddMemberRequest request) {
ProjectAddMemberBatchRequest batchRequest = new ProjectAddMemberBatchRequest(); ProjectAddMemberBatchRequest batchRequest = new ProjectAddMemberBatchRequest();
batchRequest.setProjectIds(List.of(request.getProjectId())); batchRequest.setProjectIds(List.of(request.getProjectId()));

View File

@ -3,16 +3,14 @@ package io.metersphere.system.dto.request;
import io.metersphere.validation.groups.Created; import io.metersphere.validation.groups.Created;
import io.metersphere.validation.groups.Updated; import io.metersphere.validation.groups.Updated;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotBlank;
import lombok.Data; import lombok.Data;
import java.util.List; import java.util.List;
@Data @Data
public class ProjectAddMemberBatchRequest extends ProjectAddMemberRequest{ public class ProjectAddMemberBatchRequest extends ProjectAddMemberRequest {
@Schema(description = "项目ID集合", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "项目ID集合", requiredMode = Schema.RequiredMode.REQUIRED)
@Valid
private List< private List<
@NotBlank(message = "{project.id.not_blank}", groups = {Created.class, Updated.class}) @NotBlank(message = "{project.id.not_blank}", groups = {Created.class, Updated.class})
String> projectIds; String> projectIds;

View File

@ -3,7 +3,6 @@ package io.metersphere.system.dto.request;
import io.metersphere.validation.groups.Created; import io.metersphere.validation.groups.Created;
import io.metersphere.validation.groups.Updated; import io.metersphere.validation.groups.Updated;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotEmpty;
import lombok.Data; import lombok.Data;
@ -18,7 +17,6 @@ public class ProjectAddMemberRequest {
@Schema(description = "用户ID集合", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "用户ID集合", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "{user.ids.not_blank}") @NotEmpty(message = "{user.ids.not_blank}")
@Valid
private List< private List<
@NotBlank(message = "{user_role_relation.user_id.not_blank}", groups = {Created.class, Updated.class}) @NotBlank(message = "{user_role_relation.user_id.not_blank}", groups = {Created.class, Updated.class})
String> userIds; String> userIds;