feat: add org member

This commit is contained in:
guoyuqi 2023-07-21 18:36:13 +08:00 committed by 刘瑞斌
parent 13bfa7e5bc
commit f99b48b824
5 changed files with 101 additions and 0 deletions

View File

@ -0,0 +1,22 @@
package io.metersphere.system.dto;
import io.metersphere.system.domain.User;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Map;
/**
* @author guoyuqi
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class OrgUserExtend extends User {
@Schema(title = "项目ID名称集合", requiredMode = Schema.RequiredMode.REQUIRED)
private Map<String,String> projectIdNameMap;;
@Schema(title = "用户组ID名称集合", requiredMode = Schema.RequiredMode.REQUIRED)
private Map<String,String> userRoleIdNameMap;
}

View File

@ -0,0 +1,22 @@
package io.metersphere.system.request;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotEmpty;
import lombok.Data;
import java.util.List;
/**
* @author guoyuqi
*/
@Data
public class OrgMemberExtendProjectRequest extends OrganizationMemberRequest{
/**
* 项目ID集合
*/
@Schema(title = "项目ID集合", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "{projectIds.not_empty}")
private List<String> projectIds;
}

View File

@ -0,0 +1,22 @@
package io.metersphere.system.request;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotEmpty;
import lombok.Data;
import java.util.List;
/**
* @author guoyuqi
*/
@Data
public class OrganizationMemberExtendRequest extends OrganizationMemberRequest {
/**
* 用户组ID集合
*/
@Schema(title = "用户组ID集合", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "{userGroupId.id.not_null}")
private List<String> userRoleIds;
}

View File

@ -0,0 +1,6 @@
# 插入测试数据
INSERT INTO project (id, num, organization_id, name, description, create_user, update_user, create_time, update_time) VALUES ('sys_org_projectId', null, (SELECT id FROM organization WHERE name LIKE '默认组织'), 'sys_org_projectId', '系统默认创建的项目', 'admin', 'admin', unix_timestamp() * 1000, unix_timestamp() * 1000);
INSERT INTO project (id, num, organization_id, name, description, create_user, update_user, create_time, update_time) VALUES ('sys_org_projectId1', null, (SELECT id FROM organization WHERE name LIKE '默认组织'), 'sys_org_projectId1', '系统默认创建的项目', 'test', 'test', unix_timestamp() * 1000, unix_timestamp() * 1000);

View File

@ -0,0 +1,29 @@
# 组织列表数据准备
INSERT INTO organization(id,num, name, description, create_time, update_time, create_user, update_user, delete_user, delete_time) VALUE
('sys_default_organization_1',null, 'organization_name_1', 'XXX-1', UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000, 'admin', 'admin', null, null);
INSERT INTO organization(id, num, name, description, create_time, update_time, create_user, update_user, delete_user, delete_time) VALUE
('sys_default_organization_2',null, 'organization_name_2', 'XXX-2', UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000, 'admin', 'admin', null, null);
INSERT INTO organization(id, num, name, description, create_time, update_time, create_user, update_user, delete_user, delete_time) VALUE
('sys_default_organization_3',null, 'organization_name_3', 'XXX-3', UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000, 'admin', 'admin', null, null);
INSERT INTO organization(id, num, name, description, create_time, update_time, create_user, update_user, delete_user, delete_time) VALUE
('sys_default_organization_4',null, 'organization_name_4', 'XXX-4', UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000, 'admin', 'admin', null, null);
INSERT INTO organization(id,num, name, description, create_time, update_time, create_user, update_user, delete_user, delete_time) VALUE
('sys_default_organization_5',null, 'organization_name_5', 'XXX-5', UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000, 'admin', 'admin', null, null);
INSERT INTO organization(id, num, name, description, create_time, update_time, create_user, update_user, delete_user, delete_time) VALUE
('sys_default_organization_6',null, 'organization_name_6', 'XXX-6', UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000, 'admin', 'admin', null, null);
INSERT INTO user(id, name, email, password, create_time, update_time, language, last_organization_id, phone, source, last_project_id, create_user, update_user) VALUE
('sys_default_user', 'testUserOne', 'testUserOne@metersphere.io', MD5('calong'), UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000, NULL, NUll, '', 'LOCAL', NULL, 'admin', 'admin');
INSERT INTO user(id, name, email, password, create_time, update_time, language, last_organization_id, phone, source, last_project_id, create_user, update_user) VALUE
('sys_default_user2', 'testUserTwo', 'testUserTwo@metersphere.io', MD5('calong'), UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000, NULL, NUll, '', 'LOCAL', NULL, 'admin', 'admin');
INSERT INTO user_role(id, name, description, internal, type, create_time, update_time, create_user, scope_id) VALUE
('sys_default_org_role_id_3', 'sys_default_org_role_id_3', 'XXX', FALSE, 'ORGANIZATION', UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000, 'admin', 'sys_default_organization_3');
INSERT INTO user_role(id, name, description, internal, type, create_time, update_time, create_user, scope_id) VALUE
('sys_default_project_role_id_3', 'sys_default_project_role_id_3', 'XXX', FALSE, 'PROJECT', UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000, 'admin', 'sys_default_organization_3');
INSERT INTO user_role(id, name, description, internal, type, create_time, update_time, create_user, scope_id) VALUE
('sys_default_org_role_id_1', 'sys_default_org_role_id_1', 'XXX', FALSE, 'ORGANIZATION', UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000, 'admin', 'sys_default_organization_3');
INSERT INTO user_role(id, name, description, internal, type, create_time, update_time, create_user, scope_id) VALUE
('sys_default_org_role_id_2', 'sys_default_org_role_id_2', 'XXX', FALSE, 'ORGANIZATION', UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000, 'admin', 'sys_default_organization_3');
INSERT INTO user_role(id, name, description, internal, type, create_time, update_time, create_user, scope_id) VALUE
('sys_default_org_role_id_4', 'sys_default_org_role_id_4', 'XXX', FALSE, 'ORGANIZATION', UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000, 'admin', 'sys_default_organization_3');