feat(测试计划): 测试计划列表增加高级搜索
This commit is contained in:
parent
bd07a77b2c
commit
935c1d652e
|
@ -597,4 +597,5 @@ user_view.all_data=All data
|
||||||
user_view.my_follow=I followed
|
user_view.my_follow=I followed
|
||||||
user_view.my_create=I created
|
user_view.my_create=I created
|
||||||
user_view.my_review=I review
|
user_view.my_review=I review
|
||||||
|
user_view.archived=Archived
|
||||||
user_view_exist=The view already exists
|
user_view_exist=The view already exists
|
|
@ -592,4 +592,5 @@ user_view.all_data=全部数据
|
||||||
user_view.my_follow=我关注的
|
user_view.my_follow=我关注的
|
||||||
user_view.my_create=我创建的
|
user_view.my_create=我创建的
|
||||||
user_view.my_review=我评审的
|
user_view.my_review=我评审的
|
||||||
|
user_view.archived=已归档
|
||||||
user_view_exist=视图已存在
|
user_view_exist=视图已存在
|
|
@ -592,4 +592,5 @@ user_view.all_data=全部數據
|
||||||
user_view.my_follow=我關注的
|
user_view.my_follow=我關注的
|
||||||
user_view.my_create=我創建的
|
user_view.my_create=我創建的
|
||||||
user_view.my_review=我評審的
|
user_view.my_review=我評審的
|
||||||
|
user_view.archived=已歸檔
|
||||||
user_view_exist=視圖已存在
|
user_view_exist=視圖已存在
|
|
@ -44,6 +44,15 @@ public enum InternalUserView {
|
||||||
condition.setOperator(CombineCondition.CombineConditionOperator.IN.name());
|
condition.setOperator(CombineCondition.CombineConditionOperator.IN.name());
|
||||||
userViewDTO.setConditions(List.of(condition));
|
userViewDTO.setConditions(List.of(condition));
|
||||||
return userViewDTO;
|
return userViewDTO;
|
||||||
|
}),
|
||||||
|
ARCHIVED(() -> {
|
||||||
|
UserViewDTO userViewDTO = getUserViewDTO("archived");
|
||||||
|
CombineCondition condition = new CombineCondition();
|
||||||
|
condition.setName("archived");
|
||||||
|
condition.setValue("ARCHIVED");
|
||||||
|
condition.setOperator(CombineCondition.CombineConditionOperator.EQUALS.name());
|
||||||
|
userViewDTO.setConditions(List.of(condition));
|
||||||
|
return userViewDTO;
|
||||||
});
|
});
|
||||||
|
|
||||||
private static UserViewDTO getUserViewDTO(String name) {
|
private static UserViewDTO getUserViewDTO(String name) {
|
||||||
|
|
|
@ -8,10 +8,9 @@ import java.util.List;
|
||||||
/**
|
/**
|
||||||
* @Author: jianxing
|
* @Author: jianxing
|
||||||
* @CreateTime: 2024-09-02 10:47
|
* @CreateTime: 2024-09-02 10:47
|
||||||
*
|
* <p>
|
||||||
* 视图的类型
|
* 视图的类型
|
||||||
* 例如:功能用例视图
|
* 例如:功能用例视图
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public enum UserViewType implements ValueEnum {
|
public enum UserViewType implements ValueEnum {
|
||||||
|
|
||||||
|
@ -54,8 +53,23 @@ public enum UserViewType implements ValueEnum {
|
||||||
PLAN_API_SCENARIO_DRAWER("plan-api-scenario-drawer",
|
PLAN_API_SCENARIO_DRAWER("plan-api-scenario-drawer",
|
||||||
List.of(InternalUserView.ALL_DATA, InternalUserView.MY_CREATE)),
|
List.of(InternalUserView.ALL_DATA, InternalUserView.MY_CREATE)),
|
||||||
PLAN_BUG_DRAWER("plan-bug-drawer",
|
PLAN_BUG_DRAWER("plan-bug-drawer",
|
||||||
List.of(InternalUserView.ALL_DATA, InternalUserView.MY_CREATE));
|
List.of(InternalUserView.ALL_DATA, InternalUserView.MY_CREATE)),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 测试计划列表
|
||||||
|
*/
|
||||||
|
TEST_PLAN_ALL("test-plan-all",
|
||||||
|
List.of(InternalUserView.ALL_DATA, InternalUserView.ARCHIVED, InternalUserView.MY_CREATE)),
|
||||||
|
TEST_PLAN("test-plan",
|
||||||
|
List.of(InternalUserView.ALL_DATA, InternalUserView.ARCHIVED, InternalUserView.MY_FOLLOW, InternalUserView.MY_CREATE)),
|
||||||
|
TEST_PLAN_GROUP("test-plan-group",
|
||||||
|
List.of(InternalUserView.ALL_DATA, InternalUserView.ARCHIVED, InternalUserView.MY_CREATE)),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 测试计划报告
|
||||||
|
*/
|
||||||
|
TEST_PLAN_REPORT("test-plan-report",
|
||||||
|
List.of(InternalUserView.ALL_DATA, InternalUserView.MY_CREATE));
|
||||||
|
|
||||||
private String value;
|
private String value;
|
||||||
private List<InternalUserView> internalViews;
|
private List<InternalUserView> internalViews;
|
||||||
|
|
|
@ -11,6 +11,7 @@ import io.metersphere.plan.dto.response.TestPlanResponse;
|
||||||
import io.metersphere.project.dto.DropNode;
|
import io.metersphere.project.dto.DropNode;
|
||||||
import io.metersphere.project.dto.ModuleCountDTO;
|
import io.metersphere.project.dto.ModuleCountDTO;
|
||||||
import io.metersphere.project.dto.NodeSortQueryParam;
|
import io.metersphere.project.dto.NodeSortQueryParam;
|
||||||
|
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;
|
||||||
|
@ -20,6 +21,7 @@ public interface ExtTestPlanMapper {
|
||||||
|
|
||||||
List<String> selectByGroupIdList(@Param("list") List<String> parentTestPlanId);
|
List<String> selectByGroupIdList(@Param("list") List<String> parentTestPlanId);
|
||||||
|
|
||||||
|
@BaseConditionFilter
|
||||||
List<TestPlanResponse> selectByConditions(@Param("request") TestPlanTableRequest request);
|
List<TestPlanResponse> selectByConditions(@Param("request") TestPlanTableRequest request);
|
||||||
|
|
||||||
List<String> selectIdByConditions(@Param("request") TestPlanBatchProcessRequest request);
|
List<String> selectIdByConditions(@Param("request") TestPlanBatchProcessRequest request);
|
||||||
|
|
|
@ -113,7 +113,7 @@
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
<choose>
|
<!--<choose>
|
||||||
<when test='request.searchMode == "AND"'>
|
<when test='request.searchMode == "AND"'>
|
||||||
AND <include refid="queryCombine"/>
|
AND <include refid="queryCombine"/>
|
||||||
</when>
|
</when>
|
||||||
|
@ -122,11 +122,13 @@
|
||||||
<include refid="queryCombine"/>
|
<include refid="queryCombine"/>
|
||||||
)
|
)
|
||||||
</when>
|
</when>
|
||||||
</choose>
|
</choose>-->
|
||||||
<include refid="filters">
|
<include refid="filters">
|
||||||
<property name="filter" value="request.filter"/>
|
<property name="filter" value="request.filter"/>
|
||||||
</include>
|
</include>
|
||||||
|
<include refid="combine">
|
||||||
|
<property name="combineSearch" value="request.combineSearch"/>
|
||||||
|
</include>
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
|
|
||||||
|
@ -147,7 +149,61 @@
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
|
|
||||||
<sql id="queryCombine">
|
|
||||||
|
<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="t.create_user"/>
|
||||||
|
</include>
|
||||||
|
</if>
|
||||||
|
<if test="condition.name == 'follower'">
|
||||||
|
<include refid="io.metersphere.system.mapper.BaseMapper.associationCondition">
|
||||||
|
<property name="mainIdColumn" value="t.id"/>
|
||||||
|
<property name="associationTable" value="test_plan_follower"/>
|
||||||
|
<property name="associationIdColumn" value="test_plan_id"/>
|
||||||
|
<property name="searchColumn" value="user_id"/>
|
||||||
|
<property name="condition" value="condition"/>
|
||||||
|
</include>
|
||||||
|
</if>
|
||||||
|
<if test="condition.name == 'archived'">
|
||||||
|
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||||
|
<property name="condition" value="condition"/>
|
||||||
|
<property name="column" value="t.status"/>
|
||||||
|
</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="t"/>
|
||||||
|
</include>
|
||||||
|
<!-- 状态 -->
|
||||||
|
<if test="condition.name == 'status'">
|
||||||
|
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||||
|
<property name="condition" value="condition"/>
|
||||||
|
<property name="column" value="t.status"/>
|
||||||
|
</include>
|
||||||
|
</if>
|
||||||
|
<include refid="io.metersphere.system.mapper.BaseMapper.queryType">
|
||||||
|
<property name="searchMode" value="${combineSearch}.searchMode"/>
|
||||||
|
</include>
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
</trim>
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- <sql id="queryCombine">
|
||||||
<if test="request.combine != null">
|
<if test="request.combine != null">
|
||||||
<include refid="combine">
|
<include refid="combine">
|
||||||
<property name="condition" value="request.combine"/>
|
<property name="condition" value="request.combine"/>
|
||||||
|
@ -158,7 +214,7 @@
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<sql id="combine">
|
<sql id="combine">
|
||||||
<!-- 名称 -->
|
<!– 名称 –>
|
||||||
<if test='${condition}.name != null'>
|
<if test='${condition}.name != null'>
|
||||||
t.name
|
t.name
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||||
|
@ -168,7 +224,7 @@
|
||||||
<property name="searchMode" value="${searchMode}"/>
|
<property name="searchMode" value="${searchMode}"/>
|
||||||
</include>
|
</include>
|
||||||
</if>
|
</if>
|
||||||
<!-- id -->
|
<!– id –>
|
||||||
<if test='${condition}.id != null'>
|
<if test='${condition}.id != null'>
|
||||||
t.num
|
t.num
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||||
|
@ -178,7 +234,7 @@
|
||||||
<property name="searchMode" value="${searchMode}"/>
|
<property name="searchMode" value="${searchMode}"/>
|
||||||
</include>
|
</include>
|
||||||
</if>
|
</if>
|
||||||
<!-- 所属模块 -->
|
<!– 所属模块 –>
|
||||||
<if test='${condition}.moduleId != null'>
|
<if test='${condition}.moduleId != null'>
|
||||||
t.moduleId
|
t.moduleId
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||||
|
@ -188,7 +244,7 @@
|
||||||
<property name="searchMode" value="${searchMode}"/>
|
<property name="searchMode" value="${searchMode}"/>
|
||||||
</include>
|
</include>
|
||||||
</if>
|
</if>
|
||||||
<!-- 创建人 -->
|
<!– 创建人 –>
|
||||||
<if test='${condition}.createUser != null'>
|
<if test='${condition}.createUser != null'>
|
||||||
t.create_user
|
t.create_user
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||||
|
@ -198,7 +254,7 @@
|
||||||
<property name="searchMode" value="${searchMode}"/>
|
<property name="searchMode" value="${searchMode}"/>
|
||||||
</include>
|
</include>
|
||||||
</if>
|
</if>
|
||||||
<!-- 创建时间 -->
|
<!– 创建时间 –>
|
||||||
<if test='${condition}.createTime != null'>
|
<if test='${condition}.createTime != null'>
|
||||||
t.create_time
|
t.create_time
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||||
|
@ -208,16 +264,16 @@
|
||||||
<property name="searchMode" value="${searchMode}"/>
|
<property name="searchMode" value="${searchMode}"/>
|
||||||
</include>
|
</include>
|
||||||
</if>
|
</if>
|
||||||
<!-- 标签 -->
|
<!– 标签 –>
|
||||||
<if test='${condition}.tags != null'>
|
<if test='${condition}.tags != null'>
|
||||||
<include refid="queryTag">
|
<include refid="queryTag">
|
||||||
<property name="searchMode" value="${searchMode}"/>
|
<property name="searchMode" value="${searchMode}"/>
|
||||||
<property name="combineTag" value="${condition}.tags"/>
|
<property name="combineTag" value="${condition}.tags"/>
|
||||||
</include>
|
</include>
|
||||||
</if>
|
</if>
|
||||||
</sql>
|
</sql>-->
|
||||||
|
|
||||||
<sql id="queryType">
|
<!--<sql id="queryType">
|
||||||
<choose>
|
<choose>
|
||||||
<when test='${searchMode} == "AND"'>
|
<when test='${searchMode} == "AND"'>
|
||||||
AND
|
AND
|
||||||
|
@ -226,11 +282,11 @@
|
||||||
OR
|
OR
|
||||||
</when>
|
</when>
|
||||||
</choose>
|
</choose>
|
||||||
</sql>
|
</sql>-->
|
||||||
|
|
||||||
|
|
||||||
<sql id="queryTag">
|
<!--<sql id="queryTag">
|
||||||
<!-- 不包含 -->
|
<!– 不包含 –>
|
||||||
<if test='${combineTag}.value.size() > 0 and ${combineTag}.operator == "not like"'>
|
<if test='${combineTag}.value.size() > 0 and ${combineTag}.operator == "not like"'>
|
||||||
(
|
(
|
||||||
t.tags is null or t.tags = '[]' or
|
t.tags is null or t.tags = '[]' or
|
||||||
|
@ -242,7 +298,7 @@
|
||||||
<property name="searchMode" value="${searchMode}"/>
|
<property name="searchMode" value="${searchMode}"/>
|
||||||
</include>
|
</include>
|
||||||
</if>
|
</if>
|
||||||
<!-- 包含 -->
|
<!– 包含 –>
|
||||||
<if test='${combineTag}.value.size() > 0 and ${combineTag}.operator == "like"'>
|
<if test='${combineTag}.value.size() > 0 and ${combineTag}.operator == "like"'>
|
||||||
<foreach collection="${combineTag}.value" item="tag" separator="or" open="(" close=")">
|
<foreach collection="${combineTag}.value" item="tag" separator="or" open="(" close=")">
|
||||||
JSON_CONTAINS(t.tags, JSON_ARRAY(#{tag}))
|
JSON_CONTAINS(t.tags, JSON_ARRAY(#{tag}))
|
||||||
|
@ -251,14 +307,14 @@
|
||||||
<property name="searchMode" value="${searchMode}"/>
|
<property name="searchMode" value="${searchMode}"/>
|
||||||
</include>
|
</include>
|
||||||
</if>
|
</if>
|
||||||
<!-- 空 -->
|
<!– 空 –>
|
||||||
<if test='${combineTag}.operator == "is null"'>
|
<if test='${combineTag}.operator == "is null"'>
|
||||||
(t.tags is null or t.tags = '[]')
|
(t.tags is null or t.tags = '[]')
|
||||||
<include refid="queryType">
|
<include refid="queryType">
|
||||||
<property name="searchMode" value="${searchMode}"/>
|
<property name="searchMode" value="${searchMode}"/>
|
||||||
</include>
|
</include>
|
||||||
</if>
|
</if>
|
||||||
</sql>
|
</sql>-->
|
||||||
|
|
||||||
|
|
||||||
<select id="countModuleIdByConditions"
|
<select id="countModuleIdByConditions"
|
||||||
|
|
Loading…
Reference in New Issue