Commit 939702a4 authored by 盖献康's avatar 盖献康

Merge branch 'gaixiankang' into 'dev'

车型试验子任务 - 查看

See merge request !247
parents 55249169 1190431a
package com.ruoyi.service.impl; package com.ruoyi.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.ruoyi.common.constant.HttpStatus; import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.exception.ServiceException;
...@@ -64,21 +65,23 @@ public class StrategyModelTestTaskNew implements StrategyModelTestTask, Initiali ...@@ -64,21 +65,23 @@ public class StrategyModelTestTaskNew implements StrategyModelTestTask, Initiali
// 创建一个HashMap, 用于存放数据。用例条款ID作为key // 创建一个HashMap, 用于存放数据。用例条款ID作为key
HashMap<Long, List<TestCaseVO>> map = new HashMap<>(); HashMap<Long, List<TestCaseVO>> map = new HashMap<>();
for (TestUsecaseVO testUsecaseVO : testCaseList) { for (TestUsecaseVO testUsecaseVO : testCaseList) {
// map不存在此key,添加; 则,存数据 if (ObjectUtil.isNotEmpty(testUsecaseVO.getReviewStandardId())) {
if (!map.containsKey(testUsecaseVO.getReviewStandardId())) { // map不存在此key,添加; 则,存数据
TestCaseVO caseVO = new TestCaseVO(); if (!map.containsKey(testUsecaseVO.getReviewStandardId())) {
BeanUtils.copyProperties(testUsecaseVO, caseVO); TestCaseVO caseVO = new TestCaseVO();
List<TestCaseVO> caseList = new ArrayList<>(); BeanUtils.copyProperties(testUsecaseVO, caseVO);
caseList.add(caseVO); List<TestCaseVO> caseList = new ArrayList<>();
map.put(testUsecaseVO.getReviewStandardId(), caseList); caseList.add(caseVO);
} else { map.put(testUsecaseVO.getReviewStandardId(), caseList);
TestCaseVO caseVO = new TestCaseVO(); } else {
BeanUtils.copyProperties(testUsecaseVO, caseVO); TestCaseVO caseVO = new TestCaseVO();
map.get(testUsecaseVO.getReviewStandardId()).add(caseVO); BeanUtils.copyProperties(testUsecaseVO, caseVO);
map.get(testUsecaseVO.getReviewStandardId()).add(caseVO);
}
} }
} }
// 循环map, 给list赋值 // 循环map, 给list赋值
for (Map.Entry<Long, List<TestCaseVO>> entry : map.entrySet()) { for (Map.Entry<Long, List<TestCaseVO>> entry : map.entrySet()) {
List<TestUsecaseVO> collect = testCaseList.stream().filter(testCaseVO -> entry.getKey().equals(testCaseVO.getReviewStandardId())).collect(Collectors.toList()); List<TestUsecaseVO> collect = testCaseList.stream().filter(testCaseVO -> entry.getKey().equals(testCaseVO.getReviewStandardId())).collect(Collectors.toList());
if (collect.size() > 0){ if (collect.size() > 0){
TestUsecaseVO testUsecaseVO = collect.get(0); TestUsecaseVO testUsecaseVO = collect.get(0);
......
...@@ -49,32 +49,31 @@ ...@@ -49,32 +49,31 @@
</select> </select>
<select id="selectListByTaskId" resultType="com.ruoyi.domain.vo.TestUsecaseVO"> <select id="selectListByTaskId" resultType="com.ruoyi.domain.vo.TestUsecaseVO">
select select tu.id,
tu.id, tu.case_id caseId,
tu.case_id caseId, ts.test_scenario testScenario,
ts.test_scenario testScenario, tt.test_type testType,
tt.test_type testType, tu.usecase_no usecaseNo,
tu.usecase_no usecaseNo, tu.name,
tu.name, tu.tools,
tu.tools, tu.input,
tu.input, tu.description,
tu.description, tu.review_standard_id,
tu.review_standard_id, rs.chapter,
rs.chapter, rs.text,
rs.text, rs.test_method testMethod,
rs.test_method testMethod, tr.test_result testResult
tr.test_result testResult from t_test_usecase tu
from left join t_test_scenario ts on tu.test_scenario_id = ts.id
t_test_usecase tu left join t_test_type tt on tu.test_type_id = tt.id
left join t_test_scenario ts on tu.test_scenario_id = ts.id left join t_review_standard rs on tu.review_standard_id = rs.id
left join t_test_type tt on tu.test_type_id = tt.id left join t_task_scenario_relation tsr on tsr.test_scenario_id = ts.id
left join t_review_standard rs on tu.review_standard_id = rs.id left join t_task t on tsr.task_id = t.id
left join t_task_scenario_relation tsr on tsr.test_scenario_id = ts.id left join t_model_test_task mtt on mtt.id = t.model_test_task_id
left join t_task t on tsr.task_id = t.id left join t_test_records tr on tu.case_id = tr.usecase_id
left join t_model_test_task mtt on mtt.id = t.model_test_task_id where mtt.id = #{id}
left join t_test_records tr on tu.case_id = tr.usecase_id group by tu.id, tu.case_id, ts.test_scenario, tt.test_type, tu.usecase_no, tu.name, tu.tools, tu.input,
where tu.description, tu.review_standard_id, rs.chapter, rs.text, rs.test_method, tr.test_result
mtt.id = #{id}
</select> </select>
<select id="selectOptionalUsecase" resultType="com.ruoyi.domain.vo.OptionalUseCasesVO"> <select id="selectOptionalUsecase" resultType="com.ruoyi.domain.vo.OptionalUseCasesVO">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment