@ -17,9 +17,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired ;
import org.springframework.web.bind.annotation.* ;
import java.util.Date ;
import java.util.List ;
import java.util.UUID ;
import java.util.* ;
import java.util.stream.Collectors ;
@RestController
@ -383,4 +381,46 @@ public class CaseApi {
List < TrainingDto > trainingDtos = caseQuestionStepMapper . selectTrainingByIds ( caseStepIdList ) ;
return trainingDtos ;
}
//* 单独接口
//* 获取所有内置案例题步骤信息
@AnonymousAccess
@ApiOperation ( "获取所有内置案例题步骤信息" )
@PostMapping ( "selectAllStepBySystemOwner" )
public List < SysCaseQuestionStepWithBLOBs > selectAllStepBySystemOwner ( @RequestParam String systemOwner ) {
SysOneCatalog sysOneCatalogs = getSysOneCatalogs ( systemOwner ) ;
List < String > ids = topicAndCourseMapper . getCaseIdsBySourceIsAdmin ( sysOneCatalogs . getOneId ( ) ) ;
SysCaseQuestionStepExample example1 = new SysCaseQuestionStepExample ( ) ;
example1 . createCriteria ( ) . andCaseIdIn ( ids ) ;
return caseQuestionStepMapper . selectByExampleWithBLOBs ( example1 ) ;
}
//* 单独接口
@AnonymousAccess
@ApiOperation ( "获取三级ID和案例题ID" )
@PostMapping ( "getMapChapterIdAndCaseIdsByCourseIdAndChapterId" )
public Map < String , List < String > > getMapChapterIdAndCaseIdsByCourseIdAndChapterId ( @RequestBody List < SysThreeCatalog > sysThreeCatalogs ,
@RequestParam String systemOwner ) {
// 批量查询案例题ID
Map < String , List < String > > caseIdMap = new HashMap < > ( ) ;
List < String > courseIdList = new ArrayList < > ( ) ;
List < String > chapterIdList = new ArrayList < > ( ) ;
for ( SysThreeCatalog chapter : sysThreeCatalogs ) {
courseIdList . add ( chapter . getTwoId ( ) ) ;
chapterIdList . add ( chapter . getThreeId ( ) ) ;
}
List < Map < String , Object > > results = caseQuestionMapper . selectCaseIdByCourseAndChapterIds ( courseIdList , chapterIdList ) ;
for ( Map < String , Object > result : results ) {
String chapterId = ( String ) result . get ( "chapter_id" ) ;
String caseId = ( String ) result . get ( "case_id" ) ;
if ( ! caseIdMap . containsKey ( chapterId ) ) {
caseIdMap . put ( chapterId , new ArrayList < > ( ) ) ;
}
caseIdMap . get ( chapterId ) . add ( caseId ) ;
}
return caseIdMap ;
}
}