feat(用例管理): 用例评审增加高级搜索

This commit is contained in:
guoyuqi 2024-09-25 18:49:12 +08:00 committed by Craftsman
parent 23e23d1392
commit 25c319b438
2 changed files with 92 additions and 25 deletions

View File

@ -5,6 +5,7 @@ import io.metersphere.functional.dto.CaseReviewDTO;
import io.metersphere.functional.request.CaseReviewBatchRequest; import io.metersphere.functional.request.CaseReviewBatchRequest;
import io.metersphere.functional.request.CaseReviewPageRequest; import io.metersphere.functional.request.CaseReviewPageRequest;
import io.metersphere.project.dto.ModuleCountDTO; import io.metersphere.project.dto.ModuleCountDTO;
import io.metersphere.system.interceptor.BaseConditionFilter;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
@ -18,18 +19,22 @@ public interface ExtCaseReviewMapper {
Long getPos(@Param("projectId") String projectId); Long getPos(@Param("projectId") String projectId);
@BaseConditionFilter
List<CaseReviewDTO> list(@Param("request") CaseReviewPageRequest request); List<CaseReviewDTO> list(@Param("request") CaseReviewPageRequest request);
Long getPrePos(@Param("projectId") String projectId, @Param("basePos") Long basePos); Long getPrePos(@Param("projectId") String projectId, @Param("basePos") Long basePos);
Long getLastPos(@Param("projectId") String projectId, @Param("basePos") Long basePos); Long getLastPos(@Param("projectId") String projectId, @Param("basePos") Long basePos);
@BaseConditionFilter
List<String> getIds(@Param("request") CaseReviewBatchRequest request, @Param("projectId") String projectId); List<String> getIds(@Param("request") CaseReviewBatchRequest request, @Param("projectId") String projectId);
void batchMoveModule(@Param("request") CaseReviewBatchRequest request, @Param("ids") List<String> ids, @Param("userId") String userId); void batchMoveModule(@Param("request") CaseReviewBatchRequest request, @Param("ids") List<String> ids, @Param("userId") String userId);
@BaseConditionFilter
List<ModuleCountDTO> countModuleIdByKeywordAndFileType(@Param("request") CaseReviewPageRequest request); List<ModuleCountDTO> countModuleIdByKeywordAndFileType(@Param("request") CaseReviewPageRequest request);
@BaseConditionFilter
long caseCount(@Param("request") CaseReviewPageRequest request); long caseCount(@Param("request") CaseReviewPageRequest request);

View File

@ -79,19 +79,14 @@
<include refid="filters"> <include refid="filters">
<property name="filter" value="request.condition.filter"/> <property name="filter" value="request.condition.filter"/>
</include> </include>
<choose> <if test="request.condition.combine != null">
<when test='request.condition.searchMode == "AND"'> <include refid="combine">
AND <include refid="baseQueryCombine"/> <property name="combineSearch" value="request.condition.combineSearch"/>
</when> </include>
<when test='request.condition.searchMode == "OR"'> </if>
and (
<include refid="baseQueryCombine"/>
)
</when>
</choose>
</sql> </sql>
<sql id="baseQueryCombine"> <!--<sql id="baseQueryCombine">
<if test="request.condition.combine != null"> <if test="request.condition.combine != null">
<include refid="combine"> <include refid="combine">
<property name="condition" value="request.condition.combine"/> <property name="condition" value="request.condition.combine"/>
@ -102,7 +97,7 @@
</include> </include>
</if> </if>
1=1 1=1
</sql> </sql>-->
<sql id="queryWhereCondition"> <sql id="queryWhereCondition">
@ -131,19 +126,12 @@
<include refid="filters"> <include refid="filters">
<property name="filter" value="request.filter"/> <property name="filter" value="request.filter"/>
</include> </include>
<choose> <include refid="combine">
<when test='request.searchMode == "AND"'> <property name="combineSearch" value="request.combineSearch"/>
AND <include refid="queryCombine"/> </include>
</when>
<when test='request.searchMode == "OR"'>
and (
<include refid="queryCombine"/>
)
</when>
</choose>
</sql> </sql>
<sql id="queryCombine"> <!--<sql id="queryCombine">
<include refid="combine"> <include refid="combine">
<property name="condition" value="request.combine"/> <property name="condition" value="request.combine"/>
<property name="name" value="request.name"/> <property name="name" value="request.name"/>
@ -152,7 +140,7 @@
<property name="ObjectModuleIds" value="request.combine.moduleIds"/> <property name="ObjectModuleIds" value="request.combine.moduleIds"/>
</include> </include>
1=1 1=1
</sql> </sql>-->
<sql id="queryType"> <sql id="queryType">
<choose> <choose>
@ -197,6 +185,80 @@
</sql> </sql>
<sql id="combine"> <sql id="combine">
<trim prefix="AND">
<trim prefix="(" suffix=")" suffixOverrides="AND|OR">
<if test="${combineSearch} != null">
<foreach collection="${combineSearch}.userViewConditions" item="condition">
<if test="condition.name == 'createUser'">
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
<property name="condition" value="condition"/>
<property name="column" value="case_review.create_user"/>
</include>
</if>
<if test="condition.name == 'reviewers'">
<include refid="io.metersphere.system.mapper.BaseMapper.associationCondition">
<property name="mainIdColumn" value="case_review.id"/>
<property name="associationTable" value="case_review_functional_case_user"/>
<property name="associationIdColumn" value="review_id"/>
<property name="searchColumn" value="user_id"/>
<property name="condition" value="condition"/>
</include>
</if>
<include refid="io.metersphere.system.mapper.BaseMapper.queryType">
<property name="searchMode" value="${combineSearch}.searchMode"/>
</include>
</foreach>
<foreach collection="${combineSearch}.systemFieldConditions" item="condition">
<include refid="io.metersphere.system.mapper.BaseMapper.commonSystemFieldConditions">
<property name="condition" value="condition"/>
<property name="tablePrefix" value="case_review"/>
</include>
<if test="condition.name == 'status'">
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
<property name="condition" value="condition"/>
<property name="column" value="case_review.status"/>
</include>
</if>
<if test="condition.name == 'reviewPassRule'">
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
<property name="condition" value="condition"/>
<property name="column" value="case_review.review_pass_rule"/>
</include>
</if>
<if test="condition.name == 'startTime'">
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
<property name="condition" value="condition"/>
<property name="column" value="case_review.start_time"/>
</include>
</if>
<if test="condition.name == 'endTime'">
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
<property name="condition" value="condition"/>
<property name="column" value="case_review.end_time"/>
</include>
</if>
<if test="condition.name == 'caseCount'">
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
<property name="condition" value="condition"/>
<property name="column" value="case_review.case_count"/>
</include>
</if>
<if test="condition.name == 'passRate'">
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
<property name="condition" value="condition"/>
<property name="column" value="case_review.pass_rate"/>
</include>
</if>
<include refid="io.metersphere.system.mapper.BaseMapper.queryType">
<property name="searchMode" value="${combineSearch}.searchMode"/>
</include>
</foreach>
</if>
</trim>
</trim>
</sql>
<!--<sql id="combine">
<if test="request.combine != null"> <if test="request.combine != null">
<if test='${condition}.name != null'> <if test='${condition}.name != null'>
case_review.name case_review.name
@ -374,7 +436,7 @@
</include> </include>
</if> </if>
</if> </if>
</sql> </sql>-->
<sql id="condition"> <sql id="condition">
<choose> <choose>