refactor(用例管理): 用例评审相关调整

This commit is contained in:
WangXu10 2024-02-04 13:59:37 +08:00 committed by 刘瑞斌
parent 1b3712492c
commit c3a605e99f
5 changed files with 57 additions and 71 deletions

View File

@ -71,7 +71,7 @@
#{moduleId}
</foreach>
</if>
<if test="request.keyword != null">
<if test="request.keyword != null and request.keyword != ''">
and (
functional_case.name like concat('%', #{request.keyword},'%')
or functional_case.num like concat('%', #{request.keyword},'%')
@ -306,16 +306,7 @@
<if test="userId != null and userId != ''">
AND crfc.case_id in (select case_id from case_review_functional_case_user crfcu where crfcu.review_id = #{request.reviewId} and crfcu.user_id = #{userId})
</if>
<choose>
<when test='request.condition.searchMode == "AND"'>
AND <include refid="queryWhereConditionByBaseQueryRequest"/>
</when>
<when test='request.condition.searchMode == "OR"'>
and (
<include refid="queryWhereConditionByBaseQueryRequest"/>
)
</when>
</choose>
</select>
<select id="getListByRequest" resultType="io.metersphere.functional.domain.CaseReviewFunctionalCase">
@ -330,16 +321,7 @@
<if test="userId != null and userId != ''">
AND crfc.case_id in (select case_id from case_review_functional_case_user crfcu where crfcu.review_id = #{request.reviewId} and crfcu.user_id = #{userId})
</if>
<choose>
<when test='request.condition.searchMode == "AND"'>
AND <include refid="queryWhereConditionByBaseQueryRequest"/>
</when>
<when test='request.condition.searchMode == "OR"'>
and (
<include refid="queryWhereConditionByBaseQueryRequest"/>
)
</when>
</choose>
<if test="request.excludeIds != null and request.excludeIds.size() > 0" >
and crfc.id not in
<foreach collection="request.excludeIds" item="excludeId" open="(" separator="," close=")">
@ -350,20 +332,35 @@
<sql id="queryWhereConditionByBaseQueryRequest">
<if test="request.moduleIds != null and request.moduleIds.size() > 0">
and functional_case.module_id in
<foreach collection="request.moduleIds" item="moduleId" separator="," open="(" close=")">
#{moduleId}
</foreach>
</if>
<if test="request.condition.keyword != null">
(
and (
functional_case.name like concat('%', #{request.keyword},'%')
or functional_case.num like concat('%', #{request.keyword},'%')
or JSON_CONTAINS(tags, concat('["',#{request.keyword},'"]'))
)
<include refid="queryType">
<property name="searchMode" value="request.condition.searchMode"/>
</include>
</if>
<include refid="filters">
<property name="filter" value="request.condition.filter"/>
<property name="searchMode" value="request.condition.searchMode"/>
</include>
<choose>
<when test='request.condition.searchMode == "AND"'>
AND <include refid="baseQueryCombine"/>
</when>
<when test='request.condition.searchMode == "OR"'>
and (
<include refid="baseQueryCombine"/>
)
</when>
</choose>
</sql>
<sql id="baseQueryCombine">
<if test="request.condition.combine != null">
<include refid="combine">
<property name="condition" value="request.condition.combine"/>
@ -373,6 +370,7 @@
1=1
</sql>
<select id="getPos" resultType="java.lang.Long">
SELECT
pos

View File

@ -356,28 +356,6 @@
</if>
</sql>
<sql id="queryVersionConditionByBaseQueryRequest">
<if test="request.versionId != null">
${versionTable}.version_id = #{request.versionId}
<include refid="queryType">
<property name="searchMode" value="request.condition.searchMode"/>
</include>
</if>
<if test="request.refId != null">
${versionTable}.ref_id = #{request.refId}
<include refid="queryType">
<property name="searchMode" value="request.condition.searchMode"/>
</include>
</if>
<if test="request.versionId == null and request.refId == null">
${versionTable}.latest = 1
<include refid="queryType">
<property name="searchMode" value="request.condition.searchMode"/>
</include>
</if>
1 = 1
</sql>
<sql id="queryVersionCondition">
<if test="request.versionId != null">
and ${versionTable}.version_id = #{request.versionId}
@ -513,51 +491,49 @@
WHERE
functional_case.project_id = #{projectId}
and functional_case.deleted = #{deleted}
<choose>
<when test='request.condition.searchMode == "AND"'>
AND <include refid="queryWhereConditionByBaseQueryRequest"/>
</when>
<when test='request.condition.searchMode == "OR"'>
and (
<include refid="queryWhereConditionByBaseQueryRequest"/>
)
</when>
</choose>
</select>
<sql id="queryWhereConditionByBaseQueryRequest">
<if test="request.moduleIds != null and request.moduleIds.size() > 0">
functional_case.module_id in
and functional_case.module_id in
<foreach collection="request.moduleIds" item="moduleId" separator="," open="(" close=")">
#{moduleId}
</foreach>
<include refid="queryType">
<property name="searchMode" value="request.condition.searchMode"/>
</include>
</if>
<if test="request.condition.keyword != null">
(
<if test="request.condition.keyword != null and request.condition.keyword != ''">
and (
functional_case.name like concat('%', #{request.keyword},'%')
or functional_case.num like concat('%', #{request.keyword},'%')
or JSON_CONTAINS(tags, concat('["',#{request.keyword},'"]'))
)
<include refid="queryType">
<property name="searchMode" value="request.condition.searchMode"/>
</include>
</if>
<include refid="filters">
<property name="filter" value="request.condition.filter"/>
<property name="searchMode" value="request.condition.searchMode"/>
</include>
<choose>
<when test='request.condition.searchMode == "AND"'>
AND <include refid="baseQueryCombine"/>
</when>
<when test='request.condition.searchMode == "OR"'>
and (
<include refid="baseQueryCombine"/>
)
</when>
</choose>
<include refid="queryVersionCondition">
<property name="versionTable" value="functional_case"/>
</include>
</sql>
<sql id="baseQueryCombine">
<if test="request.condition.combine != null">
<include refid="combine">
<property name="condition" value="request.condition.combine"/>
<property name="searchMode" value="request.condition.searchMode"/>
</include>
</if>
<include refid="queryVersionConditionByBaseQueryRequest">
<property name="versionTable" value="functional_case"/>
</include>
1=1
</sql>
<select id="getRefIds" resultType="java.lang.String">

View File

@ -7,6 +7,7 @@ import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.util.List;
/**
* @author wx
@ -24,4 +25,7 @@ public class BaseReviewCaseBatchRequest extends TableBatchProcessDTO implements
@Schema(description = "userId用来判断是否只看我的")
private String userId;
@Schema(description = "模块id")
private List<String> moduleIds;
}

View File

@ -405,4 +405,8 @@ public class FunctionalCaseModuleService extends ModuleTreeService {
return this.add(request, userId);
}
public FunctionalCaseModule getModule(String id) {
return functionalCaseModuleMapper.selectByPrimaryKey(id);
}
}

View File

@ -276,6 +276,10 @@ public class FunctionalCaseService {
functionalCaseDetailDTO.setVersionName(versions.get(0).getName());
}
//模块名称
FunctionalCaseModule module = functionalCaseModuleService.getModule(functionalCaseDetailDTO.getModuleId());
functionalCaseDetailDTO.setModuleName(module.getName());
//处理已关联需求数量/缺陷数量/用例数量
handleCount(functionalCaseDetailDTO);