refactor(系统设置): 项目增加查询用户列表的接口
This commit is contained in:
parent
e4d6864afd
commit
49a6e24f5d
|
@ -1,25 +0,0 @@
|
|||
package io.metersphere.sdk.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class ModuleSettingDTO {
|
||||
|
||||
@Schema(description = "接口测试")
|
||||
private Boolean apiTest;
|
||||
@Schema(description = "性能测试")
|
||||
private Boolean loadTest;
|
||||
@Schema(description = "UI测试")
|
||||
private Boolean uiTest;
|
||||
@Schema(description = "测试计划")
|
||||
private Boolean testPlan;
|
||||
@Schema(description = "工作台")
|
||||
private Boolean workstation;
|
||||
@Schema(description = "缺陷管理")
|
||||
private Boolean bugManagement;
|
||||
@Schema(description = "功能测试")
|
||||
private Boolean caseManagement;
|
||||
}
|
|
@ -8,6 +8,8 @@ import jakarta.validation.constraints.Size;
|
|||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class ProjectBaseRequest {
|
||||
|
@ -29,5 +31,5 @@ public class ProjectBaseRequest {
|
|||
private Boolean enable;
|
||||
|
||||
@Schema(description = "模块设置")
|
||||
private String moduleSetting;
|
||||
private List<String> moduleIds;
|
||||
}
|
||||
|
|
|
@ -6,11 +6,12 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
|||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class ProjectDTO extends Project {
|
||||
public class ProjectDTO extends Project implements Serializable {
|
||||
@Schema(description = "项目成员数量", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
private Long memberCount;
|
||||
@Schema(description = "所属组织", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
|
@ -19,4 +20,8 @@ public class ProjectDTO extends Project {
|
|||
private List<User> adminList;
|
||||
@Schema(description = "创建人是否是管理员", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
private Boolean projectCreateUserIsAdmin;
|
||||
@Schema(description = "模块设置", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
private List<String> moduleIds;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
package io.metersphere.sdk.dto;
|
||||
|
||||
import io.metersphere.project.domain.Project;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class ProjectExtendDTO extends Project implements Serializable {
|
||||
private List<String> moduleIds;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -7,6 +7,7 @@ import io.metersphere.project.domain.Project;
|
|||
import io.metersphere.sdk.constants.PermissionConstants;
|
||||
import io.metersphere.sdk.dto.AddProjectRequest;
|
||||
import io.metersphere.sdk.dto.ProjectDTO;
|
||||
import io.metersphere.sdk.dto.ProjectExtendDTO;
|
||||
import io.metersphere.sdk.dto.UpdateProjectRequest;
|
||||
import io.metersphere.sdk.log.annotation.Log;
|
||||
import io.metersphere.sdk.log.constants.OperationLogType;
|
||||
|
@ -50,7 +51,7 @@ public class OrganizationProjectController {
|
|||
@RequiresPermissions(PermissionConstants.ORGANIZATION_PROJECT_READ_ADD)
|
||||
@Log(type = OperationLogType.ADD, expression = "#msClass.addLog(#project)", msClass = OrganizationProjectLogService.class)
|
||||
@Operation(summary = "添加项目")
|
||||
public Project addProject(@RequestBody @Validated({Created.class}) AddProjectRequest project) {
|
||||
public ProjectExtendDTO addProject(@RequestBody @Validated({Created.class}) AddProjectRequest project) {
|
||||
return organizationProjectService.add(project, SessionUtils.getUserId());
|
||||
}
|
||||
|
||||
|
@ -76,7 +77,7 @@ public class OrganizationProjectController {
|
|||
@Log(type = OperationLogType.UPDATE, expression = "#msClass.updateLog(#project)", msClass = OrganizationProjectLogService.class)
|
||||
@Operation(summary = "更新项目信息")
|
||||
@RequiresPermissions(PermissionConstants.ORGANIZATION_PROJECT_READ_UPDATE)
|
||||
public Project updateProject(@RequestBody @Validated({Updated.class}) UpdateProjectRequest project) {
|
||||
public ProjectExtendDTO updateProject(@RequestBody @Validated({Updated.class}) UpdateProjectRequest project) {
|
||||
return organizationProjectService.update(project, SessionUtils.getUserId());
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ import io.metersphere.project.domain.Project;
|
|||
import io.metersphere.sdk.constants.PermissionConstants;
|
||||
import io.metersphere.sdk.dto.AddProjectRequest;
|
||||
import io.metersphere.sdk.dto.ProjectDTO;
|
||||
import io.metersphere.sdk.dto.ProjectExtendDTO;
|
||||
import io.metersphere.sdk.dto.UpdateProjectRequest;
|
||||
import io.metersphere.sdk.log.annotation.Log;
|
||||
import io.metersphere.sdk.log.constants.OperationLogType;
|
||||
|
@ -50,7 +51,7 @@ public class SystemProjectController {
|
|||
@RequiresPermissions(PermissionConstants.SYSTEM_ORGANIZATION_PROJECT_READ_ADD)
|
||||
@Log(type = OperationLogType.ADD, expression = "#msClass.addLog(#project)", msClass = SystemProjectLogService.class)
|
||||
@Operation(summary = "添加项目")
|
||||
public Project addProject(@RequestBody @Validated({Created.class}) AddProjectRequest project) {
|
||||
public ProjectExtendDTO addProject(@RequestBody @Validated({Created.class}) AddProjectRequest project) {
|
||||
return systemProjectService.add(project, SessionUtils.getUserId());
|
||||
}
|
||||
|
||||
|
@ -76,7 +77,7 @@ public class SystemProjectController {
|
|||
@Log(type = OperationLogType.UPDATE, expression = "#msClass.updateLog(#project)", msClass = SystemProjectLogService.class)
|
||||
@Operation(summary = "更新项目信息")
|
||||
@RequiresPermissions(PermissionConstants.SYSTEM_ORGANIZATION_PROJECT_READ_UPDATE)
|
||||
public Project updateProject(@RequestBody @Validated({Updated.class}) UpdateProjectRequest project) {
|
||||
public ProjectExtendDTO updateProject(@RequestBody @Validated({Updated.class}) UpdateProjectRequest project) {
|
||||
return systemProjectService.update(project, SessionUtils.getUserId());
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,8 @@
|
|||
p.delete_user,
|
||||
p.enable,
|
||||
count(distinct u.id) as memberCount,
|
||||
o.name as organizationName
|
||||
o.name as organizationName,
|
||||
p.module_setting
|
||||
FROM project p
|
||||
LEFT JOIN user_role_relation u on p.id = u.source_id
|
||||
INNER JOIN organization o on p.organization_id = o.id
|
||||
|
|
|
@ -13,6 +13,7 @@ import io.metersphere.sdk.invoker.ProjectServiceInvoker;
|
|||
import io.metersphere.sdk.log.constants.OperationLogModule;
|
||||
import io.metersphere.sdk.log.constants.OperationLogType;
|
||||
import io.metersphere.sdk.log.service.OperationLogService;
|
||||
import io.metersphere.sdk.util.BeanUtils;
|
||||
import io.metersphere.sdk.util.JSON;
|
||||
import io.metersphere.sdk.util.LogUtils;
|
||||
import io.metersphere.sdk.util.Translator;
|
||||
|
@ -58,12 +59,18 @@ public class CommonProjectService {
|
|||
this.serviceInvoker = serviceInvoker;
|
||||
}
|
||||
|
||||
public Project get(String id) {
|
||||
public ProjectExtendDTO get(String id) {
|
||||
Project project = projectMapper.selectByPrimaryKey(id);
|
||||
if (ObjectUtils.isNotEmpty(project) && StringUtils.isEmpty(project.getModuleSetting())) {
|
||||
project.setModuleSetting(JSON.toJSONString(new ModuleSettingDTO()));
|
||||
ProjectExtendDTO projectExtendDTO = new ProjectExtendDTO();
|
||||
if (ObjectUtils.isNotEmpty(project)) {
|
||||
BeanUtils.copyBean(projectExtendDTO, project);
|
||||
if (StringUtils.isNotEmpty(project.getModuleSetting())) {
|
||||
projectExtendDTO.setModuleIds(JSON.parseArray(project.getModuleSetting(), String.class));
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
return project;
|
||||
return projectExtendDTO;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -73,9 +80,10 @@ public class CommonProjectService {
|
|||
* @param module 日志记录模块
|
||||
* @return
|
||||
*/
|
||||
public Project add(AddProjectRequest addProjectDTO, String createUser, String path, String module) {
|
||||
public ProjectExtendDTO add(AddProjectRequest addProjectDTO, String createUser, String path, String module) {
|
||||
|
||||
Project project = new Project();
|
||||
ProjectExtendDTO projectExtendDTO = new ProjectExtendDTO();
|
||||
project.setId(UUID.randomUUID().toString());
|
||||
project.setName(addProjectDTO.getName());
|
||||
project.setOrganizationId(addProjectDTO.getOrganizationId());
|
||||
|
@ -87,12 +95,13 @@ public class CommonProjectService {
|
|||
project.setEnable(addProjectDTO.getEnable());
|
||||
project.setDescription(addProjectDTO.getDescription());
|
||||
addProjectDTO.setId(project.getId());
|
||||
BeanUtils.copyBean(projectExtendDTO, project);
|
||||
|
||||
//判断是否有模块设置
|
||||
if (StringUtils.isEmpty(addProjectDTO.getModuleSetting())) {
|
||||
addProjectDTO.setModuleSetting(JSON.toJSONString(new ModuleSettingDTO()));
|
||||
if (CollectionUtils.isNotEmpty(addProjectDTO.getModuleIds())) {
|
||||
project.setModuleSetting(JSON.toJSONString(addProjectDTO.getModuleIds()));
|
||||
projectExtendDTO.setModuleIds(addProjectDTO.getModuleIds());
|
||||
}
|
||||
project.setModuleSetting(addProjectDTO.getModuleSetting());
|
||||
|
||||
ProjectAddMemberBatchRequest memberRequest = new ProjectAddMemberBatchRequest();
|
||||
memberRequest.setProjectIds(List.of(project.getId()));
|
||||
|
@ -105,7 +114,7 @@ public class CommonProjectService {
|
|||
//添加项目管理员 创建的时候如果没有传管理员id 则默认创建者为管理员
|
||||
this.addProjectAdmin(memberRequest, createUser, path,
|
||||
OperationLogType.ADD.name(), Translator.get("add"), module);
|
||||
return project;
|
||||
return projectExtendDTO;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -146,7 +155,7 @@ public class CommonProjectService {
|
|||
|
||||
private void checkProjectExistByName(Project project) {
|
||||
ProjectExample example = new ProjectExample();
|
||||
example.createCriteria().andNameEqualTo(project.getName()).andOrganizationIdEqualTo(project.getOrganizationId());
|
||||
example.createCriteria().andNameEqualTo(project.getName()).andOrganizationIdEqualTo(project.getOrganizationId()).andIdNotEqualTo(project.getId());
|
||||
if (projectMapper.selectByExample(example).size() > 0) {
|
||||
throw new MSException(Translator.get("project_name_already_exists"));
|
||||
}
|
||||
|
@ -165,6 +174,9 @@ public class CommonProjectService {
|
|||
|
||||
public List<ProjectDTO> buildUserInfo(List<ProjectDTO> projectList) {
|
||||
projectList.forEach(projectDTO -> {
|
||||
if (StringUtils.isNotBlank(projectDTO.getModuleSetting())) {
|
||||
projectDTO.setModuleIds(JSON.parseArray(projectDTO.getModuleSetting(), String.class));
|
||||
}
|
||||
List<User> users = extSystemProjectMapper.getProjectAdminList(projectDTO.getId());
|
||||
projectDTO.setAdminList(users);
|
||||
List<String> userIds = users.stream().map(User::getId).collect(Collectors.toList());
|
||||
|
@ -176,8 +188,9 @@ public class CommonProjectService {
|
|||
return projectList;
|
||||
}
|
||||
|
||||
public Project update(UpdateProjectRequest updateProjectDto, String updateUser, String path, String module) {
|
||||
public ProjectExtendDTO update(UpdateProjectRequest updateProjectDto, String updateUser, String path, String module) {
|
||||
Project project = new Project();
|
||||
ProjectExtendDTO projectExtendDTO = new ProjectExtendDTO();
|
||||
project.setId(updateProjectDto.getId());
|
||||
project.setName(updateProjectDto.getName());
|
||||
project.setDescription(updateProjectDto.getDescription());
|
||||
|
@ -189,6 +202,7 @@ public class CommonProjectService {
|
|||
project.setUpdateTime(System.currentTimeMillis());
|
||||
checkProjectExistByName(project);
|
||||
checkProjectNotExist(project.getId());
|
||||
BeanUtils.copyBean(projectExtendDTO, project);
|
||||
UserRoleRelationExample example = new UserRoleRelationExample();
|
||||
example.createCriteria().andSourceIdEqualTo(project.getId()).andRoleIdEqualTo(InternalUserRole.PROJECT_ADMIN.getValue());
|
||||
List<UserRoleRelation> userRoleRelations = userRoleRelationMapper.selectByExample(example);
|
||||
|
@ -237,13 +251,13 @@ public class CommonProjectService {
|
|||
operationLogService.batchAdd(logDTOList);
|
||||
}
|
||||
//判断是否有模块设置
|
||||
if (StringUtils.isEmpty(updateProjectDto.getModuleSetting())) {
|
||||
updateProjectDto.setModuleSetting(JSON.toJSONString(new ModuleSettingDTO()));
|
||||
if (CollectionUtils.isNotEmpty(updateProjectDto.getModuleIds())) {
|
||||
project.setModuleSetting(JSON.toJSONString(updateProjectDto.getModuleIds()));
|
||||
projectExtendDTO.setModuleIds(updateProjectDto.getModuleIds());
|
||||
}
|
||||
project.setModuleSetting(updateProjectDto.getModuleSetting());
|
||||
|
||||
projectMapper.updateByPrimaryKeySelective(project);
|
||||
return project;
|
||||
return projectExtendDTO;
|
||||
}
|
||||
|
||||
public int delete(String id, String deleteUser) {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package io.metersphere.system.service;
|
||||
|
||||
import io.metersphere.project.domain.Project;
|
||||
import io.metersphere.sdk.dto.AddProjectRequest;
|
||||
import io.metersphere.sdk.dto.ProjectDTO;
|
||||
import io.metersphere.sdk.dto.ProjectExtendDTO;
|
||||
import io.metersphere.sdk.dto.UpdateProjectRequest;
|
||||
import io.metersphere.sdk.log.constants.OperationLogModule;
|
||||
import io.metersphere.sdk.log.constants.OperationLogType;
|
||||
|
@ -37,7 +37,7 @@ public class OrganizationProjectService {
|
|||
private final static String REMOVE_PROJECT_MEMBER = PREFIX + "/remove-member/";
|
||||
private final static String ADD_MEMBER = PREFIX + "/add-member";
|
||||
|
||||
public Project get(String id) {
|
||||
public ProjectExtendDTO get(String id) {
|
||||
return commonProjectService.get(id);
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ public class OrganizationProjectService {
|
|||
* @param addProjectDTO 添加项目的时候 默认给用户组添加管理员的权限
|
||||
* @return
|
||||
*/
|
||||
public Project add(AddProjectRequest addProjectDTO, String createUser) {
|
||||
public ProjectExtendDTO add(AddProjectRequest addProjectDTO, String createUser) {
|
||||
return commonProjectService.add(addProjectDTO, createUser, ADD_PROJECT, OperationLogModule.ORGANIZATION_PROJECT);
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ public class OrganizationProjectService {
|
|||
return commonProjectService.buildUserInfo(projectList);
|
||||
}
|
||||
|
||||
public Project update(UpdateProjectRequest updateProjectDto, String updateUser) {
|
||||
public ProjectExtendDTO update(UpdateProjectRequest updateProjectDto, String updateUser) {
|
||||
return commonProjectService.update(updateProjectDto, updateUser, UPDATE_PROJECT, OperationLogModule.ORGANIZATION_PROJECT);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ package io.metersphere.system.service;
|
|||
import io.metersphere.project.domain.Project;
|
||||
import io.metersphere.sdk.dto.AddProjectRequest;
|
||||
import io.metersphere.sdk.dto.ProjectDTO;
|
||||
import io.metersphere.sdk.dto.ProjectExtendDTO;
|
||||
import io.metersphere.sdk.dto.UpdateProjectRequest;
|
||||
import io.metersphere.sdk.log.constants.OperationLogModule;
|
||||
import io.metersphere.sdk.log.constants.OperationLogType;
|
||||
|
@ -35,7 +36,7 @@ public class SystemProjectService {
|
|||
private final static String REMOVE_PROJECT_MEMBER = PREFIX + "/remove-member/";
|
||||
private final static String ADD_MEMBER = PREFIX + "/add-member";
|
||||
|
||||
public Project get(String id) {
|
||||
public ProjectExtendDTO get(String id) {
|
||||
return commonProjectService.get(id);
|
||||
}
|
||||
|
||||
|
@ -43,7 +44,7 @@ public class SystemProjectService {
|
|||
* @param addProjectDTO 添加项目的时候 默认给用户组添加管理员的权限
|
||||
* @return
|
||||
*/
|
||||
public Project add(AddProjectRequest addProjectDTO, String createUser) {
|
||||
public ProjectExtendDTO add(AddProjectRequest addProjectDTO, String createUser) {
|
||||
return commonProjectService.add(addProjectDTO, createUser, ADD_PROJECT, OperationLogModule.SYSTEM_PROJECT);
|
||||
}
|
||||
|
||||
|
@ -52,7 +53,7 @@ public class SystemProjectService {
|
|||
return commonProjectService.buildUserInfo(projectList);
|
||||
}
|
||||
|
||||
public Project update(UpdateProjectRequest updateProjectDto, String updateUser) {
|
||||
public ProjectExtendDTO update(UpdateProjectRequest updateProjectDto, String updateUser) {
|
||||
return commonProjectService.update(updateProjectDto, updateUser, UPDATE_PROJECT, OperationLogModule.SYSTEM_PROJECT);
|
||||
}
|
||||
|
||||
|
|
|
@ -8,10 +8,7 @@ import io.metersphere.sdk.constants.InternalUserRole;
|
|||
import io.metersphere.sdk.constants.PermissionConstants;
|
||||
import io.metersphere.sdk.constants.SessionConstants;
|
||||
import io.metersphere.sdk.controller.handler.ResultHolder;
|
||||
import io.metersphere.sdk.dto.AddProjectRequest;
|
||||
import io.metersphere.sdk.dto.ModuleSettingDTO;
|
||||
import io.metersphere.sdk.dto.ProjectDTO;
|
||||
import io.metersphere.sdk.dto.UpdateProjectRequest;
|
||||
import io.metersphere.sdk.dto.*;
|
||||
import io.metersphere.sdk.log.constants.OperationLogType;
|
||||
import io.metersphere.sdk.util.JSON;
|
||||
import io.metersphere.sdk.util.Pager;
|
||||
|
@ -25,6 +22,7 @@ import io.metersphere.system.request.ProjectAddMemberRequest;
|
|||
import io.metersphere.system.request.ProjectMemberRequest;
|
||||
import io.metersphere.system.service.OrganizationService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.junit.jupiter.api.*;
|
||||
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
||||
|
@ -181,7 +179,7 @@ public class OrganizationProjectControllerTests extends BaseTest {
|
|||
public void testAddProjectSuccess() throws Exception {
|
||||
AddProjectRequest project = this.generatorAdd("organizationId","organization-name", "description", true, List.of("admin"));
|
||||
MvcResult mvcResult = this.responsePost(addProject, project);
|
||||
Project result = parseObjectFromMvcResult(mvcResult, Project.class);
|
||||
ProjectExtendDTO result = parseObjectFromMvcResult(mvcResult, ProjectExtendDTO.class);
|
||||
ProjectExample projectExample = new ProjectExample();
|
||||
projectExample.createCriteria().andOrganizationIdEqualTo(project.getOrganizationId()).andNameEqualTo(project.getName());
|
||||
List<Project> projects = projectMapper.selectByExample(projectExample);
|
||||
|
@ -200,14 +198,14 @@ public class OrganizationProjectControllerTests extends BaseTest {
|
|||
Assertions.assertTrue(userRoleRelations.stream().map(UserRoleRelation::getUserId).toList().contains("admin"));
|
||||
projectId = result.getId();
|
||||
Project projectExtend = projectMapper.selectByPrimaryKey(projectId);
|
||||
Assertions.assertEquals(projectExtend.getModuleSetting(), JSON.toJSONString(new ModuleSettingDTO()));
|
||||
Assertions.assertNull(projectExtend.getModuleSetting());
|
||||
// 校验日志
|
||||
checkLog(projectId, OperationLogType.ADD);
|
||||
|
||||
//userId为空的时候
|
||||
project = this.generatorAdd("organizationId","organization-userIdIsNull", "description", true, new ArrayList<>());
|
||||
mvcResult = this.responsePost(addProject, project);
|
||||
result = parseObjectFromMvcResult(mvcResult, Project.class);
|
||||
result = parseObjectFromMvcResult(mvcResult, ProjectExtendDTO.class);
|
||||
projectExample = new ProjectExample();
|
||||
projectExample.createCriteria().andOrganizationIdEqualTo(project.getOrganizationId()).andNameEqualTo(project.getName());
|
||||
projects = projectMapper.selectByExample(projectExample);
|
||||
|
@ -225,16 +223,16 @@ public class OrganizationProjectControllerTests extends BaseTest {
|
|||
userRoleRelations = userRoleRelationMapper.selectByExample(userRoleRelationExample);
|
||||
Assertions.assertTrue(userRoleRelations.stream().map(UserRoleRelation::getUserId).toList().contains("admin"));
|
||||
projectExtend = projectMapper.selectByPrimaryKey(projectId);
|
||||
Assertions.assertEquals(projectExtend.getModuleSetting(), JSON.toJSONString(new ModuleSettingDTO()));
|
||||
Assertions.assertNull(projectExtend.getModuleSetting());
|
||||
|
||||
//设置了模块模版
|
||||
ModuleSettingDTO moduleSettingDTO = new ModuleSettingDTO();
|
||||
moduleSettingDTO.setApiTest(true);
|
||||
moduleSettingDTO.setLoadTest(true);
|
||||
project.setModuleSetting(JSON.toJSONString(moduleSettingDTO));
|
||||
List<String> moduleIds = new ArrayList<>();
|
||||
moduleIds.add("apiTest");
|
||||
moduleIds.add("loadTest");
|
||||
project.setModuleIds(moduleIds);
|
||||
project.setName("org-moduleSetting");
|
||||
mvcResult = this.responsePost(addProject, project);
|
||||
result = parseObjectFromMvcResult(mvcResult, Project.class);
|
||||
result = parseObjectFromMvcResult(mvcResult, ProjectExtendDTO.class);
|
||||
projectExample = new ProjectExample();
|
||||
projectExample.createCriteria().andOrganizationIdEqualTo(project.getOrganizationId()).andNameEqualTo(project.getName());
|
||||
projects = projectMapper.selectByExample(projectExample);
|
||||
|
@ -252,7 +250,7 @@ public class OrganizationProjectControllerTests extends BaseTest {
|
|||
userRoleRelations = userRoleRelationMapper.selectByExample(userRoleRelationExample);
|
||||
Assertions.assertTrue(userRoleRelations.stream().map(UserRoleRelation::getUserId).toList().contains("admin"));
|
||||
projectExtend = projectMapper.selectByPrimaryKey(projectId);
|
||||
Assertions.assertEquals(projectExtend.getModuleSetting(), JSON.toJSONString(moduleSettingDTO));
|
||||
Assertions.assertEquals(projectExtend.getModuleSetting(), JSON.toJSONString(moduleIds));
|
||||
|
||||
project.setName("organization-testAddProjectSuccess1");
|
||||
project.setOrganizationId(getDefault().getId());
|
||||
|
@ -287,16 +285,16 @@ public class OrganizationProjectControllerTests extends BaseTest {
|
|||
public void testGetProject() throws Exception {
|
||||
AddProjectRequest project = this.generatorAdd("organizationId","organization-getName", "description", true, List.of("admin"));
|
||||
MvcResult mvcResult = this.responsePost(addProject, project);
|
||||
Project result = parseObjectFromMvcResult(mvcResult, Project.class);
|
||||
ProjectExtendDTO result = parseObjectFromMvcResult(mvcResult, ProjectExtendDTO.class);
|
||||
assert result != null;
|
||||
projectId = result.getId();
|
||||
mvcResult = this.responseGet(getProject + projectId);
|
||||
Project getProjects = parseObjectFromMvcResult(mvcResult, Project.class);
|
||||
Project getProjects = parseObjectFromMvcResult(mvcResult, ProjectExtendDTO.class);
|
||||
Assertions.assertTrue(StringUtils.equals(getProjects.getId(), projectId));
|
||||
|
||||
|
||||
mvcResult = this.responseGet(getProject + "projectId1");
|
||||
getProjects = parseObjectFromMvcResult(mvcResult, Project.class);
|
||||
getProjects = parseObjectFromMvcResult(mvcResult, ProjectExtendDTO.class);
|
||||
assert getProjects != null;
|
||||
Assertions.assertTrue(StringUtils.equals(getProjects.getId(), "projectId1"));
|
||||
// @@校验权限
|
||||
|
@ -305,9 +303,10 @@ public class OrganizationProjectControllerTests extends BaseTest {
|
|||
@Test
|
||||
@Order(4)
|
||||
public void testGetProjectError() throws Exception {
|
||||
//项目不存在
|
||||
//项目不存在
|
||||
MvcResult mvcResult = this.responseGet(getProject + "111111");
|
||||
Project project = parseObjectFromMvcResult(mvcResult, Project.class);
|
||||
ProjectExtendDTO project = parseObjectFromMvcResult(mvcResult, ProjectExtendDTO.class);
|
||||
Assertions.assertNull(project);
|
||||
}
|
||||
|
||||
|
@ -393,13 +392,13 @@ public class OrganizationProjectControllerTests extends BaseTest {
|
|||
public void testUpdateProject() throws Exception {
|
||||
UpdateProjectRequest project = this.generatorUpdate("organizationId", projectId,"organization-TestName", "Edit name", true, List.of("admin1"));
|
||||
Project projectExtend = projectMapper.selectByPrimaryKey(projectId);
|
||||
ModuleSettingDTO moduleSettingDTO = JSON.parseObject(projectExtend.getModuleSetting(), ModuleSettingDTO.class);
|
||||
moduleSettingDTO.setApiTest(true);
|
||||
moduleSettingDTO.setTestPlan(true);
|
||||
moduleSettingDTO.setUiTest(true);
|
||||
project.setModuleSetting(JSON.toJSONString(moduleSettingDTO));
|
||||
List<String> moduleIds = new ArrayList<>();
|
||||
if (StringUtils.isNotBlank(projectExtend.getModuleSetting())) {
|
||||
moduleIds = JSON.parseArray(projectExtend.getModuleSetting(), String.class);
|
||||
}
|
||||
project.setModuleIds(moduleIds);
|
||||
MvcResult mvcResult = this.responsePost(updateProject, project);
|
||||
Project result = parseObjectFromMvcResult(mvcResult, Project.class);
|
||||
ProjectExtendDTO result = parseObjectFromMvcResult(mvcResult, ProjectExtendDTO.class);
|
||||
Project currentProject = projectMapper.selectByPrimaryKey(project.getId());
|
||||
compareProjectDTO(currentProject, result);
|
||||
UserRoleRelationExample userRoleRelationExample = new UserRoleRelationExample();
|
||||
|
@ -411,14 +410,14 @@ public class OrganizationProjectControllerTests extends BaseTest {
|
|||
Assertions.assertTrue(userRoleRelations.stream().map(UserRoleRelation::getUserId).toList().contains("admin1"));
|
||||
//断言模块设置
|
||||
projectExtend = projectMapper.selectByPrimaryKey(projectId);
|
||||
Assertions.assertEquals(projectExtend.getModuleSetting(), JSON.toJSONString(moduleSettingDTO));
|
||||
Assertions.assertEquals(projectExtend.getModuleSetting(), CollectionUtils.isEmpty(project.getModuleIds()) ? null : JSON.toJSONString(project.getModuleIds()));
|
||||
|
||||
// 校验日志
|
||||
checkLog(projectId, OperationLogType.ADD);
|
||||
//用户id为空
|
||||
project = this.generatorUpdate("organizationId", "projectId2", "organization-TestNameUserIdIsNull", "Edit name", true, new ArrayList<>());
|
||||
mvcResult = this.responsePost(updateProject, project);
|
||||
result = parseObjectFromMvcResult(mvcResult, Project.class);
|
||||
result = parseObjectFromMvcResult(mvcResult, ProjectExtendDTO.class);
|
||||
currentProject = projectMapper.selectByPrimaryKey(project.getId());
|
||||
compareProjectDTO(currentProject, result);
|
||||
userRoleRelationExample = new UserRoleRelationExample();
|
||||
|
@ -428,19 +427,16 @@ public class OrganizationProjectControllerTests extends BaseTest {
|
|||
Assertions.assertTrue(userRoleRelations.isEmpty());
|
||||
//断言模块设置
|
||||
projectExtend = projectMapper.selectByPrimaryKey("projectId2");
|
||||
Assertions.assertEquals(projectExtend.getModuleSetting(), JSON.toJSONString(new ModuleSettingDTO()));
|
||||
Assertions.assertEquals(projectExtend.getModuleSetting(), CollectionUtils.isEmpty(project.getModuleIds()) ? null : JSON.toJSONString(project.getModuleIds()));
|
||||
|
||||
// 修改模块设置
|
||||
project = this.generatorUpdate("organizationId", "projectId2", "org-Module", "Edit name", true, new ArrayList<>());
|
||||
projectExtend = projectMapper.selectByPrimaryKey("projectId2");
|
||||
moduleSettingDTO = JSON.parseObject(projectExtend.getModuleSetting(), ModuleSettingDTO.class);
|
||||
moduleSettingDTO.setApiTest(true);
|
||||
moduleSettingDTO.setTestPlan(true);
|
||||
moduleSettingDTO.setUiTest(true);
|
||||
moduleSettingDTO.setWorkstation(true);
|
||||
project.setModuleSetting(JSON.toJSONString(moduleSettingDTO));
|
||||
moduleIds = new ArrayList<>();
|
||||
moduleIds.add("apiTest");
|
||||
moduleIds.add("uiTest");
|
||||
project.setModuleIds(moduleIds);
|
||||
mvcResult = this.responsePost(updateProject, project);
|
||||
result = parseObjectFromMvcResult(mvcResult, Project.class);
|
||||
result = parseObjectFromMvcResult(mvcResult, ProjectExtendDTO.class);
|
||||
currentProject = projectMapper.selectByPrimaryKey(project.getId());
|
||||
compareProjectDTO(currentProject, result);
|
||||
userRoleRelationExample = new UserRoleRelationExample();
|
||||
|
@ -450,7 +446,7 @@ public class OrganizationProjectControllerTests extends BaseTest {
|
|||
Assertions.assertTrue(userRoleRelations.isEmpty());
|
||||
//断言模块设置
|
||||
projectExtend = projectMapper.selectByPrimaryKey("projectId2");
|
||||
Assertions.assertEquals(projectExtend.getModuleSetting(), JSON.toJSONString(moduleSettingDTO));
|
||||
Assertions.assertEquals(projectExtend.getModuleSetting(), JSON.toJSONString(moduleIds));
|
||||
// @@校验权限
|
||||
project.setName("organization-TestName2");
|
||||
project.setId("projectId1");
|
||||
|
@ -464,7 +460,7 @@ public class OrganizationProjectControllerTests extends BaseTest {
|
|||
@Order(8)
|
||||
public void testUpdateProjectError() throws Exception {
|
||||
//项目名称存在 500
|
||||
UpdateProjectRequest project = this.generatorUpdate(getDefault().getId(), "projectId1","organization-TestName2", "description", true, List.of("admin"));
|
||||
UpdateProjectRequest project = this.generatorUpdate("organizationId", "projectId1","org-Module", "description", true, List.of("admin"));
|
||||
this.requestPost(updateProject, project, ERROR_REQUEST_MATCHER);
|
||||
//参数组织Id为空
|
||||
project = this.generatorUpdate(null, "projectId",null, null, true , List.of("admin"));
|
||||
|
|
|
@ -8,10 +8,7 @@ import io.metersphere.sdk.constants.InternalUserRole;
|
|||
import io.metersphere.sdk.constants.PermissionConstants;
|
||||
import io.metersphere.sdk.constants.SessionConstants;
|
||||
import io.metersphere.sdk.controller.handler.ResultHolder;
|
||||
import io.metersphere.sdk.dto.AddProjectRequest;
|
||||
import io.metersphere.sdk.dto.ModuleSettingDTO;
|
||||
import io.metersphere.sdk.dto.ProjectDTO;
|
||||
import io.metersphere.sdk.dto.UpdateProjectRequest;
|
||||
import io.metersphere.sdk.dto.*;
|
||||
import io.metersphere.sdk.log.constants.OperationLogType;
|
||||
import io.metersphere.sdk.util.JSON;
|
||||
import io.metersphere.sdk.util.Pager;
|
||||
|
@ -173,7 +170,7 @@ public class SystemProjectControllerTests extends BaseTest {
|
|||
public void testAddProjectSuccess() throws Exception {
|
||||
AddProjectRequest project = this.generatorAdd("organizationId","name", "description", true, List.of("admin"));
|
||||
MvcResult mvcResult = this.responsePost(addProject, project);
|
||||
Project result = parseObjectFromMvcResult(mvcResult, Project.class);
|
||||
ProjectExtendDTO result = parseObjectFromMvcResult(mvcResult, ProjectExtendDTO.class);
|
||||
ProjectExample projectExample = new ProjectExample();
|
||||
projectExample.createCriteria().andOrganizationIdEqualTo(project.getOrganizationId()).andNameEqualTo(project.getName());
|
||||
List<Project> projects = projectMapper.selectByExample(projectExample);
|
||||
|
@ -191,12 +188,12 @@ public class SystemProjectControllerTests extends BaseTest {
|
|||
userRoleRelations = userRoleRelationMapper.selectByExample(userRoleRelationExample);
|
||||
Assertions.assertTrue(userRoleRelations.stream().map(UserRoleRelation::getUserId).toList().contains("admin"));
|
||||
Project currentProject = projectMapper.selectByPrimaryKey(projectId);
|
||||
Assertions.assertEquals(currentProject.getModuleSetting(), JSON.toJSONString(new ModuleSettingDTO()));
|
||||
Assertions.assertNull(currentProject.getModuleSetting());
|
||||
|
||||
//userId为空的时候
|
||||
project = this.generatorAdd("organizationId","userIdIsNull", "description", true, new ArrayList<>());
|
||||
mvcResult = this.responsePost(addProject, project);
|
||||
result = parseObjectFromMvcResult(mvcResult, Project.class);
|
||||
result = parseObjectFromMvcResult(mvcResult, ProjectExtendDTO.class);
|
||||
projectExample = new ProjectExample();
|
||||
projectExample.createCriteria().andOrganizationIdEqualTo(project.getOrganizationId()).andNameEqualTo(project.getName());
|
||||
projects = projectMapper.selectByExample(projectExample);
|
||||
|
@ -214,16 +211,16 @@ public class SystemProjectControllerTests extends BaseTest {
|
|||
userRoleRelations = userRoleRelationMapper.selectByExample(userRoleRelationExample);
|
||||
Assertions.assertTrue(userRoleRelations.stream().map(UserRoleRelation::getUserId).toList().contains("admin"));
|
||||
currentProject = projectMapper.selectByPrimaryKey(projectId);
|
||||
Assertions.assertEquals(currentProject.getModuleSetting(), JSON.toJSONString(new ModuleSettingDTO()));
|
||||
Assertions.assertNull(currentProject.getModuleSetting());
|
||||
|
||||
//设置了模块模版
|
||||
ModuleSettingDTO moduleSettingDTO = new ModuleSettingDTO();
|
||||
moduleSettingDTO.setApiTest(true);
|
||||
moduleSettingDTO.setLoadTest(true);
|
||||
project.setModuleSetting(JSON.toJSONString(moduleSettingDTO));
|
||||
List<String> moduleIds = new ArrayList<>();
|
||||
moduleIds.add("apiTest");
|
||||
moduleIds.add("uiTest");
|
||||
project.setModuleIds(moduleIds);
|
||||
project.setName("moduleSetting");
|
||||
mvcResult = this.responsePost(addProject, project);
|
||||
result = parseObjectFromMvcResult(mvcResult, Project.class);
|
||||
result = parseObjectFromMvcResult(mvcResult, ProjectExtendDTO.class);
|
||||
projectExample = new ProjectExample();
|
||||
projectExample.createCriteria().andOrganizationIdEqualTo(project.getOrganizationId()).andNameEqualTo(project.getName());
|
||||
projects = projectMapper.selectByExample(projectExample);
|
||||
|
@ -241,7 +238,7 @@ public class SystemProjectControllerTests extends BaseTest {
|
|||
userRoleRelations = userRoleRelationMapper.selectByExample(userRoleRelationExample);
|
||||
Assertions.assertTrue(userRoleRelations.stream().map(UserRoleRelation::getUserId).toList().contains("admin"));
|
||||
currentProject = projectMapper.selectByPrimaryKey(projectId);
|
||||
Assertions.assertEquals(currentProject.getModuleSetting(), JSON.toJSONString(moduleSettingDTO));
|
||||
Assertions.assertEquals(currentProject.getModuleSetting(), JSON.toJSONString(moduleIds));
|
||||
|
||||
|
||||
project.setName("testAddProjectSuccess1");
|
||||
|
@ -275,19 +272,19 @@ public class SystemProjectControllerTests extends BaseTest {
|
|||
@Order(3)
|
||||
public void testGetProject() throws Exception {
|
||||
AddProjectRequest project = this.generatorAdd("organizationId","getName", "description", true, List.of("admin"));
|
||||
List<String> moduleIds = new ArrayList<>();
|
||||
moduleIds.add("apiTest");
|
||||
moduleIds.add("uiTest");
|
||||
project.setModuleIds(moduleIds);
|
||||
MvcResult mvcResult = this.responsePost(addProject, project);
|
||||
Project result = parseObjectFromMvcResult(mvcResult, Project.class);
|
||||
ProjectExtendDTO result = parseObjectFromMvcResult(mvcResult, ProjectExtendDTO.class);
|
||||
assert result != null;
|
||||
projectId = result.getId();
|
||||
mvcResult = this.responseGet(getProject + projectId);
|
||||
Project getProjects = parseObjectFromMvcResult(mvcResult, Project.class);
|
||||
Project getProjects = parseObjectFromMvcResult(mvcResult, ProjectExtendDTO.class);
|
||||
assert getProjects != null;
|
||||
Assertions.assertTrue(StringUtils.equals(getProjects.getId(), projectId));
|
||||
|
||||
|
||||
mvcResult = this.responseGet(getProject + "projectId1");
|
||||
getProjects = parseObjectFromMvcResult(mvcResult, Project.class);
|
||||
assert getProjects != null;
|
||||
Assertions.assertTrue(StringUtils.equals(getProjects.getId(), "projectId1"));
|
||||
// @@校验权限
|
||||
requestGetPermissionTest(PermissionConstants.SYSTEM_ORGANIZATION_PROJECT_READ, getProject + projectId);
|
||||
}
|
||||
|
@ -296,7 +293,7 @@ public class SystemProjectControllerTests extends BaseTest {
|
|||
public void testGetProjectError() throws Exception {
|
||||
//项目不存在
|
||||
MvcResult mvcResult = this.responseGet(getProject + "111111");
|
||||
Project project = parseObjectFromMvcResult(mvcResult, Project.class);
|
||||
ProjectExtendDTO project = parseObjectFromMvcResult(mvcResult, ProjectExtendDTO.class);
|
||||
Assertions.assertNull(project);
|
||||
}
|
||||
|
||||
|
@ -372,7 +369,7 @@ public class SystemProjectControllerTests extends BaseTest {
|
|||
public void testUpdateProject() throws Exception {
|
||||
UpdateProjectRequest project = this.generatorUpdate("organizationId", "projectId1","TestName", "Edit name", true, List.of("admin", "admin1"));
|
||||
MvcResult mvcResult = this.responsePost(updateProject, project);
|
||||
Project result = parseObjectFromMvcResult(mvcResult, Project.class);
|
||||
ProjectExtendDTO result = parseObjectFromMvcResult(mvcResult, ProjectExtendDTO.class);
|
||||
Project currentProject = projectMapper.selectByPrimaryKey(project.getId());
|
||||
compareProjectDTO(currentProject, result);
|
||||
UserRoleRelationExample userRoleRelationExample = new UserRoleRelationExample();
|
||||
|
@ -386,9 +383,9 @@ public class SystemProjectControllerTests extends BaseTest {
|
|||
//用户id为空
|
||||
project = this.generatorUpdate("organizationId", "projectId1", "TestNameUserIdIsNull", "Edit name", true, new ArrayList<>());
|
||||
Project projectExtend = projectMapper.selectByPrimaryKey("projectId1");
|
||||
project.setModuleSetting(projectExtend.getModuleSetting());
|
||||
projectExtend.setModuleSetting(null);
|
||||
mvcResult = this.responsePost(updateProject, project);
|
||||
result = parseObjectFromMvcResult(mvcResult, Project.class);
|
||||
result = parseObjectFromMvcResult(mvcResult, ProjectExtendDTO.class);
|
||||
currentProject = projectMapper.selectByPrimaryKey(project.getId());
|
||||
compareProjectDTO(currentProject, result);
|
||||
userRoleRelationExample = new UserRoleRelationExample();
|
||||
|
@ -399,14 +396,13 @@ public class SystemProjectControllerTests extends BaseTest {
|
|||
|
||||
// 修改模块设置
|
||||
project = this.generatorUpdate("organizationId", "projectId1", "Module", "Edit name", true, new ArrayList<>());
|
||||
ModuleSettingDTO moduleSettingDTO = JSON.parseObject(projectExtend.getModuleSetting(), ModuleSettingDTO.class);
|
||||
moduleSettingDTO.setApiTest(true);
|
||||
moduleSettingDTO.setTestPlan(true);
|
||||
moduleSettingDTO.setUiTest(true);
|
||||
moduleSettingDTO.setWorkstation(true);
|
||||
project.setModuleSetting(JSON.toJSONString(moduleSettingDTO));
|
||||
List<String> moduleIds = new ArrayList<>();
|
||||
moduleIds.add("apiTest");
|
||||
moduleIds.add("uiTest");
|
||||
moduleIds.add("loadTest");
|
||||
project.setModuleIds(moduleIds);
|
||||
mvcResult = this.responsePost(updateProject, project);
|
||||
result = parseObjectFromMvcResult(mvcResult, Project.class);
|
||||
result = parseObjectFromMvcResult(mvcResult, ProjectExtendDTO.class);
|
||||
currentProject = projectMapper.selectByPrimaryKey(project.getId());
|
||||
compareProjectDTO(currentProject, result);
|
||||
userRoleRelationExample = new UserRoleRelationExample();
|
||||
|
@ -416,7 +412,7 @@ public class SystemProjectControllerTests extends BaseTest {
|
|||
Assertions.assertTrue(userRoleRelations.isEmpty());
|
||||
//断言模块设置
|
||||
projectExtend = projectMapper.selectByPrimaryKey("projectId1");
|
||||
Assertions.assertEquals(projectExtend.getModuleSetting(), JSON.toJSONString(moduleSettingDTO));
|
||||
Assertions.assertEquals(projectExtend.getModuleSetting(), JSON.toJSONString(moduleIds));
|
||||
|
||||
|
||||
// @@校验权限
|
||||
|
@ -428,7 +424,7 @@ public class SystemProjectControllerTests extends BaseTest {
|
|||
@Order(8)
|
||||
public void testUpdateProjectError() throws Exception {
|
||||
//项目名称存在 500
|
||||
UpdateProjectRequest project = this.generatorUpdate("organizationId", "projectId1","TestName2", "description", true, List.of("admin"));
|
||||
UpdateProjectRequest project = this.generatorUpdate("organizationId", "projectId2","TestName2", "description", true, List.of("admin"));
|
||||
this.requestPost(updateProject, project, ERROR_REQUEST_MATCHER);
|
||||
//参数组织Id为空
|
||||
project = this.generatorUpdate(null, "projectId",null, null, true , List.of("admin"));
|
||||
|
|
|
@ -12,9 +12,9 @@ replace into user(id, name, email, password, create_time, update_time, language,
|
|||
VALUES ('admin2', 'test2', 'admin2@metersphere.io', MD5('admin2@metersphere.io'),
|
||||
UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000, NULL, NUll, '', 'LOCAL', NULL, 'admin', 'admin');
|
||||
|
||||
replace INTO project (id, num, organization_id, name, description, create_user, update_user, create_time, update_time) VALUES ('projectId', null, (SELECT id FROM organization WHERE name LIKE '默认组织'), '默认项目', '系统默认创建的项目', 'admin', 'admin', unix_timestamp() * 1000, unix_timestamp() * 1000);
|
||||
replace INTO project (id, num, organization_id, name, description, create_user, update_user, create_time, update_time,module_setting) VALUES ('projectId', null, (SELECT id FROM organization WHERE name LIKE '默认组织'), '默认项目', '系统默认创建的项目', 'admin', 'admin', unix_timestamp() * 1000, unix_timestamp() * 1000, '["apiTest","uiTest"]');
|
||||
replace INTO project (id, num, organization_id, name, description, create_user, update_user, create_time, update_time) VALUES ('projectId1', null, (SELECT id FROM organization WHERE name LIKE '默认组织'), '默认项目1', '系统默认创建的项目', 'admin', 'admin', unix_timestamp() * 1000, unix_timestamp() * 1000);
|
||||
replace INTO project (id, num, organization_id, name, description, create_user, update_user, create_time, update_time) VALUES ('projectId2', null, (SELECT id FROM organization WHERE name LIKE '默认组织'), '默认项目2', '系统默认创建的项目', 'admin', 'admin', unix_timestamp() * 1000, unix_timestamp() * 1000);
|
||||
replace INTO project (id, num, organization_id, name, description, create_user, update_user, create_time, update_time) VALUES ('projectId3', null, (SELECT id FROM organization WHERE name LIKE '默认组织'), '默认项目3', '系统默认创建的项目', 'admin', 'admin', unix_timestamp() * 1000, unix_timestamp() * 1000);
|
||||
replace INTO project (id, num, organization_id, name, description, create_user, update_user, create_time, update_time) VALUES ('projectId4', null, (SELECT id FROM organization WHERE name LIKE '默认组织'), '默认项目4', '系统默认创建的项目', 'admin', 'admin', unix_timestamp() * 1000, unix_timestamp() * 1000);
|
||||
replace INTO project (id, num, organization_id, name, description, create_user, update_user, create_time, update_time) VALUES ('projectId5', null, (SELECT id FROM organization WHERE name LIKE '默认组织'), '默认项目5', '系统默认创建的项目', 'test', 'test', unix_timestamp() * 1000, unix_timestamp() * 1000);
|
||||
replace INTO project (id, num, organization_id, name, description, create_user, update_user, create_time, update_time, module_setting) VALUES ('projectId3', null, (SELECT id FROM organization WHERE name LIKE '默认组织'), '默认项目3', '系统默认创建的项目', 'admin', 'admin', unix_timestamp() * 1000, unix_timestamp() * 1000,'["apiTest","uiTest"]');
|
||||
replace INTO project (id, num, organization_id, name, description, create_user, update_user, create_time, update_time,module_setting) VALUES ('projectId4', null, (SELECT id FROM organization WHERE name LIKE '默认组织'), '默认项目4', '系统默认创建的项目', 'admin', 'admin', unix_timestamp() * 1000, unix_timestamp() * 1000,'["apiTest","uiTest","loadTest"]');
|
||||
replace INTO project (id, num, organization_id, name, description, create_user, update_user, create_time, update_time,module_setting) VALUES ('projectId5', null, (SELECT id FROM organization WHERE name LIKE '默认组织'), '默认项目5', '系统默认创建的项目', 'test', 'test', unix_timestamp() * 1000, unix_timestamp() * 1000,'["apiTest","uiTest"]');
|
||||
|
|
|
@ -1,20 +1,22 @@
|
|||
# 插入测试数据
|
||||
replace INTO project (id, num, organization_id, name, description, create_user, update_user, create_time, update_time) VALUES ('projectId', null, (SELECT id FROM organization WHERE name LIKE '默认组织'), '默认项目', '系统默认创建的项目', 'admin', 'admin', unix_timestamp() * 1000, unix_timestamp() * 1000);
|
||||
replace INTO project (id, num, organization_id, name, description, create_user, update_user, create_time, update_time) VALUES ('projectId', null, (SELECT id FROM organization WHERE name LIKE '默认组织'), '默认项目', '系统默认创建的项目', 'admin', 'admin', unix_timestamp() * 1000, unix_timestamp() * 1000);
|
||||
replace INTO project (id, num, organization_id, name, description, create_user, update_user, create_time, update_time,module_setting) VALUES ('projectId', null, (SELECT id FROM organization WHERE name LIKE '默认组织'), '默认项目', '系统默认创建的项目', 'admin', 'admin', unix_timestamp() * 1000, unix_timestamp() * 1000, '["apiTest","uiTest"]');
|
||||
replace INTO project (id, num, organization_id, name, description, create_user, update_user, create_time, update_time,module_setting) VALUES ('projectId', null, (SELECT id FROM organization WHERE name LIKE '默认组织'), '默认项目', '系统默认创建的项目', 'admin', 'admin', unix_timestamp() * 1000, unix_timestamp() * 1000, '["apiTest","uiTest"]');
|
||||
replace INTO project (id, num, organization_id, name, description, create_user, update_user, create_time, update_time) VALUES ('projectId1', null, (SELECT id FROM organization WHERE name LIKE '默认组织'), '默认项目1', '系统默认创建的项目', 'admin', 'admin', unix_timestamp() * 1000, unix_timestamp() * 1000);
|
||||
replace INTO project (id, num, organization_id, name, description, create_user, update_user, create_time, update_time) VALUES ('projectId2', null, (SELECT id FROM organization WHERE name LIKE '默认组织'), '默认项目2', '系统默认创建的项目', 'admin', 'admin', unix_timestamp() * 1000, unix_timestamp() * 1000);
|
||||
replace INTO project (id, num, organization_id, name, description, create_user, update_user, create_time, update_time) VALUES ('projectId3', null, (SELECT id FROM organization WHERE name LIKE '默认组织'), '默认项目3', '系统默认创建的项目', 'admin', 'admin', unix_timestamp() * 1000, unix_timestamp() * 1000);
|
||||
replace INTO project (id, num, organization_id, name, description, create_user, update_user, create_time, update_time) VALUES ('projectId4', null, (SELECT id FROM organization WHERE name LIKE '默认组织'), '默认项目4', '系统默认创建的项目', 'admin', 'admin', unix_timestamp() * 1000, unix_timestamp() * 1000);
|
||||
replace INTO project (id, num, organization_id, name, description, create_user, update_user, create_time, update_time) VALUES ('projectId5', null, (SELECT id FROM organization WHERE name LIKE '默认组织'), '默认项目5', '系统默认创建的项目', 'test', 'test', unix_timestamp() * 1000, unix_timestamp() * 1000);
|
||||
|
||||
replace INTO project (id, num, organization_id, name, description, create_user, update_user, create_time, update_time, module_setting) VALUES ('projectId3', null, (SELECT id FROM organization WHERE name LIKE '默认组织'), '默认项目3', '系统默认创建的项目', 'admin', 'admin', unix_timestamp() * 1000, unix_timestamp() * 1000,'["apiTest","uiTest"]');
|
||||
replace INTO project (id, num, organization_id, name, description, create_user, update_user, create_time, update_time,module_setting) VALUES ('projectId4', null, (SELECT id FROM organization WHERE name LIKE '默认组织'), '默认项目4', '系统默认创建的项目', 'admin', 'admin', unix_timestamp() * 1000, unix_timestamp() * 1000,'["apiTest","uiTest","loadTest"]');
|
||||
replace INTO project (id, num, organization_id, name, description, create_user, update_user, create_time, update_time,module_setting) VALUES ('projectId5', null, (SELECT id FROM organization WHERE name LIKE '默认组织'), '默认项目5', '系统默认创建的项目', 'test', 'test', unix_timestamp() * 1000, unix_timestamp() * 1000,'["apiTest","uiTest"]');
|
||||
replace into user(id, name, email, password, create_time, update_time, language, last_organization_id, phone, source,
|
||||
last_project_id, create_user, update_user)
|
||||
VALUES ('admin1', 'test1', 'admin1@metersphere.io', MD5('admin1@metersphere.io'),
|
||||
UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000, NULL, NUll, '', 'LOCAL', 'projectId1', 'admin', 'admin');
|
||||
replace into user(id, name, email, password, create_time, update_time, language, last_organization_id, phone, source,
|
||||
replace
|
||||
into user(id, name, email, password, create_time, update_time, language, last_organization_id, phone, source,
|
||||
last_project_id, create_user, update_user)
|
||||
VALUES ('admin2', 'test2', 'admin2@metersphere.io', MD5('admin2@metersphere.io'),
|
||||
UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000, NULL, NUll, '', 'LOCAL', NULL, 'admin', 'admin');
|
||||
|
||||
replace INTO user_role_relation VALUES ('c3bb9b4f-46d8-4952-9681-8889974487w','admin1','project_admin','projectId1','1684747668375','1684747668375');
|
||||
replace INTO user_role_relation VALUES ('c3bb9b4f-46d8-4952-9681-8889974487q','admin2','project_admin','projectId1','1684747668321','1684747668336');
|
||||
replace
|
||||
INTO user_role_relation VALUES ('c3bb9b4f-46d8-4952-9681-8889974487w','admin1','project_admin','projectId1','1684747668375','1684747668375');
|
||||
replace
|
||||
INTO user_role_relation VALUES ('c3bb9b4f-46d8-4952-9681-8889974487q','admin2','project_admin','projectId1','1684747668321','1684747668336');
|
Loading…
Reference in New Issue