feat(个人中心): 切换组织功能
This commit is contained in:
parent
1a8b1cc1f5
commit
4229848d70
|
@ -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;
|
||||||
|
}
|
|
@ -1,11 +1,11 @@
|
||||||
package io.metersphere.system.mapper;
|
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.domain.User;
|
||||||
import io.metersphere.system.dto.*;
|
import io.metersphere.system.dto.*;
|
||||||
import io.metersphere.system.dto.request.OrganizationDeleteRequest;
|
import io.metersphere.system.dto.request.OrganizationDeleteRequest;
|
||||||
import io.metersphere.system.dto.request.OrganizationRequest;
|
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 org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -107,4 +107,11 @@ public interface ExtOrganizationMapper {
|
||||||
* @return 组织下拉选项
|
* @return 组织下拉选项
|
||||||
*/
|
*/
|
||||||
List<OptionDTO> getOptionsByIds(@Param("ids") List<String> ids);
|
List<OptionDTO> getOptionsByIds(@Param("ids") List<String> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户关联组织ID
|
||||||
|
* @param userId 用户ID
|
||||||
|
* @return 用户ID集合
|
||||||
|
*/
|
||||||
|
List<String> getRelatedOrganizationIds(@Param("userId") String userId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,6 +131,12 @@
|
||||||
</foreach>
|
</foreach>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getRelatedOrganizationIds" resultType="java.lang.String">
|
||||||
|
select distinct o.id
|
||||||
|
from user_role_relation urr join organization o on urr.organization_id = o.id
|
||||||
|
where user_id = #{userId}
|
||||||
|
</select>
|
||||||
|
|
||||||
<sql id="queryWhereCondition">
|
<sql id="queryWhereCondition">
|
||||||
<where>
|
<where>
|
||||||
<if test="request.keyword != null">
|
<if test="request.keyword != null">
|
||||||
|
|
Loading…
Reference in New Issue