From 93b1b0778a26c4c4d56f85607d05ef86fddef6f1 Mon Sep 17 00:00:00 2001 From: xiaoCJ <406612557@qq.com> Date: Thu, 31 Oct 2024 11:44:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=80=81=E5=B8=88=E7=AB=AF?= =?UTF-8?q?=E5=AE=A2=E8=A7=82=E9=A2=98=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/api/ObjectiveApi.java | 18 +++++++++--------- .../controller/api/ResourceApi.java | 3 ++- .../mapper/SysObjectiveQuestionsMapper.java | 5 +++-- .../mapper/SysObjectiveQuestionsMapper.xml | 1 + 4 files changed, 15 insertions(+), 12 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 b748185..2e9e887 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 @@ -257,8 +257,8 @@ public class ObjectiveApi { @ApiOperation("本地excel导入试题") @PostMapping("insertObjectiveByExcel") @Transactional - Boolean importTopicByLocal(@RequestParam MultipartFile file, - @RequestParam String schoolId) throws IOException, InvalidFormatException { + Boolean importTopicByLocal(@RequestParam MultipartFile file, + @RequestParam String schoolId) throws IOException, InvalidFormatException { if (file == null) { return false; } @@ -428,10 +428,10 @@ public class ObjectiveApi { @ApiOperation("根据客观题IDList批量查询客观题") @PostMapping("selectBatchByIdList") private List selectBatchByIdList(@RequestBody List objectIdList) { - SysObjectiveQuestionsExample example = new SysObjectiveQuestionsExample(); - example.createCriteria().andObjectiveIdIn(objectIdList); - List sysObjectiveQuestions = sysObjectiveQuestionMapper.selectByExample(example); - return sysObjectiveQuestions; + SysObjectiveQuestionsExample example = new SysObjectiveQuestionsExample(); + example.createCriteria().andObjectiveIdIn(objectIdList); + List sysObjectiveQuestions = sysObjectiveQuestionMapper.selectByExample(example); + return sysObjectiveQuestions; } /** @@ -652,7 +652,6 @@ public class ObjectiveApi { @ApiOperation("获取所选客观题数量及分数") @PostMapping("getChooseObjCountAndSorce") private Map getChooseObjCountAndSorce(@RequestBody List objectIdList) { - Map chooseObjCountAndSorce = sysObjectiveQuestionMapper.getChooseObjCountAndSorce(objectIdList); return chooseObjCountAndSorce; } @@ -665,8 +664,9 @@ public class ObjectiveApi { private List selectObjByType(@RequestParam String type, @RequestParam String schoolId, @RequestParam String systemOwner) { - List sysObjectiveQuestionsDtos = sysObjectiveQuestionMapper.selectObjByType(type, schoolId); - + SysOneCatalog sysOneCatalogs = getSysOneCatalogs(systemOwner); + String oneId = sysOneCatalogs.getOneId(); + List sysObjectiveQuestionsDtos = sysObjectiveQuestionMapper.selectObjByType(type, schoolId, oneId); return sysObjectiveQuestionsDtos; } } 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 26aeb31..5fec2e1 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 @@ -145,7 +145,8 @@ public class ResourceApi { public List selectResourceByChapterId(@RequestParam String oneId, //这里传的是一级的名称 @RequestParam(required = false) String threeId) { SysOneCatalog sysOneCatalogs = getSysOneCatalogs(oneId); - return sysResourceMapper.selectResource(sysOneCatalogs.getOneId(), null, threeId, null, null); + List sysResourceDtos = sysResourceMapper.selectResource(sysOneCatalogs.getOneId(), null, threeId, null, null); + return sysResourceDtos; } 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 7680abc..adb8be1 100644 --- a/src/main/java/com/sztzjy/resource_center/mapper/SysObjectiveQuestionsMapper.java +++ b/src/main/java/com/sztzjy/resource_center/mapper/SysObjectiveQuestionsMapper.java @@ -5,7 +5,6 @@ import com.sztzjy.resource_center.entity.SysObjectiveQuestionsExample; import com.sztzjy.resource_center.entity.dto.SysObjectiveQuestionsDto; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; -import org.apache.ibatis.annotations.Select; import java.math.BigDecimal; import java.util.List; @@ -56,5 +55,7 @@ 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, + @Param("oneId") String oneId); } \ No newline at end of file diff --git a/src/main/resources/mapper/SysObjectiveQuestionsMapper.xml b/src/main/resources/mapper/SysObjectiveQuestionsMapper.xml index 458f62f..b8d96a3 100644 --- a/src/main/resources/mapper/SysObjectiveQuestionsMapper.xml +++ b/src/main/resources/mapper/SysObjectiveQuestionsMapper.xml @@ -492,6 +492,7 @@ FROM sys_objective_questions s JOIN sys_topic_and_course sc on s.objective_id = sc.topic_id WHERE s.source in ('管理员', #{schoolId}) + and sc.one_id = #{oneId} and s.is_delete = FALSE and s.type = #{type}