新增接口,修改部分接口接受参数格式

master
xiaoCJ 8 months ago
parent 70d1eeb024
commit a980159df9

@ -4,6 +4,7 @@ import cn.hutool.core.util.IdUtil;
import com.github.pagehelper.PageInfo;
import com.sztzjy.resource_center.annotation.AnonymousAccess;
import com.sztzjy.resource_center.entity.*;
import com.sztzjy.resource_center.entity.dto.TrainingDto;
import com.sztzjy.resource_center.mapper.SysCaseQuestionMapper;
import com.sztzjy.resource_center.mapper.SysCaseQuestionStepMapper;
import com.sztzjy.resource_center.mapper.SysOneCatalogMapper;
@ -267,6 +268,7 @@ public class CaseApi {
//案例题步骤内容查看 caseStepId
@PostMapping("selectCaseStepDetails")
@ApiOperation("案例题步骤内容查看")
@AnonymousAccess
public SysCaseQuestionStepWithBLOBs selectCaseStepDetails(@ApiParam("案例题步骤ID") @RequestParam String caseStepId) {
return caseQuestionStepMapper.selectByPrimaryKey(caseStepId);
}
@ -281,10 +283,17 @@ public class CaseApi {
//案例题步骤内容查看 caseStepId
@PostMapping("selectCaseByChapterId")
@ApiOperation("根据三级ID查询案例题集合")
@AnonymousAccess
public List<SysCaseQuestion> selectCaseByChapterId(@RequestParam String threeId) {
SysCaseQuestionExample example = new SysCaseQuestionExample();
SysTopicAndCourseExample example = new SysTopicAndCourseExample();
example.createCriteria().andThreeIdEqualTo(threeId);
List<SysCaseQuestion> list = caseQuestionMapper.selectByExample(example);
List<SysTopicAndCourse> sysTopicAndCourses = topicAndCourseMapper.selectByExample(example);
List<String> collect = sysTopicAndCourses.stream().map(SysTopicAndCourse::getTopicId).collect(Collectors.toList());
SysCaseQuestionExample example1 = new SysCaseQuestionExample();
example1.createCriteria().andCaseIdIn(collect).andSourceEqualTo("管理员");
List<SysCaseQuestion> list = caseQuestionMapper.selectByExampleWithBLOBs(example1);
return list;
}
@ -297,7 +306,8 @@ public class CaseApi {
*/
@PostMapping("selectCaseStepListBatchByIdListAndSort")
@ApiOperation("查询案例题步骤并排序")
public List<SysCaseQuestionStepWithBLOBs> selectCaseByChapterId(@RequestParam List<String> caseIdList) {
@AnonymousAccess
public List<SysCaseQuestionStepWithBLOBs> selectCaseStepListBatchByIdListAndSort(@RequestBody List<String> caseIdList) {
SysCaseQuestionStepExample example = new SysCaseQuestionStepExample();
example.createCriteria().andCaseIdIn(caseIdList);
example.setOrderByClause("sort");
@ -314,7 +324,8 @@ public class CaseApi {
*/
@PostMapping("selectCaseByChapterIdList")
@ApiOperation("根据章节IdList查询案例题")
public List<SysCaseQuestion> selectCaseByChapterIdList(@RequestParam List<String> chapterIdList) {
@AnonymousAccess
public List<SysCaseQuestion> selectCaseByChapterIdList(@RequestBody List<String> chapterIdList) {
SysTopicAndCourseExample example = new SysTopicAndCourseExample();
example.createCriteria().andThreeIdIn(chapterIdList);
List<SysTopicAndCourse> sysTopicAndCourses = topicAndCourseMapper.selectByExample(example);
@ -329,7 +340,8 @@ public class CaseApi {
//*考试模式--成绩报告案例题question0riginal所属章节contentOriginal为考核点数量,Sort为序号
@PostMapping("getGradeReportCase")
@ApiOperation("考试模式/成绩报告/案例题")
public List<SysCaseQuestionStepWithBLOBs> getGradeReportCase(@RequestParam List<String> caseIdList,
@AnonymousAccess
public List<SysCaseQuestionStepWithBLOBs> getGradeReportCase(@RequestBody List<String> caseIdList,
@RequestParam String schoolId,
@RequestParam String systemOwner) {
SysOneCatalog sysOneCatalogs = getSysOneCatalogs(systemOwner);
@ -341,6 +353,7 @@ public class CaseApi {
//根据课程ID查询案例题
@PostMapping("selectCaseByCourseId")
@ApiOperation("根据课程ID查询案例题")
@AnonymousAccess //只查学校新增的
public List<SysCaseQuestion> selectCaseByCourseId(@RequestParam String courseId,
@RequestParam String systemOwner,
@RequestParam String schoolId) {
@ -350,12 +363,22 @@ public class CaseApi {
SysTopicAndCourseExample example = new SysTopicAndCourseExample();
example.createCriteria().andTwoIdEqualTo(courseId).andOneIdEqualTo(oneId);
List<SysTopicAndCourse> sysTopicAndCourses = topicAndCourseMapper.selectByExample(example);
if (!sysTopicAndCourses.isEmpty()) {
List<String> collect = sysTopicAndCourses.stream().map(SysTopicAndCourse::getTopicId).collect(Collectors.toList());
SysCaseQuestionExample example1 = new SysCaseQuestionExample();
example1.createCriteria().andCaseIdIn(collect).andSourceEqualTo(schoolId);
List<SysCaseQuestion> list = caseQuestionMapper.selectByExampleWithBLOBs(example1);
return list;
}
return null;
}
List<String> collect = sysTopicAndCourses.stream().map(SysTopicAndCourse::getTopicId).collect(Collectors.toList());
SysCaseQuestionExample example1 = new SysCaseQuestionExample();
example1.createCriteria().andCaseIdIn(collect).andSourceEqualTo(schoolId);
List<SysCaseQuestion> list = caseQuestionMapper.selectByExampleWithBLOBs(example1);
return list;
//* 单独接口
//* 展示案例题详细信息
@AnonymousAccess
@ApiOperation("展示案例题详细信息")
@PostMapping("selectTrainingByIds")
public List<TrainingDto> selectTrainingByIds(@RequestBody List<String> caseStepIdList) {
return caseQuestionStepMapper.selectTrainingByIds(caseStepIdList);
}
}

@ -169,7 +169,7 @@ public class CourseApi {
@AnonymousAccess
@ApiOperation("根据课程IDList查询章节集合并排序")
@PostMapping("selectChaptersByCourseIdsAndAsc")
public List<SysThreeCatalog> selectChaptersByCourseIdsAndAsc(@RequestParam List<String> courseIds) {
public List<SysThreeCatalog> selectChaptersByCourseIdsAndAsc(@RequestBody List<String> courseIds) {
SysThreeCatalogExample example = new SysThreeCatalogExample();
example.createCriteria().andTwoIdIn(courseIds);
example.setOrderByClause("sort");
@ -186,7 +186,7 @@ public class CourseApi {
@AnonymousAccess
@ApiOperation("查询总章节数量")
@PostMapping("getTotalChapterCount")
public Integer getTotalChapterCount(String systemOwner) {
public Integer getTotalChapterCount(@RequestParam String systemOwner) {
SysOneCatalog sysOneCatalogs = getSysOneCatalogs(systemOwner);
String oneId = sysOneCatalogs.getOneId();
return threeCatalogMapper.countByOneId(oneId);
@ -202,7 +202,7 @@ public class CourseApi {
@AnonymousAccess
@ApiOperation("根据章节ID查询章节信息")
@PostMapping("selectChapterByChapterId")
public SysThreeCatalog selectChapterByChapterId(String chapterId) {
public SysThreeCatalog selectChapterByChapterId(@RequestParam String chapterId) {
return threeCatalogMapper.selectByPrimaryKey(chapterId);
}

@ -347,7 +347,7 @@ public class ObjectiveApi {
@AnonymousAccess
@ApiOperation("根据客观题IDList批量查询客观题")
@PostMapping("selectBatchByIdList")
private List<SysObjectiveQuestions> selectBatchByIdList(@RequestParam List<String> objectIdList) {
private List<SysObjectiveQuestions> selectBatchByIdList(@RequestBody List<String> objectIdList) {
SysObjectiveQuestionsExample example = new SysObjectiveQuestionsExample();
example.createCriteria().andObjectiveIdIn(objectIdList);
List<SysObjectiveQuestions> sysObjectiveQuestions = sysObjectiveQuestionMapper.selectByExample(example);

@ -24,10 +24,7 @@ import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
@RestController
@ -159,14 +156,19 @@ public class ResourceApi {
@AnonymousAccess
@ApiOperation("获取资源类型数量")
@PostMapping("getResourceTypeCount")
public Map<String, Integer> getResourceTypeCount(@RequestParam String systemOwner,
@RequestParam String schoolId) {
public Map<String, Long> getResourceTypeCount(@RequestParam String systemOwner,
@RequestParam String schoolId) {
SysOneCatalog sysOneCatalogs = getSysOneCatalogs(systemOwner);
SysResourceAndCourseExample example = new SysResourceAndCourseExample();
example.createCriteria().andOneIdEqualTo(sysOneCatalogs.getOneId());
List<SysResourceAndCourse> sysResourceAndCourses = sysResourceAndCourseMapper.selectByExample(example);
List<String> ids = sysResourceAndCourses.stream().map(SysResourceAndCourse::getResourceId).collect(Collectors.toList());
return sysResourceMapper.getCountByType(ids, schoolId);
List<Map<String, Object>> countByType = sysResourceMapper.getCountByType(ids, schoolId);
Map<String, Long> resultMap = new HashMap<>();
for (Map<String, Object> item : countByType) {
resultMap.put(item.get("resource_type").toString(), (Long) item.get("count"));
}
return resultMap;
}
@ -303,5 +305,4 @@ public class ResourceApi {
@Param("学校ID") @RequestParam String schoolId) {
return sysResourceMapper.getMostPopularName();
}
}

@ -0,0 +1,24 @@
package com.sztzjy.resource_center.entity.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
/**
* @Author xcj
* @Date 2024/7/22
*/
@Data
public class TrainingDto {
@ApiModelProperty("案例名称")
private String name;
@ApiModelProperty("案例题ID")
private String caseId;
@ApiModelProperty("所属任务")
private String task;
@ApiModelProperty("步骤数量")
private int count;
@ApiModelProperty("案例分值")
private BigDecimal score;
}

@ -5,6 +5,7 @@ import com.sztzjy.resource_center.entity.SysCaseQuestionStepExample;
import com.sztzjy.resource_center.entity.SysCaseQuestionStepWithBLOBs;
import java.util.List;
import com.sztzjy.resource_center.entity.dto.TrainingDto;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
@ -40,4 +41,6 @@ public interface SysCaseQuestionStepMapper {
List<SysCaseQuestionStepWithBLOBs> getGradeReportCase(@Param("list") List<String> caseIdList,
@Param("schoolId") String schoolId,
@Param("oneId") String oneId);
List<TrainingDto> selectTrainingByIds(@Param("list") List<String> caseStepIdList);
}

@ -45,7 +45,7 @@ public interface SysResourceMapper {
@Param("threeId") String threeId,
@Param("resourceName") String resourceName);
Map<String, Integer> getCountByType(@Param("list") List<String> ids, @Param("schoolId") String schoolId);
List<Map<String, Object>> getCountByType(@Param("list") List<String> ids, @Param("schoolId") String schoolId);
@Select("SELECT resource_name FROM `sys_resource` ORDER BY count desc")
String getMostPopularName();

@ -409,4 +409,31 @@
and s2.unmount_status is FALSE
GROUP BY s2.title, s3.three_name
</select>
<resultMap id="DtoBaseResultMap" type="com.sztzjy.resource_center.entity.dto.TrainingDto">
<result column="title" jdbcType="VARCHAR" property="name"/>
<result column="three_name" jdbcType="VARCHAR" property="task"/>
<result column="case_id" jdbcType="VARCHAR" property="caseId"/>
<result column="total_steps_count" jdbcType="INTEGER" property="count"/>
<result column="total_steps_score" jdbcType="DECIMAL" property="score"/>
<result column="total_steps_score" jdbcType="DECIMAL" property="score"/>
</resultMap>
<select id="selectTrainingByIds" resultMap="DtoBaseResultMap">
SELECT SUM(sqs.score) AS total_steps_score, sqs.case_id,COUNT(sqs.case_step_id) AS total_steps_count, sq.title,
scc.three_name
FROM sys_case_question_steps sqs
JOIN sys_case_questions sq ON sqs.case_id = sq.case_id
JOIN sys_three_catalog scc
JOIN sys_topic_and_course st ON st.three_id = scc.three_id
WHERE sqs.case_id IN
<foreach item="item" collection="list" open="(" separator="," close=")">
#{item}
</foreach>
and st.topic_id = sqs.case_id
GROUP BY sq.title, scc.three_name,sqs.case_id;
</select>
</mapper>

@ -440,7 +440,7 @@
<foreach close=")" collection="list" index="index" item="item" open="(" separator=",">
#{item}
</foreach>
AND source = #{schoolId}
AND source in (#{schoolId},'管理员')
GROUP BY resource_type
</select>

Loading…
Cancel
Save