fix: --bug=1007573 --user=陈建星 【系统设置】在其他空间中自定义的字段会在其他空间的测试用例模版中展现 https://www.tapd.cn/55049933/s/1063447
This commit is contained in:
parent
6d92c632b7
commit
73957bbab9
|
@ -5,7 +5,6 @@ import com.github.pagehelper.PageHelper;
|
|||
import io.metersphere.api.service.ApiTestEnvironmentService;
|
||||
import io.metersphere.base.domain.FileMetadata;
|
||||
import io.metersphere.base.domain.Project;
|
||||
import io.metersphere.base.domain.UserGroup;
|
||||
import io.metersphere.commons.constants.OperLogConstants;
|
||||
import io.metersphere.commons.utils.PageUtils;
|
||||
import io.metersphere.commons.utils.Pager;
|
||||
|
@ -17,16 +16,13 @@ import io.metersphere.dto.WorkspaceMemberDTO;
|
|||
import io.metersphere.log.annotation.MsAuditLog;
|
||||
import io.metersphere.service.CheckPermissionService;
|
||||
import io.metersphere.service.ProjectService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "/project")
|
||||
|
|
|
@ -82,7 +82,7 @@ public class IssueTemplateService extends TemplateBaseService {
|
|||
String originId = request.getId();
|
||||
// 如果是全局字段,则创建对应工作空间字段
|
||||
String id = add(request);
|
||||
projectService.updateIssueTemplate(originId, id);
|
||||
projectService.updateIssueTemplate(originId, id, request.getWorkspaceId());
|
||||
} else {
|
||||
checkExist(request);
|
||||
customFieldTemplateService.deleteByTemplateId(request.getId());
|
||||
|
|
|
@ -214,21 +214,30 @@ public class ProjectService {
|
|||
userGroupMapper.deleteByExample(userGroupExample);
|
||||
}
|
||||
|
||||
public void updateIssueTemplate(String originId, String templateId) {
|
||||
public void updateIssueTemplate(String originId, String templateId, String workspaceId) {
|
||||
Project project = new Project();
|
||||
project.setIssueTemplateId(templateId);
|
||||
ProjectExample example = new ProjectExample();
|
||||
example.createCriteria()
|
||||
.andIssueTemplateIdEqualTo(originId);
|
||||
.andIssueTemplateIdEqualTo(originId)
|
||||
.andWorkspaceIdEqualTo(workspaceId);
|
||||
projectMapper.updateByExampleSelective(project, example);
|
||||
}
|
||||
|
||||
public void updateCaseTemplate(String originId, String templateId) {
|
||||
/**
|
||||
* 把原来为系统模板的项目模板设置成新的模板
|
||||
* 只设置改工作空间下的
|
||||
* @param originId
|
||||
* @param templateId
|
||||
* @param workspaceId
|
||||
*/
|
||||
public void updateCaseTemplate(String originId, String templateId, String workspaceId) {
|
||||
Project project = new Project();
|
||||
project.setCaseTemplateId(templateId);
|
||||
ProjectExample example = new ProjectExample();
|
||||
example.createCriteria()
|
||||
.andCaseTemplateIdEqualTo(originId);
|
||||
.andCaseTemplateIdEqualTo(originId)
|
||||
.andWorkspaceIdEqualTo(workspaceId);
|
||||
projectMapper.updateByExampleSelective(project, example);
|
||||
}
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ public class TestCaseTemplateService extends TemplateBaseService {
|
|||
String originId = request.getId();
|
||||
// 如果是全局字段,则创建对应工作空间字段
|
||||
String id = add(request);
|
||||
projectService.updateCaseTemplate(originId, id);
|
||||
projectService.updateCaseTemplate(originId, id, request.getWorkspaceId());
|
||||
} else {
|
||||
checkExist(request);
|
||||
customFieldTemplateService.deleteByTemplateId(request.getId());
|
||||
|
|
Loading…
Reference in New Issue