fix: 项目模板显示id问题
This commit is contained in:
parent
151fe95722
commit
8771f82029
|
@ -47,7 +47,7 @@ public class IssueTemplateService extends TemplateBaseService {
|
|||
@Resource
|
||||
ProjectService projectService;
|
||||
|
||||
public void add(UpdateIssueTemplateRequest request) {
|
||||
public String add(UpdateIssueTemplateRequest request) {
|
||||
checkExist(request);
|
||||
IssueTemplate template = new IssueTemplate();
|
||||
BeanUtils.copyBean(template, request);
|
||||
|
@ -63,6 +63,7 @@ public class IssueTemplateService extends TemplateBaseService {
|
|||
issueTemplateMapper.insert(template);
|
||||
customFieldTemplateService.create(request.getCustomFields(), template.getId(),
|
||||
TemplateConstants.FieldTemplateScene.ISSUE.name());
|
||||
return template.getId();
|
||||
}
|
||||
|
||||
public List<IssueTemplate> list(BaseQueryRequest request) {
|
||||
|
@ -78,8 +79,10 @@ public class IssueTemplateService extends TemplateBaseService {
|
|||
|
||||
public void update(UpdateIssueTemplateRequest request) {
|
||||
if (request.getGlobal() != null && request.getGlobal()) {
|
||||
String originId = request.getId();
|
||||
// 如果是全局字段,则创建对应工作空间字段
|
||||
add(request);
|
||||
String id = add(request);
|
||||
projectService.updateIssueTemplate(originId, id);
|
||||
} else {
|
||||
checkExist(request);
|
||||
customFieldTemplateService.deleteByTemplateId(request.getId());
|
||||
|
|
|
@ -151,6 +151,24 @@ public class ProjectService {
|
|||
userGroupMapper.deleteByExample(userGroupExample);
|
||||
}
|
||||
|
||||
public void updateIssueTemplate(String originId, String templateId) {
|
||||
Project project = new Project();
|
||||
project.setIssueTemplateId(templateId);
|
||||
ProjectExample example = new ProjectExample();
|
||||
example.createCriteria()
|
||||
.andIssueTemplateIdEqualTo(originId);
|
||||
projectMapper.updateByExampleSelective(project, example);
|
||||
}
|
||||
|
||||
public void updateCaseTemplate(String originId, String templateId) {
|
||||
Project project = new Project();
|
||||
project.setCaseTemplateId(templateId);
|
||||
ProjectExample example = new ProjectExample();
|
||||
example.createCriteria()
|
||||
.andCaseTemplateIdEqualTo(originId);
|
||||
projectMapper.updateByExampleSelective(project, example);
|
||||
}
|
||||
|
||||
private void deleteLoadTestResourcesByProjectId(String projectId) {
|
||||
LoadTestExample loadTestExample = new LoadTestExample();
|
||||
loadTestExample.createCriteria().andProjectIdEqualTo(projectId);
|
||||
|
|
|
@ -46,7 +46,7 @@ public class TestCaseTemplateService extends TemplateBaseService {
|
|||
@Resource
|
||||
ProjectService projectService;
|
||||
|
||||
public void add(UpdateCaseFieldTemplateRequest request) {
|
||||
public String add(UpdateCaseFieldTemplateRequest request) {
|
||||
checkExist(request);
|
||||
TestCaseTemplateWithBLOBs testCaseTemplate = new TestCaseTemplateWithBLOBs();
|
||||
BeanUtils.copyBean(testCaseTemplate, request);
|
||||
|
@ -62,6 +62,7 @@ public class TestCaseTemplateService extends TemplateBaseService {
|
|||
testCaseTemplateMapper.insert(testCaseTemplate);
|
||||
customFieldTemplateService.create(request.getCustomFields(), testCaseTemplate.getId(),
|
||||
TemplateConstants.FieldTemplateScene.TEST_CASE.name());
|
||||
return testCaseTemplate.getId();
|
||||
}
|
||||
|
||||
public List<TestCaseTemplateWithBLOBs> list(BaseQueryRequest request) {
|
||||
|
@ -77,8 +78,10 @@ public class TestCaseTemplateService extends TemplateBaseService {
|
|||
|
||||
public void update(UpdateCaseFieldTemplateRequest request) {
|
||||
if (request.getGlobal() != null && request.getGlobal()) {
|
||||
String originId = request.getId();
|
||||
// 如果是全局字段,则创建对应工作空间字段
|
||||
add(request);
|
||||
String id = add(request);
|
||||
projectService.updateCaseTemplate(originId, id);
|
||||
} else {
|
||||
checkExist(request);
|
||||
customFieldTemplateService.deleteByTemplateId(request.getId());
|
||||
|
|
|
@ -175,7 +175,7 @@ public abstract class AbstractIssuePlatform implements IssuesPlatform {
|
|||
|
||||
protected int getNextNum(String projectId) {
|
||||
Issues issue = extIssuesMapper.getNextNum(projectId);
|
||||
if (issue == null) {
|
||||
if (issue == null || issue.getNum() == null) {
|
||||
return 100001;
|
||||
} else {
|
||||
return Optional.of(issue.getNum() + 1).orElse(100001);
|
||||
|
|
Loading…
Reference in New Issue