|
|
@ -18,7 +18,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
import java.util.function.Function;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
import java.util.stream.IntStream;
|
|
|
|
|
|
|
|
|
|
|
|
@RestController
|
|
|
|
@RestController
|
|
|
|
@Api(tags = "案例题方面API")
|
|
|
|
@Api(tags = "案例题方面API")
|
|
|
@ -322,12 +324,38 @@ public class CaseApi {
|
|
|
|
example.createCriteria().andThreeIdEqualTo(threeId);
|
|
|
|
example.createCriteria().andThreeIdEqualTo(threeId);
|
|
|
|
List<SysTopicAndCourse> topicAndCourseList = topicAndCourseMapper.selectByExample(example);
|
|
|
|
List<SysTopicAndCourse> topicAndCourseList = topicAndCourseMapper.selectByExample(example);
|
|
|
|
List<String> caseIdList = topicAndCourseList.stream().map(SysTopicAndCourse::getTopicId).collect(Collectors.toList());
|
|
|
|
List<String> caseIdList = topicAndCourseList.stream().map(SysTopicAndCourse::getTopicId).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SysCaseQuestionExample caseQuestionExample =new SysCaseQuestionExample();
|
|
|
|
|
|
|
|
caseQuestionExample.createCriteria().andCaseIdIn(caseIdList);
|
|
|
|
|
|
|
|
caseQuestionExample.setOrderByClause("create_time");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<SysCaseQuestion> list = caseQuestionMapper.selectByExampleWithBLOBs(caseQuestionExample);
|
|
|
|
|
|
|
|
List<String> ids = list.stream().map(SysCaseQuestion::getCaseId).collect(Collectors.toList());
|
|
|
|
SysCaseQuestionStepExample caseQuestionStepExample = new SysCaseQuestionStepExample();
|
|
|
|
SysCaseQuestionStepExample caseQuestionStepExample = new SysCaseQuestionStepExample();
|
|
|
|
caseQuestionStepExample.createCriteria().andCaseIdIn(caseIdList);
|
|
|
|
caseQuestionStepExample.createCriteria().andCaseIdIn(ids);
|
|
|
|
List<SysCaseQuestionStepWithBLOBs> sysCaseQuestionStepWithBLOBs = caseQuestionStepMapper.selectByExampleWithBLOBs(caseQuestionStepExample);
|
|
|
|
List<SysCaseQuestionStepWithBLOBs> sysCaseQuestionStepWithBLOBs = caseQuestionStepMapper.selectByExampleWithBLOBs(caseQuestionStepExample);
|
|
|
|
return sysCaseQuestionStepWithBLOBs;
|
|
|
|
// 获取原 caseId 的顺序列表
|
|
|
|
|
|
|
|
Map<String, Integer> indexMap = IntStream.range(0, ids.size())
|
|
|
|
|
|
|
|
.boxed()
|
|
|
|
|
|
|
|
.collect(Collectors.toMap(ids::get, Function.identity()));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 根据 indexMap 顺序排序
|
|
|
|
|
|
|
|
List<SysCaseQuestionStepWithBLOBs> sortedSteps = sysCaseQuestionStepWithBLOBs.stream()
|
|
|
|
|
|
|
|
.sorted(Comparator.comparingInt(step -> indexMap.get(step.getCaseId())))
|
|
|
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
|
|
return sortedSteps;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("selectCaseStepByThreeIds")
|
|
|
|
|
|
|
|
@ApiOperation("查询案例题步骤")
|
|
|
|
|
|
|
|
@AnonymousAccess
|
|
|
|
|
|
|
|
public List<SysCaseQuestionStepWithBLOBs> selectCaseStepByThreeIds(@RequestBody List<String> threeIds) {
|
|
|
|
|
|
|
|
List<SysCaseQuestionStepWithBLOBs> list= caseQuestionStepMapper.selectCaseStepByThreeIds(threeIds);
|
|
|
|
|
|
|
|
return list;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("selectCaseStepListBatchByIdList")
|
|
|
|
@PostMapping("selectCaseStepListBatchByIdList")
|
|
|
|
@ApiOperation("查询案例题步骤")
|
|
|
|
@ApiOperation("查询案例题步骤")
|
|
|
|
@AnonymousAccess
|
|
|
|
@AnonymousAccess
|
|
|
|