From f0e8ed5125514299546729b254318b1776543e61 Mon Sep 17 00:00:00 2001 From: xiaoCJ <406612557@qq.com> Date: Fri, 19 Jul 2024 17:54:56 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/api/CaseApi.java | 23 ++++++++++++++----- .../new_module/admin/AdminCaseController.java | 11 ++++++--- .../new_module/stu/StuCaseController.java | 12 ++++++++-- .../mapper/admin/AdminCaseMapper.java | 4 ++-- .../mapper/SysCaseQuestionMapper.xml | 6 +++-- 5 files changed, 41 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/sztzjy/resource_center/controller/api/CaseApi.java b/src/main/java/com/sztzjy/resource_center/controller/api/CaseApi.java index 7ffda6d..0fc50e1 100644 --- a/src/main/java/com/sztzjy/resource_center/controller/api/CaseApi.java +++ b/src/main/java/com/sztzjy/resource_center/controller/api/CaseApi.java @@ -71,8 +71,7 @@ public class CaseApi { sysTopicAndCourse.setId(IdUtil.randomUUID()); sysTopicAndCourse.setTopicType("1"); sysTopicAndCourse.setTopicId(uuid); - SysOneCatalog sysOneCatalogs = getSysOneCatalogs(sysCaseQuestion.getOneName()); - String oneId = sysOneCatalogs.getOneId(); + String oneId = sysOneCatalogs1.getOneId(); sysTopicAndCourse.setOneId(oneId); sysTopicAndCourse.setOneName(sysCaseQuestion.getOneName()); if (StringUtils.isNotBlank(sysCaseQuestion.getTwoId())) { @@ -98,7 +97,7 @@ public class CaseApi { @AnonymousAccess @ApiOperation("案例题页面查询") @PostMapping("selectCaseList") - public PageInfo selectCaseByConditions(@RequestParam Integer index, + public PageInfo selectCaseList(@RequestParam Integer index, @RequestParam Integer size, @RequestParam(required = false) String keyword, @RequestParam(required = false) String systemOwner, @@ -114,9 +113,21 @@ public class CaseApi { @AnonymousAccess @ApiOperation("案例题详细内容展示") @PostMapping("selectCaseDetails") - public SysCaseQuestion selectCaseByConditionsByID(@RequestParam String caseId) { - return caseQuestionMapper.selectByPrimaryKey(caseId); - + public SysCaseQuestion selectCaseByConditionsByID(@RequestParam String caseId, + @RequestParam String oneId) { + SysTopicAndCourseExample example = new SysTopicAndCourseExample(); + example.createCriteria().andOneIdEqualTo(oneId).andTopicIdEqualTo(caseId); + List sysTopicAndCourses = topicAndCourseMapper.selectByExample(example); + if (sysTopicAndCourses != null && !sysTopicAndCourses.isEmpty()) { + SysTopicAndCourse sysTopicAndCourse = sysTopicAndCourses.get(0); + SysCaseQuestion sysCaseQuestion = caseQuestionMapper.selectByPrimaryKey(caseId); + sysCaseQuestion.setTwoId(sysTopicAndCourse.getTwoId()); + sysCaseQuestion.setTwoName(sysTopicAndCourse.getTwoName()); + sysCaseQuestion.setThreeId(sysTopicAndCourse.getThreeId()); + sysCaseQuestion.setThreeName(sysTopicAndCourse.getThreeName()); + return sysCaseQuestion; + } + return null; } diff --git a/src/main/java/com/sztzjy/resource_center/controller/new_module/admin/AdminCaseController.java b/src/main/java/com/sztzjy/resource_center/controller/new_module/admin/AdminCaseController.java index 9711638..56a9590 100644 --- a/src/main/java/com/sztzjy/resource_center/controller/new_module/admin/AdminCaseController.java +++ b/src/main/java/com/sztzjy/resource_center/controller/new_module/admin/AdminCaseController.java @@ -1,7 +1,6 @@ package com.sztzjy.resource_center.controller.new_module.admin; import cn.hutool.core.util.IdUtil; -import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.google.common.reflect.TypeToken; import com.nimbusds.jose.shaded.gson.Gson; @@ -29,6 +28,7 @@ import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; import java.util.ArrayList; +import java.util.Arrays; import java.util.Date; import java.util.List; @@ -231,8 +231,13 @@ public class AdminCaseController { @RequestParam Integer size, @RequestParam(required = false) String keyWord, @ApiParam("精品案例不传,院校案例传'院校案例'") @RequestParam(required = false) String source, - @RequestParam(required = false) List labelName) { - List adminCaseReturnDtos = adminCaseMapper.selectByConditions(keyWord, source, labelName); + @RequestParam(required = false) String labelName) { + List list = new ArrayList<>(); + if (StringUtils.isNotBlank(labelName)) { + String[] split = labelName.split(","); + list = Arrays.asList(split); + } + List adminCaseReturnDtos = adminCaseMapper.selectByConditions(keyWord, source, list); PageInfo pageInfo = PageUtil.pageHelper(adminCaseReturnDtos, index, size); return new ResultEntity<>(pageInfo); } diff --git a/src/main/java/com/sztzjy/resource_center/controller/new_module/stu/StuCaseController.java b/src/main/java/com/sztzjy/resource_center/controller/new_module/stu/StuCaseController.java index c6b8b04..11d43c8 100644 --- a/src/main/java/com/sztzjy/resource_center/controller/new_module/stu/StuCaseController.java +++ b/src/main/java/com/sztzjy/resource_center/controller/new_module/stu/StuCaseController.java @@ -16,6 +16,7 @@ import com.sztzjy.resource_center.util.file.IFileUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; +import org.apache.commons.lang3.StringUtils; import org.apache.ibatis.annotations.Param; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -24,6 +25,8 @@ import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; import java.io.File; +import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.Map; @@ -74,8 +77,13 @@ public class StuCaseController { @RequestParam(required = false) String keyWord, @ApiParam("精品案例传管理员,院校案例传学校ID") @RequestParam(required = false) String source, @ApiParam("收藏案例页面传") @RequestParam(required = false) String userId, - @RequestParam(required = false) List labelName) { - List adminCaseReturnDtos = adminCaseMapper.selectByConditionsByStu(keyWord, source, userId, labelName); + @RequestParam(required = false) String labelName) { + List list = new ArrayList<>(); + if (StringUtils.isNotBlank(labelName)) { + String[] split = labelName.split(","); + list = Arrays.asList(split); + } + List adminCaseReturnDtos = adminCaseMapper.selectByConditionsByStu(keyWord, source, userId, list); PageInfo pageInfo = PageUtil.pageHelper(adminCaseReturnDtos, index, size); return new ResultEntity<>(pageInfo); } diff --git a/src/main/java/com/sztzjy/resource_center/mapper/admin/AdminCaseMapper.java b/src/main/java/com/sztzjy/resource_center/mapper/admin/AdminCaseMapper.java index 28db229..c6ad48d 100644 --- a/src/main/java/com/sztzjy/resource_center/mapper/admin/AdminCaseMapper.java +++ b/src/main/java/com/sztzjy/resource_center/mapper/admin/AdminCaseMapper.java @@ -42,10 +42,10 @@ public interface AdminCaseMapper { List selectByConditionsByStu(@Param("keyWord") String keyWord, @Param("source") String source, @Param("userId") String userId, - @Param("labelName") List labelName); + @Param("labelName") List list); List selectByConditions(@Param("keyWord") String keyWord, @Param("source") String source, - @Param("labelName") List labelName); + @Param("labelName") List list); } \ No newline at end of file diff --git a/src/main/resources/mapper/SysCaseQuestionMapper.xml b/src/main/resources/mapper/SysCaseQuestionMapper.xml index 2d3a50c..9d45f04 100644 --- a/src/main/resources/mapper/SysCaseQuestionMapper.xml +++ b/src/main/resources/mapper/SysCaseQuestionMapper.xml @@ -435,7 +435,9 @@ From 4802bced5ae75c818faffa3b5e051e23a499c7a6 Mon Sep 17 00:00:00 2001 From: xiaoCJ <406612557@qq.com> Date: Fri, 19 Jul 2024 18:05:45 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resource_center/controller/api/ObjectiveApi.java | 12 +++++++----- .../mapper/SysObjectiveQuestionsMapper.java | 2 +- .../resources/mapper/SysObjectiveQuestionsMapper.xml | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/sztzjy/resource_center/controller/api/ObjectiveApi.java b/src/main/java/com/sztzjy/resource_center/controller/api/ObjectiveApi.java index 8edde9f..3d01725 100644 --- a/src/main/java/com/sztzjy/resource_center/controller/api/ObjectiveApi.java +++ b/src/main/java/com/sztzjy/resource_center/controller/api/ObjectiveApi.java @@ -578,11 +578,13 @@ public class ObjectiveApi { // *根据客观题类型査询客观题 @AnonymousAccess - @ApiOperation("获取所选客观题数量及分数") + @ApiOperation("根据客观题类型査询客观题") @PostMapping("selectObjByType") - private List selectObjByType(@RequestParam String type, - @RequestParam String schoolId, - @RequestParam String systemOwner) { - return sysObjectiveQuestionMapper.selectObjByType(type, schoolId); + private List selectObjByType(@RequestParam String type, + @RequestParam String schoolId, + @RequestParam String systemOwner) { + List sysObjectiveQuestionsDtos = sysObjectiveQuestionMapper.selectObjByType(type, schoolId); + + return sysObjectiveQuestionsDtos; } } diff --git a/src/main/java/com/sztzjy/resource_center/mapper/SysObjectiveQuestionsMapper.java b/src/main/java/com/sztzjy/resource_center/mapper/SysObjectiveQuestionsMapper.java index a60edea..4b9c43b 100644 --- a/src/main/java/com/sztzjy/resource_center/mapper/SysObjectiveQuestionsMapper.java +++ b/src/main/java/com/sztzjy/resource_center/mapper/SysObjectiveQuestionsMapper.java @@ -56,5 +56,5 @@ public interface SysObjectiveQuestionsMapper { Map getChooseObjCountAndSorce(@Param("list") List objectIdList); - List selectObjByType(@Param("type") String type,@Param("schoolId") String schoolId); + List selectObjByType(@Param("type") String type,@Param("schoolId") String schoolId); } \ No newline at end of file diff --git a/src/main/resources/mapper/SysObjectiveQuestionsMapper.xml b/src/main/resources/mapper/SysObjectiveQuestionsMapper.xml index 426ff5c..ed20b95 100644 --- a/src/main/resources/mapper/SysObjectiveQuestionsMapper.xml +++ b/src/main/resources/mapper/SysObjectiveQuestionsMapper.xml @@ -487,7 +487,7 @@ - SELECT s.objective_id, s.content, sc.two_name, three_name FROM sys_objective_questions s LEFT JOIN sys_topic_and_course sc From e4f0d58bbc9de4d8a3f831968323f6205673fe07 Mon Sep 17 00:00:00 2001 From: xiaoCJ <406612557@qq.com> Date: Mon, 22 Jul 2024 08:41:13 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sztzjy/resource_center/controller/api/ObjectiveApi.java | 6 ++++-- .../resource_center/mapper/SysObjectiveQuestionsMapper.java | 2 +- src/main/resources/mapper/SysObjectiveQuestionsMapper.xml | 5 ++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/sztzjy/resource_center/controller/api/ObjectiveApi.java b/src/main/java/com/sztzjy/resource_center/controller/api/ObjectiveApi.java index 3d01725..5abd9b7 100644 --- a/src/main/java/com/sztzjy/resource_center/controller/api/ObjectiveApi.java +++ b/src/main/java/com/sztzjy/resource_center/controller/api/ObjectiveApi.java @@ -571,8 +571,10 @@ public class ObjectiveApi { @AnonymousAccess @ApiOperation("获取所选客观题数量及分数") @PostMapping("getChooseObjCountAndSorce") - private Map getChooseObjCountAndSorce(@RequestParam List objectIdList) { - return sysObjectiveQuestionMapper.getChooseObjCountAndSorce(objectIdList); + private Map getChooseObjCountAndSorce(@RequestBody List objectIdList) { + + Map chooseObjCountAndSorce = sysObjectiveQuestionMapper.getChooseObjCountAndSorce(objectIdList); + return chooseObjCountAndSorce; } diff --git a/src/main/java/com/sztzjy/resource_center/mapper/SysObjectiveQuestionsMapper.java b/src/main/java/com/sztzjy/resource_center/mapper/SysObjectiveQuestionsMapper.java index 4b9c43b..7680abc 100644 --- a/src/main/java/com/sztzjy/resource_center/mapper/SysObjectiveQuestionsMapper.java +++ b/src/main/java/com/sztzjy/resource_center/mapper/SysObjectiveQuestionsMapper.java @@ -54,7 +54,7 @@ public interface SysObjectiveQuestionsMapper { void batchDelete(@Param("list") List ids); - Map getChooseObjCountAndSorce(@Param("list") List objectIdList); + Map getChooseObjCountAndSorce(@Param("list") List objectIdList); List selectObjByType(@Param("type") String type,@Param("schoolId") String schoolId); } \ No newline at end of file diff --git a/src/main/resources/mapper/SysObjectiveQuestionsMapper.xml b/src/main/resources/mapper/SysObjectiveQuestionsMapper.xml index ed20b95..eeaf435 100644 --- a/src/main/resources/mapper/SysObjectiveQuestionsMapper.xml +++ b/src/main/resources/mapper/SysObjectiveQuestionsMapper.xml @@ -477,8 +477,8 @@ - + SELECT count(*),sum(score)FROM sys_objective_questions WHERE objective_id IN #{id} @@ -496,5 +496,4 @@ and s.is_delete = FALSE and s.type = #{type} - \ No newline at end of file From 70d1eeb02440c71d3e242ca99228bbc878ebc34e Mon Sep 17 00:00:00 2001 From: xiaoCJ <406612557@qq.com> Date: Mon, 22 Jul 2024 09:46:59 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/api/CaseApi.java | 30 ++++++++++++++++--- .../new_module/admin/AdminDataController.java | 4 +-- .../new_module/stu/StuDataController.java | 6 ++-- 3 files changed, 31 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/sztzjy/resource_center/controller/api/CaseApi.java b/src/main/java/com/sztzjy/resource_center/controller/api/CaseApi.java index 0fc50e1..43c8a8c 100644 --- a/src/main/java/com/sztzjy/resource_center/controller/api/CaseApi.java +++ b/src/main/java/com/sztzjy/resource_center/controller/api/CaseApi.java @@ -98,10 +98,10 @@ public class CaseApi { @ApiOperation("案例题页面查询") @PostMapping("selectCaseList") public PageInfo selectCaseList(@RequestParam Integer index, - @RequestParam Integer size, - @RequestParam(required = false) String keyword, - @RequestParam(required = false) String systemOwner, - @RequestParam(required = false) String schoolId) { + @RequestParam Integer size, + @RequestParam(required = false) String keyword, + @RequestParam(required = false) String systemOwner, + @RequestParam(required = false) String schoolId) { SysOneCatalog sysOneCatalogs = getSysOneCatalogs(systemOwner); String oneId = sysOneCatalogs.getOneId(); List list = caseQuestionMapper.selectCaseByConditions(keyword, oneId, schoolId); @@ -336,4 +336,26 @@ public class CaseApi { String oneId = sysOneCatalogs.getOneId(); return caseQuestionStepMapper.getGradeReportCase(caseIdList, schoolId, oneId); } + + + //根据课程ID查询案例题 + @PostMapping("selectCaseByCourseId") + @ApiOperation("根据课程ID查询案例题") + public List selectCaseByCourseId(@RequestParam String courseId, + @RequestParam String systemOwner, + @RequestParam String schoolId) { + SysOneCatalog sysOneCatalogs = getSysOneCatalogs(systemOwner); + String oneId = sysOneCatalogs.getOneId(); + + SysTopicAndCourseExample example = new SysTopicAndCourseExample(); + example.createCriteria().andTwoIdEqualTo(courseId).andOneIdEqualTo(oneId); + List sysTopicAndCourses = topicAndCourseMapper.selectByExample(example); + + List collect = sysTopicAndCourses.stream().map(SysTopicAndCourse::getTopicId).collect(Collectors.toList()); + + SysCaseQuestionExample example1 = new SysCaseQuestionExample(); + example1.createCriteria().andCaseIdIn(collect).andSourceEqualTo(schoolId); + List list = caseQuestionMapper.selectByExampleWithBLOBs(example1); + return list; + } } diff --git a/src/main/java/com/sztzjy/resource_center/controller/new_module/admin/AdminDataController.java b/src/main/java/com/sztzjy/resource_center/controller/new_module/admin/AdminDataController.java index 798306d..09930b1 100644 --- a/src/main/java/com/sztzjy/resource_center/controller/new_module/admin/AdminDataController.java +++ b/src/main/java/com/sztzjy/resource_center/controller/new_module/admin/AdminDataController.java @@ -10,6 +10,7 @@ import com.sztzjy.resource_center.entity.admin.*; import com.sztzjy.resource_center.mapper.admin.AdminDataLabelMapper; import com.sztzjy.resource_center.mapper.admin.AdminDataMapper; import com.sztzjy.resource_center.mapper.admin.AdminFileMapper; +import com.sztzjy.resource_center.util.PageUtil; import com.sztzjy.resource_center.util.ResultEntity; import com.sztzjy.resource_center.util.file.IFileUtil; import io.swagger.annotations.Api; @@ -162,9 +163,8 @@ public class AdminDataController { @RequestParam(required = false) String keyWord, @ApiParam("精品案例不传,院校案例1") @RequestParam(required = false) String type, @RequestParam(required = false) String labelName) { - PageHelper.startPage(index, size); List adminDataReturnDtos = adminDataMapper.selectByConditions(keyWord, type, labelName); - PageInfo pageInfo = new PageInfo(adminDataReturnDtos); + PageInfo pageInfo = PageUtil.pageHelper(adminDataReturnDtos, index, size); return new ResultEntity<>(pageInfo); } diff --git a/src/main/java/com/sztzjy/resource_center/controller/new_module/stu/StuDataController.java b/src/main/java/com/sztzjy/resource_center/controller/new_module/stu/StuDataController.java index f8c7c34..621c537 100644 --- a/src/main/java/com/sztzjy/resource_center/controller/new_module/stu/StuDataController.java +++ b/src/main/java/com/sztzjy/resource_center/controller/new_module/stu/StuDataController.java @@ -8,6 +8,7 @@ import com.sztzjy.resource_center.entity.admin.*; import com.sztzjy.resource_center.mapper.admin.AdminCollectDataMapper; import com.sztzjy.resource_center.mapper.admin.AdminDataMapper; import com.sztzjy.resource_center.mapper.admin.AdminFileMapper; +import com.sztzjy.resource_center.util.PageUtil; import com.sztzjy.resource_center.util.ResultEntity; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -80,9 +81,8 @@ public class StuDataController { @ApiParam("为空展示所有数据,院校数据传学校ID") @RequestParam(required = false) String source, @ApiParam("收藏案例页面传") @RequestParam(required = false) String userId, @RequestParam(required = false) String labelName) { - PageHelper.startPage(index, size); - List adminDataReturnDtos = adminDataMapper.selectByConditionsBySchoolId(keyWord, source, userId, labelName); - PageInfo pageInfo = new PageInfo(adminDataReturnDtos); + List adminDataReturnDtos = adminDataMapper.selectByConditionsBySchoolId(keyWord, source, userId, labelName); + PageInfo pageInfo = PageUtil.pageHelper(adminDataReturnDtos, index, size); return new ResultEntity>(pageInfo); } } From a980159df93cdf6eaf00edaaadebeb0d7c4a3b25 Mon Sep 17 00:00:00 2001 From: xiaoCJ <406612557@qq.com> Date: Mon, 22 Jul 2024 14:07:46 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=8E=A5=E5=8F=A3,?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=83=A8=E5=88=86=E6=8E=A5=E5=8F=A3=E6=8E=A5?= =?UTF-8?q?=E5=8F=97=E5=8F=82=E6=95=B0=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/api/CaseApi.java | 45 ++++++++++++++----- .../controller/api/CourseApi.java | 6 +-- .../controller/api/ObjectiveApi.java | 2 +- .../controller/api/ResourceApi.java | 17 +++---- .../entity/dto/TrainingDto.java | 24 ++++++++++ .../mapper/SysCaseQuestionStepMapper.java | 3 ++ .../mapper/SysResourceMapper.java | 2 +- .../mapper/SysCaseQuestionStepMapper.xml | 27 +++++++++++ .../resources/mapper/SysResourceMapper.xml | 2 +- 9 files changed, 103 insertions(+), 25 deletions(-) create mode 100644 src/main/java/com/sztzjy/resource_center/entity/dto/TrainingDto.java diff --git a/src/main/java/com/sztzjy/resource_center/controller/api/CaseApi.java b/src/main/java/com/sztzjy/resource_center/controller/api/CaseApi.java index 43c8a8c..ae7c27e 100644 --- a/src/main/java/com/sztzjy/resource_center/controller/api/CaseApi.java +++ b/src/main/java/com/sztzjy/resource_center/controller/api/CaseApi.java @@ -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 selectCaseByChapterId(@RequestParam String threeId) { - SysCaseQuestionExample example = new SysCaseQuestionExample(); + SysTopicAndCourseExample example = new SysTopicAndCourseExample(); example.createCriteria().andThreeIdEqualTo(threeId); - List list = caseQuestionMapper.selectByExample(example); + List sysTopicAndCourses = topicAndCourseMapper.selectByExample(example); + + List collect = sysTopicAndCourses.stream().map(SysTopicAndCourse::getTopicId).collect(Collectors.toList()); + + SysCaseQuestionExample example1 = new SysCaseQuestionExample(); + example1.createCriteria().andCaseIdIn(collect).andSourceEqualTo("管理员"); + List list = caseQuestionMapper.selectByExampleWithBLOBs(example1); return list; } @@ -297,7 +306,8 @@ public class CaseApi { */ @PostMapping("selectCaseStepListBatchByIdListAndSort") @ApiOperation("查询案例题步骤并排序") - public List selectCaseByChapterId(@RequestParam List caseIdList) { + @AnonymousAccess + public List selectCaseStepListBatchByIdListAndSort(@RequestBody List 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 selectCaseByChapterIdList(@RequestParam List chapterIdList) { + @AnonymousAccess + public List selectCaseByChapterIdList(@RequestBody List chapterIdList) { SysTopicAndCourseExample example = new SysTopicAndCourseExample(); example.createCriteria().andThreeIdIn(chapterIdList); List sysTopicAndCourses = topicAndCourseMapper.selectByExample(example); @@ -329,7 +340,8 @@ public class CaseApi { //*考试模式--成绩报告案例题question0riginal所属章节,contentOriginal为考核点数量,Sort为序号 @PostMapping("getGradeReportCase") @ApiOperation("考试模式/成绩报告/案例题") - public List getGradeReportCase(@RequestParam List caseIdList, + @AnonymousAccess + public List getGradeReportCase(@RequestBody List 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 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 sysTopicAndCourses = topicAndCourseMapper.selectByExample(example); + if (!sysTopicAndCourses.isEmpty()) { + List collect = sysTopicAndCourses.stream().map(SysTopicAndCourse::getTopicId).collect(Collectors.toList()); + SysCaseQuestionExample example1 = new SysCaseQuestionExample(); + example1.createCriteria().andCaseIdIn(collect).andSourceEqualTo(schoolId); + List list = caseQuestionMapper.selectByExampleWithBLOBs(example1); + return list; + } + return null; + } - List collect = sysTopicAndCourses.stream().map(SysTopicAndCourse::getTopicId).collect(Collectors.toList()); - - SysCaseQuestionExample example1 = new SysCaseQuestionExample(); - example1.createCriteria().andCaseIdIn(collect).andSourceEqualTo(schoolId); - List list = caseQuestionMapper.selectByExampleWithBLOBs(example1); - return list; + //* 单独接口 +//* 展示案例题详细信息 + @AnonymousAccess + @ApiOperation("展示案例题详细信息") + @PostMapping("selectTrainingByIds") + public List selectTrainingByIds(@RequestBody List caseStepIdList) { + return caseQuestionStepMapper.selectTrainingByIds(caseStepIdList); } } diff --git a/src/main/java/com/sztzjy/resource_center/controller/api/CourseApi.java b/src/main/java/com/sztzjy/resource_center/controller/api/CourseApi.java index eca3040..52e9999 100644 --- a/src/main/java/com/sztzjy/resource_center/controller/api/CourseApi.java +++ b/src/main/java/com/sztzjy/resource_center/controller/api/CourseApi.java @@ -169,7 +169,7 @@ public class CourseApi { @AnonymousAccess @ApiOperation("根据课程IDList查询章节集合并排序") @PostMapping("selectChaptersByCourseIdsAndAsc") - public List selectChaptersByCourseIdsAndAsc(@RequestParam List courseIds) { + public List selectChaptersByCourseIdsAndAsc(@RequestBody List 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); } diff --git a/src/main/java/com/sztzjy/resource_center/controller/api/ObjectiveApi.java b/src/main/java/com/sztzjy/resource_center/controller/api/ObjectiveApi.java index 5abd9b7..de89976 100644 --- a/src/main/java/com/sztzjy/resource_center/controller/api/ObjectiveApi.java +++ b/src/main/java/com/sztzjy/resource_center/controller/api/ObjectiveApi.java @@ -347,7 +347,7 @@ public class ObjectiveApi { @AnonymousAccess @ApiOperation("根据客观题IDList批量查询客观题") @PostMapping("selectBatchByIdList") - private List selectBatchByIdList(@RequestParam List objectIdList) { + private List selectBatchByIdList(@RequestBody List objectIdList) { SysObjectiveQuestionsExample example = new SysObjectiveQuestionsExample(); example.createCriteria().andObjectiveIdIn(objectIdList); List sysObjectiveQuestions = sysObjectiveQuestionMapper.selectByExample(example); diff --git a/src/main/java/com/sztzjy/resource_center/controller/api/ResourceApi.java b/src/main/java/com/sztzjy/resource_center/controller/api/ResourceApi.java index 0f735ad..ecb7c2a 100644 --- a/src/main/java/com/sztzjy/resource_center/controller/api/ResourceApi.java +++ b/src/main/java/com/sztzjy/resource_center/controller/api/ResourceApi.java @@ -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 getResourceTypeCount(@RequestParam String systemOwner, - @RequestParam String schoolId) { + public Map getResourceTypeCount(@RequestParam String systemOwner, + @RequestParam String schoolId) { SysOneCatalog sysOneCatalogs = getSysOneCatalogs(systemOwner); SysResourceAndCourseExample example = new SysResourceAndCourseExample(); example.createCriteria().andOneIdEqualTo(sysOneCatalogs.getOneId()); List sysResourceAndCourses = sysResourceAndCourseMapper.selectByExample(example); List ids = sysResourceAndCourses.stream().map(SysResourceAndCourse::getResourceId).collect(Collectors.toList()); - return sysResourceMapper.getCountByType(ids, schoolId); + List> countByType = sysResourceMapper.getCountByType(ids, schoolId); + Map resultMap = new HashMap<>(); + for (Map 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(); } - } diff --git a/src/main/java/com/sztzjy/resource_center/entity/dto/TrainingDto.java b/src/main/java/com/sztzjy/resource_center/entity/dto/TrainingDto.java new file mode 100644 index 0000000..ea0ecb0 --- /dev/null +++ b/src/main/java/com/sztzjy/resource_center/entity/dto/TrainingDto.java @@ -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; +} diff --git a/src/main/java/com/sztzjy/resource_center/mapper/SysCaseQuestionStepMapper.java b/src/main/java/com/sztzjy/resource_center/mapper/SysCaseQuestionStepMapper.java index e7204bb..a119cef 100644 --- a/src/main/java/com/sztzjy/resource_center/mapper/SysCaseQuestionStepMapper.java +++ b/src/main/java/com/sztzjy/resource_center/mapper/SysCaseQuestionStepMapper.java @@ -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 getGradeReportCase(@Param("list") List caseIdList, @Param("schoolId") String schoolId, @Param("oneId") String oneId); + + List selectTrainingByIds(@Param("list") List caseStepIdList); } \ No newline at end of file diff --git a/src/main/java/com/sztzjy/resource_center/mapper/SysResourceMapper.java b/src/main/java/com/sztzjy/resource_center/mapper/SysResourceMapper.java index 65f3d3f..72b14a3 100644 --- a/src/main/java/com/sztzjy/resource_center/mapper/SysResourceMapper.java +++ b/src/main/java/com/sztzjy/resource_center/mapper/SysResourceMapper.java @@ -45,7 +45,7 @@ public interface SysResourceMapper { @Param("threeId") String threeId, @Param("resourceName") String resourceName); - Map getCountByType(@Param("list") List ids, @Param("schoolId") String schoolId); + List> getCountByType(@Param("list") List ids, @Param("schoolId") String schoolId); @Select("SELECT resource_name FROM `sys_resource` ORDER BY count desc") String getMostPopularName(); diff --git a/src/main/resources/mapper/SysCaseQuestionStepMapper.xml b/src/main/resources/mapper/SysCaseQuestionStepMapper.xml index 601126f..df3d6d2 100644 --- a/src/main/resources/mapper/SysCaseQuestionStepMapper.xml +++ b/src/main/resources/mapper/SysCaseQuestionStepMapper.xml @@ -409,4 +409,31 @@ and s2.unmount_status is FALSE GROUP BY s2.title, s3.three_name + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/mapper/SysResourceMapper.xml b/src/main/resources/mapper/SysResourceMapper.xml index fe824d1..18c5bf4 100644 --- a/src/main/resources/mapper/SysResourceMapper.xml +++ b/src/main/resources/mapper/SysResourceMapper.xml @@ -440,7 +440,7 @@ #{item} - AND source = #{schoolId} + AND source in (#{schoolId},'管理员') GROUP BY resource_type From b730e0adf4e27292ddf05195af5aff55071e0a74 Mon Sep 17 00:00:00 2001 From: xiaoCJ <406612557@qq.com> Date: Mon, 22 Jul 2024 14:44:09 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=8E=A5=E5=8F=A3,?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=83=A8=E5=88=86=E6=8E=A5=E5=8F=A3=E6=8E=A5?= =?UTF-8?q?=E5=8F=97=E5=8F=82=E6=95=B0=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sztzjy/resource_center/controller/api/CaseApi.java | 3 ++- src/main/resources/mapper/SysCaseQuestionStepMapper.xml | 9 +++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/sztzjy/resource_center/controller/api/CaseApi.java b/src/main/java/com/sztzjy/resource_center/controller/api/CaseApi.java index ae7c27e..cdc2f25 100644 --- a/src/main/java/com/sztzjy/resource_center/controller/api/CaseApi.java +++ b/src/main/java/com/sztzjy/resource_center/controller/api/CaseApi.java @@ -379,6 +379,7 @@ public class CaseApi { @ApiOperation("展示案例题详细信息") @PostMapping("selectTrainingByIds") public List selectTrainingByIds(@RequestBody List caseStepIdList) { - return caseQuestionStepMapper.selectTrainingByIds(caseStepIdList); + List trainingDtos = caseQuestionStepMapper.selectTrainingByIds(caseStepIdList); + return trainingDtos; } } diff --git a/src/main/resources/mapper/SysCaseQuestionStepMapper.xml b/src/main/resources/mapper/SysCaseQuestionStepMapper.xml index df3d6d2..fd39172 100644 --- a/src/main/resources/mapper/SysCaseQuestionStepMapper.xml +++ b/src/main/resources/mapper/SysCaseQuestionStepMapper.xml @@ -421,18 +421,15 @@