fix(用例管理): 修复用例评审查询问题

--bug=1040041 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001040041
--bug=1040039 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001040039
This commit is contained in:
guoyuqi 2024-04-24 18:56:21 +08:00 committed by 刘瑞斌
parent e0fc0c7b38
commit cdd22425e7
5 changed files with 25 additions and 8 deletions

View File

@ -174,18 +174,17 @@
and case_review.status in
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
</when>
<when test="key=='review_pass_rule'">
<when test="key=='reviewPassRule'">
and case_review.review_pass_rule in
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
</when>
<when test="key=='create_user'">
<when test="key=='createUser'">
and case_review.create_user in
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
</when>
<when test="key=='case_reviewer'">
<when test="key=='reviewers'">
and case_review.id in (
select case_review_user.review_id from case_review_user where case_review_user.user_id in
in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>

View File

@ -26,6 +26,7 @@ import io.metersphere.system.uid.NumGenerator;
import io.metersphere.system.utils.ServiceUtils;
import jakarta.annotation.Resource;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.session.ExecutorType;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
@ -588,6 +589,9 @@ public class CaseReviewService {
public void batchMoveCaseReview(CaseReviewBatchRequest request, String userId) {
List<String> ids;
if (StringUtils.isBlank(request.getMoveModuleId())) {
throw new MSException(Translator.get("functional_case.module_id.not_blank"));
}
if (request.isSelectAll()) {
ids = extCaseReviewMapper.getIds(request, request.getProjectId());
if (CollectionUtils.isNotEmpty(request.getExcludeIds())) {

View File

@ -613,6 +613,9 @@ public class CaseReviewControllerTests extends BaseTest {
caseReviews = getCaseReviews("创建评审更新1");
String moduleIdNewOne = caseReviews.get(0).getModuleId();
Assertions.assertTrue(StringUtils.equals(moduleIdNewOne, moduleIdNew));
request.setMoveModuleId(null);
request.setSelectAll(false);
this.requestPost(BATCH_MOVE_CASE_REVIEW, request).andExpect(status().is5xxServerError());
}
@Test

View File

@ -94,9 +94,7 @@ export interface FollowReviewParams {
}
// 批量操作评审参数
export interface BatchMoveReviewParams extends BatchApiParams {
projectId: string;
moveModuleId: string; // 移动到的评审模块id
moduleIds: string[];
}
// 评审拖拽排序类型
export type ReviewMoveMode = 'BEFORE' | 'AFTER' | 'APPEND';

View File

@ -495,6 +495,7 @@
width: hasOperationPermission.value ? 110 : 50,
},
];
const selectedModuleKeys = ref<string[]>([]);
const tableStore = useTableStore();
await tableStore.initColumn(TableKeyEnum.CASE_MANAGEMENT_REVIEW, columns, 'drawer', true);
const { propsRes, propsEvent, loadList, setLoadListParams, resetSelector } = useTable(
@ -546,7 +547,6 @@
moduleIds = [props.activeFolder, ...props.offspringIds];
}
}
const params = {
keyword: keyword.value,
projectId: appStore.currentProjectId,
@ -677,12 +677,25 @@
}
const moveModalVisible = ref(false);
const selectedModuleKeys = ref<string[]>([]);
const batchMoveFileLoading = ref(false);
async function handleReviewMove() {
try {
batchMoveFileLoading.value = true;
tableQueryParams.value = {
...tableQueryParams.value,
moveModuleId: selectedModuleKeys.value[0],
selectIds: batchParams.value?.selectedIds || [],
selectAll: !!batchParams.value?.selectAll,
excludeIds: batchParams.value?.excludeIds || [],
currentSelectCount: batchParams.value?.currentSelectCount || 0,
condition: {
keyword: keyword.value,
filter: { status: statusFilters.value, reviewers: reviewersFilters.value },
combine: batchParams.value.condition,
},
};
await moveReview({
...tableQueryParams.value,
});