From 4229848d70aeeb7ba96c8b98014ef33118ded8fc Mon Sep 17 00:00:00 2001 From: song-cc-rock Date: Fri, 1 Dec 2023 17:06:29 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E4=B8=AA=E4=BA=BA=E4=B8=AD=E5=BF=83):=20?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E7=BB=84=E7=BB=87=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/dto/OrganizationSwitchRequest.java | 17 +++++++++++++++++ .../system/mapper/ExtOrganizationMapper.java | 11 +++++++++-- .../system/mapper/ExtOrganizationMapper.xml | 6 ++++++ 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 backend/services/system-setting/src/main/java/io/metersphere/system/dto/OrganizationSwitchRequest.java diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/dto/OrganizationSwitchRequest.java b/backend/services/system-setting/src/main/java/io/metersphere/system/dto/OrganizationSwitchRequest.java new file mode 100644 index 0000000000..147d63b513 --- /dev/null +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/dto/OrganizationSwitchRequest.java @@ -0,0 +1,17 @@ +package io.metersphere.system.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.Size; +import lombok.Data; + +@Data +public class OrganizationSwitchRequest { + @Schema(description = "组织ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "{organization.id.not_blank}") + @Size(min = 1, max = 50, message = "{organization.id.length_range}") + private String organizationId; + @Schema(description = "用户ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "{user.id.not_blank}") + private String userId; +} diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtOrganizationMapper.java b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtOrganizationMapper.java index d460c8d134..ebf8f0af71 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtOrganizationMapper.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtOrganizationMapper.java @@ -1,11 +1,11 @@ package io.metersphere.system.mapper; -import io.metersphere.system.dto.sdk.OptionDTO; -import io.metersphere.system.dto.user.UserExtendDTO; import io.metersphere.system.domain.User; import io.metersphere.system.dto.*; import io.metersphere.system.dto.request.OrganizationDeleteRequest; import io.metersphere.system.dto.request.OrganizationRequest; +import io.metersphere.system.dto.sdk.OptionDTO; +import io.metersphere.system.dto.user.UserExtendDTO; import org.apache.ibatis.annotations.Param; import java.util.List; @@ -107,4 +107,11 @@ public interface ExtOrganizationMapper { * @return 组织下拉选项 */ List getOptionsByIds(@Param("ids") List ids); + + /** + * 获取用户关联组织ID + * @param userId 用户ID + * @return 用户ID集合 + */ + List getRelatedOrganizationIds(@Param("userId") String userId); } diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtOrganizationMapper.xml b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtOrganizationMapper.xml index 163d5c5a62..74bfd71e90 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtOrganizationMapper.xml +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtOrganizationMapper.xml @@ -131,6 +131,12 @@ + +