feat(用例评审): 用例评审关联用例列表批量取消关联
This commit is contained in:
parent
2c166fa1d7
commit
e583b5255b
|
@ -152,6 +152,19 @@ INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT
|
|||
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'PROJECT_API_DEFINITION_CASE:READ+UPDATE');
|
||||
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'PROJECT_API_DEFINITION_CASE:READ+DELETE');
|
||||
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'PROJECT_API_DEFINITION_CASE:READ+EXECUTE');
|
||||
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'FUNCTIONAL_CASE:READ');
|
||||
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'FUNCTIONAL_CASE:READ+ADD');
|
||||
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'FUNCTIONAL_CASE:READ+UPDATE');
|
||||
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'FUNCTIONAL_CASE:READ+DELETE');
|
||||
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'FUNCTIONAL_CASE:READ+COMMENT');
|
||||
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'FUNCTIONAL_CASE:READ+EXPORT');
|
||||
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'FUNCTIONAL_CASE:READ+IMPORT');
|
||||
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'CASE_REVIEW:READ');
|
||||
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'CASE_REVIEW:READ+ADD');
|
||||
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'CASE_REVIEW:READ+UPDATE');
|
||||
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'CASE_REVIEW:READ+DELETE');
|
||||
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'CASE_REVIEW:READ+REVIEW');
|
||||
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_admin', 'CASE_REVIEW:READ+RELEVANCE');
|
||||
-- 项目成员权限
|
||||
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_member', 'PROJECT_BASE_INFO:READ');
|
||||
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_member', 'PROJECT_USER:READ');
|
||||
|
@ -224,6 +237,19 @@ INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT
|
|||
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_member', 'PROJECT_API_DEFINITION_CASE:READ+UPDATE');
|
||||
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_member', 'PROJECT_API_DEFINITION_CASE:READ+DELETE');
|
||||
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_member', 'PROJECT_API_DEFINITION_CASE:READ+EXECUTE');
|
||||
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_member', 'FUNCTIONAL_CASE:READ');
|
||||
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_member', 'FUNCTIONAL_CASE:READ+ADD');
|
||||
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_member', 'FUNCTIONAL_CASE:READ+UPDATE');
|
||||
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_member', 'FUNCTIONAL_CASE:READ+DELETE');
|
||||
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_member', 'FUNCTIONAL_CASE:READ+COMMENT');
|
||||
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_member', 'FUNCTIONAL_CASE:READ+EXPORT');
|
||||
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_member', 'FUNCTIONAL_CASE:READ+IMPORT');
|
||||
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_member', 'CASE_REVIEW:READ');
|
||||
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_member', 'CASE_REVIEW:READ+ADD');
|
||||
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_member', 'CASE_REVIEW:READ+UPDATE');
|
||||
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_member', 'CASE_REVIEW:READ+DELETE');
|
||||
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_member', 'CASE_REVIEW:READ+REVIEW');
|
||||
INSERT INTO user_role_permission (id, role_id, permission_id) VALUES (UUID_SHORT(), 'project_member', 'CASE_REVIEW:READ+RELEVANCE');
|
||||
-- 初始化当前站点配置
|
||||
INSERT into system_parameter values('base.url', 'http://127.0.0.1:8081', 'text');
|
||||
-- 初始化prometheus站点配置
|
||||
|
|
|
@ -5,8 +5,12 @@ import com.alibaba.excel.util.StringUtils;
|
|||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import io.metersphere.functional.dto.ReviewFunctionalCaseDTO;
|
||||
import io.metersphere.functional.request.BaseReviewCaseBatchRequest;
|
||||
import io.metersphere.functional.request.ReviewFunctionalCasePageRequest;
|
||||
import io.metersphere.functional.service.CaseReviewFunctionalCaseService;
|
||||
import io.metersphere.functional.service.CaseReviewLogService;
|
||||
import io.metersphere.system.log.annotation.Log;
|
||||
import io.metersphere.system.log.constants.OperationLogType;
|
||||
import io.metersphere.system.utils.PageUtils;
|
||||
import io.metersphere.system.utils.Pager;
|
||||
import io.metersphere.system.utils.SessionUtils;
|
||||
|
@ -47,4 +51,13 @@ public class CaseReviewFunctionalCaseController {
|
|||
Page<Object> page = PageHelper.startPage(request.getCurrent(), request.getPageSize());
|
||||
return PageUtils.setPageInfo(page, caseReviewFunctionalCaseService.page(request, false, userId));
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/batch/disassociate")
|
||||
@Operation(summary = "用例管理-功能用例-评审列表-评审详情-列表-批量取消关联用例")
|
||||
@Log(type = OperationLogType.DISASSOCIATE, expression = "#msClass.batchDisassociateCaseLog(#request)", msClass = CaseReviewLogService.class)
|
||||
public void batchDisassociate(@Validated @RequestBody BaseReviewCaseBatchRequest request) {
|
||||
caseReviewFunctionalCaseService.disassociate(request);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package io.metersphere.functional.mapper;
|
|||
|
||||
import io.metersphere.functional.dto.FunctionalCaseReviewDTO;
|
||||
import io.metersphere.functional.dto.ReviewFunctionalCaseDTO;
|
||||
import io.metersphere.functional.request.BaseReviewCaseBatchRequest;
|
||||
import io.metersphere.functional.request.FunctionalCaseReviewListRequest;
|
||||
import io.metersphere.functional.request.ReviewFunctionalCasePageRequest;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
@ -22,4 +23,7 @@ public interface ExtCaseReviewFunctionalCaseMapper {
|
|||
List<String> getCaseIdsByReviewId(@Param("reviewId") String reviewId);
|
||||
|
||||
List<ReviewFunctionalCaseDTO> page(@Param("request") ReviewFunctionalCasePageRequest request, @Param("deleted") boolean deleted, @Param("userId") String userId, @Param("sort") String sort);
|
||||
|
||||
|
||||
List<String> getIds(@Param("request") BaseReviewCaseBatchRequest request, @Param("userId") String userId, @Param("deleted") boolean deleted);
|
||||
}
|
||||
|
|
|
@ -93,10 +93,14 @@
|
|||
</if>
|
||||
<include refid="filters">
|
||||
<property name="filter" value="request.filter"/>
|
||||
<property name="searchMode" value="request.searchMode"/>
|
||||
</include>
|
||||
<include refid="combine">
|
||||
<property name="condition" value="request.combine"/>
|
||||
</include>
|
||||
<if test="request.combine != null">
|
||||
<include refid="combine">
|
||||
<property name="condition" value="request.combine"/>
|
||||
<property name="searchMode" value="request.searchMode"/>
|
||||
</include>
|
||||
</if>
|
||||
1=1
|
||||
</sql>
|
||||
|
||||
|
@ -110,21 +114,21 @@
|
|||
case_review_functional_case.review_status in
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
|
||||
<include refid="queryType">
|
||||
<property name="searchMode" value="request.searchMode"/>
|
||||
<property name="searchMode" value="${searchMode}"/>
|
||||
</include>
|
||||
</when>
|
||||
<when test="key=='last_execute_result'">
|
||||
functional_case.last_execute_result in
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
|
||||
<include refid="queryType">
|
||||
<property name="searchMode" value="request.searchMode"/>
|
||||
<property name="searchMode" value="${searchMode}"/>
|
||||
</include>
|
||||
</when>
|
||||
<when test="key=='version_id'">
|
||||
functional_case.version_id in
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
|
||||
<include refid="queryType">
|
||||
<property name="searchMode" value="request.searchMode"/>
|
||||
<property name="searchMode" value="${searchMode}"/>
|
||||
</include>
|
||||
</when>
|
||||
<when test="key.startsWith('custom_single')">
|
||||
|
@ -135,7 +139,7 @@
|
|||
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
|
||||
)
|
||||
<include refid="queryType">
|
||||
<property name="searchMode" value="request.searchMode"/>
|
||||
<property name="searchMode" value="${searchMode}"/>
|
||||
</include>
|
||||
</when>
|
||||
<when test="key.startsWith('custom_multiple')">
|
||||
|
@ -144,14 +148,14 @@
|
|||
#{key}
|
||||
and JSON_CONTAINS(`value`, json_array(#{value}))
|
||||
<include refid="queryType">
|
||||
<property name="searchMode" value="request.searchMode"/>
|
||||
<property name="searchMode" value="${searchMode}"/>
|
||||
</include>
|
||||
</when>
|
||||
<when test="key=='create_user'">
|
||||
functional_case.create_user in
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
|
||||
<include refid="queryType">
|
||||
<property name="searchMode" value="request.searchMode"/>
|
||||
<property name="searchMode" value="${searchMode}"/>
|
||||
</include>
|
||||
</when>
|
||||
</choose>
|
||||
|
@ -161,52 +165,50 @@
|
|||
</sql>
|
||||
|
||||
<sql id="combine">
|
||||
<if test="request.combine != null">
|
||||
<if test='${condition}.name != null'>
|
||||
functional_case.name
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||
<property name="object" value="${condition}.name"/>
|
||||
</include>
|
||||
<if test='${condition}.name != null'>
|
||||
functional_case.name
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||
<property name="object" value="${condition}.name"/>
|
||||
</include>
|
||||
<include refid="queryType">
|
||||
<property name="searchMode" value="${searchMode}"/>
|
||||
</include>
|
||||
</if>
|
||||
<if test='${condition}.id != null'>
|
||||
functional_case.num
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||
<property name="object" value="${condition}.id"/>
|
||||
</include>
|
||||
<include refid="queryType">
|
||||
<property name="searchMode" value="${searchMode}"/>
|
||||
</include>
|
||||
</if>
|
||||
<if test="${condition}.customs != null and ${condition}.customs.size() > 0">
|
||||
<foreach collection="${condition}.customs" item="custom" separator="" open="" close="">
|
||||
functional_case.id ${custom.operator} (
|
||||
select case_id from functional_case_custom_field where field_id = #{custom.id}
|
||||
<choose>
|
||||
<when test="custom.type == 'List'">
|
||||
and JSON_CONTAINS(`value`, json_array(#{custom.value}))
|
||||
</when>
|
||||
<when test="custom.type == 'date' or custom.type == 'datetime'">
|
||||
and `value`
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||
<property name="object" value="custom"/>
|
||||
</include>
|
||||
</when>
|
||||
<otherwise>
|
||||
and trim(both '"' from `value`)
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||
<property name="object" value="custom"/>
|
||||
</include>
|
||||
</otherwise>
|
||||
</choose>
|
||||
)
|
||||
<include refid="queryType">
|
||||
<property name="searchMode" value="request.searchMode"/>
|
||||
<property name="searchMode" value="${searchMode}"/>
|
||||
</include>
|
||||
</if>
|
||||
<if test='${condition}.id != null'>
|
||||
functional_case.num
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||
<property name="object" value="${condition}.id"/>
|
||||
</include>
|
||||
<include refid="queryType">
|
||||
<property name="searchMode" value="request.searchMode"/>
|
||||
</include>
|
||||
</if>
|
||||
<if test="${condition}.customs != null and ${condition}.customs.size() > 0">
|
||||
<foreach collection="${condition}.customs" item="custom" separator="" open="" close="">
|
||||
functional_case.id ${custom.operator} (
|
||||
select case_id from functional_case_custom_field where field_id = #{custom.id}
|
||||
<choose>
|
||||
<when test="custom.type == 'List'">
|
||||
and JSON_CONTAINS(`value`, json_array(#{custom.value}))
|
||||
</when>
|
||||
<when test="custom.type == 'date' or custom.type == 'datetime'">
|
||||
and `value`
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||
<property name="object" value="custom"/>
|
||||
</include>
|
||||
</when>
|
||||
<otherwise>
|
||||
and trim(both '"' from `value`)
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||
<property name="object" value="custom"/>
|
||||
</include>
|
||||
</otherwise>
|
||||
</choose>
|
||||
)
|
||||
<include refid="queryType">
|
||||
<property name="searchMode" value="request.searchMode"/>
|
||||
</include>
|
||||
</foreach>
|
||||
</if>
|
||||
</foreach>
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
|
@ -220,4 +222,56 @@
|
|||
</when>
|
||||
</choose>
|
||||
</sql>
|
||||
|
||||
|
||||
|
||||
<select id="getIds" resultType="java.lang.String">
|
||||
SELECT
|
||||
crfc.id as id
|
||||
FROM
|
||||
case_review_functional_case crfc
|
||||
LEFT JOIN functional_case ON crfc.case_id = functional_case.id
|
||||
WHERE
|
||||
review_id = #{request.reviewId}
|
||||
AND functional_case.deleted = #{deleted}
|
||||
<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>
|
||||
|
||||
|
||||
<sql id="queryWhereConditionByBaseQueryRequest">
|
||||
<if test="request.condition.keyword != null">
|
||||
(
|
||||
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>
|
||||
<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>
|
||||
1=1
|
||||
</sql>
|
||||
|
||||
</mapper>
|
|
@ -151,12 +151,20 @@
|
|||
</if>
|
||||
<include refid="filters">
|
||||
<property name="filter" value="request.filter"/>
|
||||
<property name="searchMode" value="request.searchMode"/>
|
||||
</include>
|
||||
<include refid="combine">
|
||||
<property name="condition" value="request.combine"/>
|
||||
<if test="request.combine != null">
|
||||
<include refid="combine">
|
||||
<property name="condition" value="request.combine"/>
|
||||
<property name="searchMode" value="request.searchMode"/>
|
||||
</include>
|
||||
</if>
|
||||
<include refid="queryAssociationCase">
|
||||
<property name="searchMode" value="request.searchMode"/>
|
||||
</include>
|
||||
<include refid="queryAssociationBug">
|
||||
<property name="searchMode" value="request.searchMode"/>
|
||||
</include>
|
||||
<include refid="queryAssociationCase"/>
|
||||
<include refid="queryAssociationBug"/>
|
||||
<include refid="queryVersionCondition">
|
||||
<property name="versionTable" value="functional_case"/>
|
||||
</include>
|
||||
|
@ -171,21 +179,21 @@
|
|||
functional_case.review_status in
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
|
||||
<include refid="queryType">
|
||||
<property name="searchMode" value="request.searchMode"/>
|
||||
<property name="searchMode" value="${searchMode}"/>
|
||||
</include>
|
||||
</when>
|
||||
<when test="key=='last_execute_result'">
|
||||
functional_case.last_execute_result in
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
|
||||
<include refid="queryType">
|
||||
<property name="searchMode" value="request.searchMode"/>
|
||||
<property name="searchMode" value="${searchMode}"/>
|
||||
</include>
|
||||
</when>
|
||||
<when test="key=='version_id'">
|
||||
functional_case.version_id in
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
|
||||
<include refid="queryType">
|
||||
<property name="searchMode" value="request.searchMode"/>
|
||||
<property name="searchMode" value="${searchMode}"/>
|
||||
</include>
|
||||
</when>
|
||||
<when test="key.startsWith('custom_single')">
|
||||
|
@ -196,7 +204,7 @@
|
|||
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
|
||||
)
|
||||
<include refid="queryType">
|
||||
<property name="searchMode" value="request.searchMode"/>
|
||||
<property name="searchMode" value="${searchMode}"/>
|
||||
</include>
|
||||
</when>
|
||||
<when test="key.startsWith('custom_multiple')">
|
||||
|
@ -205,14 +213,14 @@
|
|||
#{key}
|
||||
and JSON_CONTAINS(`value`, json_array(#{value}))
|
||||
<include refid="queryType">
|
||||
<property name="searchMode" value="request.searchMode"/>
|
||||
<property name="searchMode" value="${searchMode}"/>
|
||||
</include>
|
||||
</when>
|
||||
<when test="key=='create_user'">
|
||||
functional_case.create_user in
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
|
||||
<include refid="queryType">
|
||||
<property name="searchMode" value="request.searchMode"/>
|
||||
<property name="searchMode" value="${searchMode}"/>
|
||||
</include>
|
||||
</when>
|
||||
</choose>
|
||||
|
@ -222,52 +230,50 @@
|
|||
</sql>
|
||||
|
||||
<sql id="combine">
|
||||
<if test="request.combine != null">
|
||||
<if test='${condition}.name != null'>
|
||||
functional_case.name
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||
<property name="object" value="${condition}.name"/>
|
||||
</include>
|
||||
<if test='${condition}.name != null'>
|
||||
functional_case.name
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||
<property name="object" value="${condition}.name"/>
|
||||
</include>
|
||||
<include refid="queryType">
|
||||
<property name="searchMode" value="${searchMode}"/>
|
||||
</include>
|
||||
</if>
|
||||
<if test='${condition}.id != null'>
|
||||
functional_case.num
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||
<property name="object" value="${condition}.id"/>
|
||||
</include>
|
||||
<include refid="queryType">
|
||||
<property name="searchMode" value="${searchMode}"/>
|
||||
</include>
|
||||
</if>
|
||||
<if test="${condition}.customs != null and ${condition}.customs.size() > 0">
|
||||
<foreach collection="${condition}.customs" item="custom" separator="" open="" close="">
|
||||
functional_case.id ${custom.operator} (
|
||||
select case_id from functional_case_custom_field where field_id = #{custom.id}
|
||||
<choose>
|
||||
<when test="custom.type == 'List'">
|
||||
and JSON_CONTAINS(`value`, json_array(#{custom.value}))
|
||||
</when>
|
||||
<when test="custom.type == 'date' or custom.type == 'datetime'">
|
||||
and `value`
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||
<property name="object" value="custom"/>
|
||||
</include>
|
||||
</when>
|
||||
<otherwise>
|
||||
and trim(both '"' from `value`)
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||
<property name="object" value="custom"/>
|
||||
</include>
|
||||
</otherwise>
|
||||
</choose>
|
||||
)
|
||||
<include refid="queryType">
|
||||
<property name="searchMode" value="request.searchMode"/>
|
||||
<property name="searchMode" value="${searchMode}"/>
|
||||
</include>
|
||||
</if>
|
||||
<if test='${condition}.id != null'>
|
||||
functional_case.num
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||
<property name="object" value="${condition}.id"/>
|
||||
</include>
|
||||
<include refid="queryType">
|
||||
<property name="searchMode" value="request.searchMode"/>
|
||||
</include>
|
||||
</if>
|
||||
<if test="${condition}.customs != null and ${condition}.customs.size() > 0">
|
||||
<foreach collection="${condition}.customs" item="custom" separator="" open="" close="">
|
||||
functional_case.id ${custom.operator} (
|
||||
select case_id from functional_case_custom_field where field_id = #{custom.id}
|
||||
<choose>
|
||||
<when test="custom.type == 'List'">
|
||||
and JSON_CONTAINS(`value`, json_array(#{custom.value}))
|
||||
</when>
|
||||
<when test="custom.type == 'date' or custom.type == 'datetime'">
|
||||
and `value`
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||
<property name="object" value="custom"/>
|
||||
</include>
|
||||
</when>
|
||||
<otherwise>
|
||||
and trim(both '"' from `value`)
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||
<property name="object" value="custom"/>
|
||||
</include>
|
||||
</otherwise>
|
||||
</choose>
|
||||
)
|
||||
<include refid="queryType">
|
||||
<property name="searchMode" value="request.searchMode"/>
|
||||
</include>
|
||||
</foreach>
|
||||
</if>
|
||||
</foreach>
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
|
@ -331,7 +337,7 @@
|
|||
</include>
|
||||
)
|
||||
<include refid="queryType">
|
||||
<property name="searchMode" value="request.searchMode"/>
|
||||
<property name="searchMode" value="${searchMode}"/>
|
||||
</include>
|
||||
</when>
|
||||
<when test="request.associationCase.operatorType == 'NOT_EMPTY'">
|
||||
|
@ -347,7 +353,7 @@
|
|||
</include>
|
||||
)
|
||||
<include refid="queryType">
|
||||
<property name="searchMode" value="request.searchMode"/>
|
||||
<property name="searchMode" value="${searchMode}"/>
|
||||
</include>
|
||||
</when>
|
||||
</choose>
|
||||
|
@ -367,7 +373,7 @@
|
|||
</include>
|
||||
)
|
||||
<include refid="queryType">
|
||||
<property name="searchMode" value="request.searchMode"/>
|
||||
<property name="searchMode" value="${searchMode}"/>
|
||||
</include>
|
||||
</when>
|
||||
<when test="request.associationBug.operatorType == 'NOT_EMPTY'">
|
||||
|
@ -380,7 +386,7 @@
|
|||
</include>
|
||||
)
|
||||
<include refid="queryType">
|
||||
<property name="searchMode" value="request.searchMode"/>
|
||||
<property name="searchMode" value="${searchMode}"/>
|
||||
</include>
|
||||
</when>
|
||||
</choose>
|
||||
|
@ -442,10 +448,12 @@
|
|||
</if>
|
||||
<include refid="filters">
|
||||
<property name="filter" value="request.condition.filter"/>
|
||||
<property name="searchMode" value="request.condition.searchMode"/>
|
||||
</include>
|
||||
<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">
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
package io.metersphere.functional.request;
|
||||
|
||||
import io.metersphere.system.dto.table.TableBatchProcessDTO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author wx
|
||||
*/
|
||||
@Data
|
||||
public class BaseReviewCaseBatchRequest extends TableBatchProcessDTO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "评审id", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String reviewId;
|
||||
|
||||
|
||||
@Schema(description = "userId用来判断是否只看我的")
|
||||
private String userId;
|
||||
}
|
|
@ -1,11 +1,14 @@
|
|||
package io.metersphere.functional.service;
|
||||
|
||||
|
||||
import io.metersphere.functional.domain.CaseReviewFunctionalCaseExample;
|
||||
import io.metersphere.functional.dto.ReviewFunctionalCaseDTO;
|
||||
import io.metersphere.functional.dto.ReviewsDTO;
|
||||
import io.metersphere.functional.mapper.CaseReviewFunctionalCaseMapper;
|
||||
import io.metersphere.functional.mapper.ExtCaseReviewFunctionalCaseMapper;
|
||||
import io.metersphere.functional.mapper.ExtCaseReviewFunctionalCaseUserMapper;
|
||||
import io.metersphere.functional.mapper.ExtFunctionalCaseModuleMapper;
|
||||
import io.metersphere.functional.request.BaseReviewCaseBatchRequest;
|
||||
import io.metersphere.functional.request.ReviewFunctionalCasePageRequest;
|
||||
import io.metersphere.project.domain.ProjectVersion;
|
||||
import io.metersphere.project.mapper.ExtBaseProjectVersionMapper;
|
||||
|
@ -38,6 +41,8 @@ public class CaseReviewFunctionalCaseService {
|
|||
private ExtBaseProjectVersionMapper extBaseProjectVersionMapper;
|
||||
@Resource
|
||||
private ExtCaseReviewFunctionalCaseUserMapper extCaseReviewFunctionalCaseUserMapper;
|
||||
@Resource
|
||||
private CaseReviewFunctionalCaseMapper caseReviewFunctionalCaseMapper;
|
||||
|
||||
/**
|
||||
* 通过评审id获取关联的用例id集合
|
||||
|
@ -85,4 +90,30 @@ public class CaseReviewFunctionalCaseService {
|
|||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param request request
|
||||
*/
|
||||
public void disassociate(BaseReviewCaseBatchRequest request) {
|
||||
List<String> ids = doSelectIds(request);
|
||||
if (CollectionUtils.isNotEmpty(ids)) {
|
||||
CaseReviewFunctionalCaseExample example = new CaseReviewFunctionalCaseExample();
|
||||
example.createCriteria().andIdIn(ids);
|
||||
caseReviewFunctionalCaseMapper.deleteByExample(example);
|
||||
}
|
||||
}
|
||||
|
||||
public List<String> doSelectIds(BaseReviewCaseBatchRequest request) {
|
||||
if (request.isSelectAll()) {
|
||||
List<String> ids = extCaseReviewFunctionalCaseMapper.getIds(request, request.getUserId(), false);
|
||||
if (CollectionUtils.isNotEmpty(request.getExcludeIds())) {
|
||||
ids.removeAll(request.getExcludeIds());
|
||||
}
|
||||
return ids;
|
||||
} else {
|
||||
return request.getSelectIds();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,10 +1,13 @@
|
|||
package io.metersphere.functional.service;
|
||||
|
||||
import io.metersphere.functional.domain.CaseReview;
|
||||
import io.metersphere.functional.domain.CaseReviewFunctionalCase;
|
||||
import io.metersphere.functional.domain.FunctionalCase;
|
||||
import io.metersphere.functional.domain.FunctionalCaseExample;
|
||||
import io.metersphere.functional.mapper.CaseReviewFunctionalCaseMapper;
|
||||
import io.metersphere.functional.mapper.CaseReviewMapper;
|
||||
import io.metersphere.functional.mapper.FunctionalCaseMapper;
|
||||
import io.metersphere.functional.request.BaseReviewCaseBatchRequest;
|
||||
import io.metersphere.functional.request.CaseReviewAssociateRequest;
|
||||
import io.metersphere.functional.request.CaseReviewRequest;
|
||||
import io.metersphere.sdk.constants.HttpMethodConstants;
|
||||
|
@ -33,6 +36,12 @@ public class CaseReviewLogService {
|
|||
@Resource
|
||||
private FunctionalCaseMapper functionalCaseMapper;
|
||||
|
||||
@Resource
|
||||
private CaseReviewFunctionalCaseService caseReviewFunctionalCaseService;
|
||||
|
||||
@Resource
|
||||
private CaseReviewFunctionalCaseMapper caseReviewFunctionalCaseMapper;
|
||||
|
||||
/**
|
||||
* 新增用例评审 日志
|
||||
*
|
||||
|
@ -85,7 +94,7 @@ public class CaseReviewLogService {
|
|||
*/
|
||||
public LogDTO updateCaseReviewLog(CaseReviewRequest requests) {
|
||||
CaseReview caseReview = caseReviewMapper.selectByPrimaryKey(requests.getId());
|
||||
if (caseReview ==null) {
|
||||
if (caseReview == null) {
|
||||
return null;
|
||||
}
|
||||
LogDTO dto = new LogDTO(
|
||||
|
@ -129,9 +138,9 @@ public class CaseReviewLogService {
|
|||
return null;
|
||||
}
|
||||
|
||||
public List<LogDTO> associateCaseLog(CaseReviewAssociateRequest request){
|
||||
public List<LogDTO> associateCaseLog(CaseReviewAssociateRequest request) {
|
||||
CaseReview caseReview = caseReviewMapper.selectByPrimaryKey(request.getReviewId());
|
||||
if (caseReview ==null) {
|
||||
if (caseReview == null) {
|
||||
return null;
|
||||
}
|
||||
List<LogDTO> dtoList = new ArrayList<>();
|
||||
|
@ -159,4 +168,32 @@ public class CaseReviewLogService {
|
|||
|
||||
return dtoList;
|
||||
}
|
||||
|
||||
|
||||
public List<LogDTO> batchDisassociateCaseLog(BaseReviewCaseBatchRequest request) {
|
||||
List<String> ids = caseReviewFunctionalCaseService.doSelectIds(request);
|
||||
List<LogDTO> dtoList = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(ids)) {
|
||||
ids.forEach(id -> {
|
||||
CaseReviewFunctionalCase caseReviewFunctionalCase = caseReviewFunctionalCaseMapper.selectByPrimaryKey(id);
|
||||
FunctionalCase functionalCase = functionalCaseMapper.selectByPrimaryKey(caseReviewFunctionalCase.getCaseId());
|
||||
if (caseReviewFunctionalCase != null) {
|
||||
LogDTO dto = new LogDTO(
|
||||
null,
|
||||
null,
|
||||
caseReviewFunctionalCase.getId(),
|
||||
null,
|
||||
OperationLogType.DISASSOCIATE.name(),
|
||||
OperationLogModule.CASE_REVIEW,
|
||||
functionalCase.getName());
|
||||
dto.setPath("/case/review/batch/disassociate");
|
||||
dto.setMethod(HttpMethodConstants.POST.name());
|
||||
dto.setOriginalValue(JSON.toJSONBytes(functionalCase));
|
||||
dtoList.add(dto);
|
||||
}
|
||||
});
|
||||
}
|
||||
return dtoList;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
package io.metersphere.functional.controller;
|
||||
|
||||
import io.metersphere.functional.request.BaseReviewCaseBatchRequest;
|
||||
import io.metersphere.functional.request.FunctionalCasePageRequest;
|
||||
import io.metersphere.functional.request.ReviewFunctionalCasePageRequest;
|
||||
import io.metersphere.system.base.BaseTest;
|
||||
import io.metersphere.system.dto.sdk.BaseCondition;
|
||||
import org.junit.jupiter.api.MethodOrderer;
|
||||
import org.junit.jupiter.api.Order;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
@ -12,10 +14,7 @@ import org.springframework.boot.test.context.SpringBootTest;
|
|||
import org.springframework.test.context.jdbc.Sql;
|
||||
import org.springframework.test.context.jdbc.SqlConfig;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
|
||||
|
@ -26,6 +25,7 @@ public class CaseReviewFunctionalCaseControllerTests extends BaseTest {
|
|||
public static final String FUNCTIONAL_CASE_LIST_URL = "/functional/case/page";
|
||||
|
||||
public static final String REVIEW_CASE_PAGE = "/case/review/detail/page";
|
||||
public static final String BATCH_DELETE_URL = "/case/review/detail/batch/disassociate";
|
||||
|
||||
@Test
|
||||
@Order(1)
|
||||
|
@ -79,4 +79,30 @@ public class CaseReviewFunctionalCaseControllerTests extends BaseTest {
|
|||
this.requestPostWithOkAndReturn(REVIEW_CASE_PAGE, request);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@Order(4)
|
||||
public void testBatchDisassociate() throws Exception {
|
||||
BaseReviewCaseBatchRequest request = new BaseReviewCaseBatchRequest();
|
||||
request.setReviewId("wx_review_id_1");
|
||||
request.setSelectAll(false);
|
||||
this.requestPostWithOkAndReturn(BATCH_DELETE_URL, request);
|
||||
request.setSelectIds(Arrays.asList("wx_test_2"));
|
||||
this.requestPostWithOkAndReturn(BATCH_DELETE_URL, request);
|
||||
request.setSelectIds(new ArrayList<>());
|
||||
request.setSelectAll(true);
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("customs", Arrays.asList(new LinkedHashMap() {{
|
||||
put("id", "TEST_FIELD_ID");
|
||||
put("operator", "in");
|
||||
put("value", "222");
|
||||
put("type", "List");
|
||||
}}));
|
||||
BaseCondition baseCondition = new BaseCondition();
|
||||
baseCondition.setCombine(map);
|
||||
request.setCondition(baseCondition);
|
||||
this.requestPostWithOkAndReturn(BATCH_DELETE_URL, request);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue