Merge pull request '新增测试用例 "测试追踪"、"是否导入" 字段,修复导入测试用例后列表刷新问题' (#895) from zengweizhang/microservices:master into dev_testCase_export

This commit is contained in:
otto 2025-05-29 15:18:08 +08:00
commit bd9382cf1c
4 changed files with 49 additions and 15 deletions

View File

@ -146,9 +146,15 @@ public class PmsProjectTestcase extends BaseEntity {
@ApiModelProperty(value = "测试用例标识") @ApiModelProperty(value = "测试用例标识")
private String identifier; private String identifier;
@ApiModelProperty(value = "测试追踪")
private String testTracking;
@ApiModelProperty(value = "产品需求id") @ApiModelProperty(value = "产品需求id")
private Long productReqSpecsId; private Long productReqSpecsId;
@ApiModelProperty(value = "是否导入")
private Long isImport;
public PmsProjectTestcaseDataVo toPmsProjectTestcaseDataVo() { public PmsProjectTestcaseDataVo toPmsProjectTestcaseDataVo() {
PmsProjectTestcaseDataVo target = new PmsProjectTestcaseDataVo(); PmsProjectTestcaseDataVo target = new PmsProjectTestcaseDataVo();
BeanUtils.copyProperties(this, target); BeanUtils.copyProperties(this, target);

View File

@ -105,6 +105,14 @@ public class PmsProjectTestcaseInputVo {
@Size(max = 500, message = "长度需要小于500") @Size(max = 500, message = "长度需要小于500")
private String terminationConditions; private String terminationConditions;
@ApiModelProperty(value = "测试用例标识")
@Size(max = 255, message = "长度需要小于500")
private String identifier;
@ApiModelProperty(value = "测试追踪")
@Size(max = 255, message = "长度需要小于500")
private String testTracking;
/** /**
* 测试步骤列表 * 测试步骤列表
*/ */

View File

@ -149,6 +149,7 @@ public class PmsProjectTestcaseServiceImpl implements IPmsProjectTestcaseService
, x -> pmsProductModuleService.selectPmsProductModuleById(x, false) , x -> pmsProductModuleService.selectPmsProductModuleById(x, false)
, pmsProjectTestcase.getPmsModuleId())); , pmsProjectTestcase.getPmsModuleId()));
} }
if (pmsProjectTestcase.getIsImport() != null) {
// 设置需求创建人 // 设置需求创建人
pmsProjectTestcaseDataVo.setCreateBy( pmsProjectTestcaseDataVo.setCreateBy(
PmsUtils.getSelectObjectInCache( PmsUtils.getSelectObjectInCache(
@ -163,6 +164,7 @@ public class PmsProjectTestcaseServiceImpl implements IPmsProjectTestcaseService
, pmsCommonService::getNickNameByUsername , pmsCommonService::getNickNameByUsername
, pmsProjectTestcase.getUpdateBy()) , pmsProjectTestcase.getUpdateBy())
); );
}
// 设置产品需求 // 设置产品需求
if (pmsProjectTestcase.getProductReqSpecsId() != null) { if (pmsProjectTestcase.getProductReqSpecsId() != null) {
pmsProjectTestcaseDataVo.setProductReqSpecs( pmsProjectTestcaseDataVo.setProductReqSpecs(
@ -1277,8 +1279,18 @@ public class PmsProjectTestcaseServiceImpl implements IPmsProjectTestcaseService
break; break;
} }
} }
testcase.setIsImport(1L);
testcase.setTestcaseStepList(testcaseSteps); testcase.setTestcaseStepList(testcaseSteps);
if (testcase.getAssigneeGitlinkId() == null) {
// 未设置维护用户时默认为当前操作用户
testcase.setAssigneeGitlinkId(SecurityUtils.getGitlinkUserId());
}
if (testcase.getTypeId() == null) {
// 设置类型为默认值
PmsProjectTestcaseType defaultType = pmsProjectTestcaseTypeService.selectDefaultPmsProjectTestcaseType();
testcase.setTypeId(defaultType.getId());
}
testcase.setAssigneeGitlinkId(1L); testcase.setAssigneeGitlinkId(1L);
// 获取当前项目下测试用例的最大索引值 // 获取当前项目下测试用例的最大索引值
Long maxIndex = pmsProjectTestcaseMapper.selectPmsProjectTestcaseMaxIndexByProjectId(testcase.getPmsProjectId()); Long maxIndex = pmsProjectTestcaseMapper.selectPmsProjectTestcaseMaxIndexByProjectId(testcase.getPmsProjectId());

View File

@ -25,7 +25,9 @@
<result property="testMethod" column="test_method"/> <result property="testMethod" column="test_method"/>
<result property="terminationConditions" column="termination_conditions"/> <result property="terminationConditions" column="termination_conditions"/>
<result property="identifier" column="identifier"/> <result property="identifier" column="identifier"/>
<result property="testTracking" column="test_track"/>
<result property="productReqSpecsId" column="product_req_specs_id"/> <result property="productReqSpecsId" column="product_req_specs_id"/>
<result property="isImport" column="is_import"/>
</resultMap> </resultMap>
<sql id="selectPmsProjectTestcaseVo"> <sql id="selectPmsProjectTestcaseVo">
@ -131,7 +133,9 @@
<if test="testMethod != null">test_method,</if> <if test="testMethod != null">test_method,</if>
<if test="terminationConditions != null">termination_conditions,</if> <if test="terminationConditions != null">termination_conditions,</if>
<if test="identifier != null">identifier,</if> <if test="identifier != null">identifier,</if>
<if test="testTracking != null">test_tracking,</if>
<if test="productReqSpecsId != null">product_req_specs_id,</if> <if test="productReqSpecsId != null">product_req_specs_id,</if>
<if test="isImport != null">is_import,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="title != null and title != ''">#{title},</if> <if test="title != null and title != ''">#{title},</if>
@ -153,7 +157,9 @@
<if test="testMethod != null">#{testMethod},</if> <if test="testMethod != null">#{testMethod},</if>
<if test="terminationConditions != null">#{terminationConditions},</if> <if test="terminationConditions != null">#{terminationConditions},</if>
<if test="identifier != null">#{identifier},</if> <if test="identifier != null">#{identifier},</if>
<if test="testTracking != null">#{test_tracking},</if>
<if test="productReqSpecsId != null">#{productReqSpecsId},</if> <if test="productReqSpecsId != null">#{productReqSpecsId},</if>
<if test="isImport != null">#{isImport},</if>
</trim> </trim>
</insert> </insert>
@ -179,7 +185,9 @@
<if test="testMethod != null">test_method = #{testMethod},</if> <if test="testMethod != null">test_method = #{testMethod},</if>
<if test="terminationConditions != null">termination_conditions = #{terminationConditions},</if> <if test="terminationConditions != null">termination_conditions = #{terminationConditions},</if>
<if test="identifier != null">identifier = #{identifier},</if> <if test="identifier != null">identifier = #{identifier},</if>
<if test="productReqSpecsId != null">product_req_specs_id = #{productReqSpecsId},</if> <if test="testTracking != null">#{testTracking},</if>
<if test="productReqSpecsId != null">#{productReqSpecsId},</if>
<if test="isImport != null">#{isImport},</if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>