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 = "测试用例标识")
private String identifier;
@ApiModelProperty(value = "测试追踪")
private String testTracking;
@ApiModelProperty(value = "产品需求id")
private Long productReqSpecsId;
@ApiModelProperty(value = "是否导入")
private Long isImport;
public PmsProjectTestcaseDataVo toPmsProjectTestcaseDataVo() {
PmsProjectTestcaseDataVo target = new PmsProjectTestcaseDataVo();
BeanUtils.copyProperties(this, target);

View File

@ -105,6 +105,14 @@ public class PmsProjectTestcaseInputVo {
@Size(max = 500, message = "长度需要小于500")
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,20 +149,22 @@ public class PmsProjectTestcaseServiceImpl implements IPmsProjectTestcaseService
, x -> pmsProductModuleService.selectPmsProductModuleById(x, false)
, pmsProjectTestcase.getPmsModuleId()));
}
// 设置需求创建人
pmsProjectTestcaseDataVo.setCreateBy(
PmsUtils.getSelectObjectInCache(
hashMap
, pmsCommonService::getNickNameByUsername
, pmsProjectTestcase.getCreateBy())
);
// 设置需求更新人
pmsProjectTestcaseDataVo.setUpdateBy(
PmsUtils.getSelectObjectInCache(
hashMap
, pmsCommonService::getNickNameByUsername
, pmsProjectTestcase.getUpdateBy())
);
if (pmsProjectTestcase.getIsImport() != null) {
// 设置需求创建人
pmsProjectTestcaseDataVo.setCreateBy(
PmsUtils.getSelectObjectInCache(
hashMap
, pmsCommonService::getNickNameByUsername
, pmsProjectTestcase.getCreateBy())
);
// 设置需求更新人
pmsProjectTestcaseDataVo.setUpdateBy(
PmsUtils.getSelectObjectInCache(
hashMap
, pmsCommonService::getNickNameByUsername
, pmsProjectTestcase.getUpdateBy())
);
}
// 设置产品需求
if (pmsProjectTestcase.getProductReqSpecsId() != null) {
pmsProjectTestcaseDataVo.setProductReqSpecs(
@ -1277,8 +1279,18 @@ public class PmsProjectTestcaseServiceImpl implements IPmsProjectTestcaseService
break;
}
}
testcase.setIsImport(1L);
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);
// 获取当前项目下测试用例的最大索引值
Long maxIndex = pmsProjectTestcaseMapper.selectPmsProjectTestcaseMaxIndexByProjectId(testcase.getPmsProjectId());

View File

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