fix(测试跟踪): 默认项目用例模版,新增自定义字段未显示

--bug=1012082 --user=李玉号 【测试跟踪】-github#12441 默认项目用例模版/缺陷模版。新增自定义字段
未显示
https://www.tapd.cn/55049933/s/1132582

Closes #12441
This commit is contained in:
shiziyuan9527 2022-04-11 18:11:14 +08:00 committed by 刘瑞斌
parent bb2ece1d72
commit 46fda9c1a0
4 changed files with 24 additions and 7 deletions

View File

@ -39,4 +39,6 @@ public interface ExtProjectMapper {
void setDefaultMessageTask(@Param("projectId") String projectId);
List<ProjectDTO> queryListByIds(@Param("ids") List<String> ids);
void updateUseDefaultCaseTemplateProject(@Param("originId") String originId,@Param("templateId") String templateId,@Param("projectId") String projectId);
}

View File

@ -173,6 +173,11 @@
FROM project
WHERE workspace_id = #{workspaceId}) AS a)
</update>
<update id="updateUseDefaultCaseTemplateProject">
update project set case_template_id = #{templateId}
where (case_template_id = #{originId} or case_template_id is null or case_template_id = '')
and id = #{projectId}
</update>
<select id="selectProjectByResourceId" resultType="io.metersphere.base.domain.Project">
SELECT *

View File

@ -338,13 +338,7 @@ public class ProjectService {
* @param projectId
*/
public void updateCaseTemplate(String originId, String templateId, String projectId) {
Project project = new Project();
project.setCaseTemplateId(templateId);
ProjectExample example = new ProjectExample();
example.createCriteria()
.andCaseTemplateIdEqualTo(originId)
.andIdEqualTo(projectId);
projectMapper.updateByExampleSelective(project, example);
extProjectMapper.updateUseDefaultCaseTemplateProject(originId, templateId, projectId);
}
private void deleteLoadTestResourcesByProjectId(String projectId) {

View File

@ -1,2 +1,18 @@
ALTER TABLE test_plan_report
MODIFY name varchar(128) NULL COMMENT 'name';
update project set case_template_id = (
select id
from test_case_template
where `global` = 0
and `system` = 1
and project_id = project.id limit 1
) where case_template_id is null or case_template_id = '';
update project set case_template_id = (
select id
from test_case_template
where `global` = 1
and `system` = 1
and project_id = 'global' limit 1
) where case_template_id is null or case_template_id = '';