diff --git a/src/main/java/com/sztzjy/resource_center/controller/api/SysKnowledgeSummaryApi.java b/src/main/java/com/sztzjy/resource_center/controller/api/SysKnowledgeSummaryApi.java new file mode 100644 index 0000000..ecd0138 --- /dev/null +++ b/src/main/java/com/sztzjy/resource_center/controller/api/SysKnowledgeSummaryApi.java @@ -0,0 +1,58 @@ +package com.sztzjy.resource_center.controller.api; + +import com.sztzjy.resource_center.annotation.AnonymousAccess; +import com.sztzjy.resource_center.entity.SysKnowledgeSummary; +import com.sztzjy.resource_center.entity.SysKnowledgeSummaryExample; +import com.sztzjy.resource_center.entity.SysOneCatalog; +import com.sztzjy.resource_center.entity.SysOneCatalogExample; +import com.sztzjy.resource_center.mapper.SysKnowledgeSummaryMapper; +import com.sztzjy.resource_center.mapper.SysOneCatalogMapper; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + * @Author xcj + * @Date 2024/7/19 + */ +@RestController +@Api(tags = "知识概要API") +@RequestMapping("/api/stu/knowledgeNote") +public class SysKnowledgeSummaryApi { + @Autowired + private SysKnowledgeSummaryMapper knowledgeSummaryMapper; + @Autowired + private SysOneCatalogMapper oneCatalogMapper; + + private SysOneCatalog getSysOneCatalogs(String systemOwner) { + SysOneCatalogExample example = new SysOneCatalogExample(); + example.createCriteria().andOneNameEqualTo(systemOwner); + List sysOneCatalogs = oneCatalogMapper.selectByExample(example); + return sysOneCatalogs.get(0); + } + + + @AnonymousAccess + @ApiOperation("getSysKnowledgeSummary") + @PostMapping("uploadResourceData") + private SysKnowledgeSummary getSysKnowledgeSummary(@RequestParam String schoolId, + @RequestParam String systemOwner, + @RequestParam String courseId, + @RequestParam String chapterId) { + SysOneCatalog sysOneCatalogs = getSysOneCatalogs(systemOwner); + String oneId = sysOneCatalogs.getOneId(); + SysKnowledgeSummaryExample example = new SysKnowledgeSummaryExample(); + SysKnowledgeSummaryExample.Criteria criteria = example.createCriteria(); + criteria.andOneTagIdEqualTo(oneId).andThreeTagIdEqualTo(chapterId).andTwoTagIdEqualTo(courseId); + List sysKnowledgeSummaries = knowledgeSummaryMapper.selectByExampleWithBLOBs(example); + if (sysKnowledgeSummaries != null && !sysKnowledgeSummaries.isEmpty()) { + return sysKnowledgeSummaries.get(0); + } else return null; + } +} \ No newline at end of file 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 cced201..d06ad4a 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 @@ -229,7 +229,7 @@ public class AdminCaseController { private ResultEntity> get(@RequestParam Integer index, @RequestParam Integer size, @RequestParam(required = false) String keyWord, - @ApiParam("精品案例不传,院校案例传学校ID") @RequestParam(required = false) String source, + @ApiParam("精品案例不传,院校案例传'院校案例'") @RequestParam(required = false) String source, @RequestParam(required = false) String labelName) { PageHelper.startPage(index, size); List adminCaseReturnDtos = adminCaseMapper.selectByConditions(keyWord, source, labelName); 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 2a6e46f..d77b398 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 @@ -71,7 +71,7 @@ public class StuCaseController { private ResultEntity> get(@RequestParam Integer index, @RequestParam Integer size, @RequestParam(required = false) String keyWord, - @ApiParam("精品案例不传,院校案例传学校ID") @RequestParam(required = false) String source, + @ApiParam("精品案例传管理员,院校案例传学校ID") @RequestParam(required = false) String source, @ApiParam("收藏案例页面传") @RequestParam(required = false) String userId, @RequestParam(required = false) String labelName) { diff --git a/src/main/resources/mapper/AdminCaseMapper.xml b/src/main/resources/mapper/AdminCaseMapper.xml index d6a1667..fc74d2e 100644 --- a/src/main/resources/mapper/AdminCaseMapper.xml +++ b/src/main/resources/mapper/AdminCaseMapper.xml @@ -386,8 +386,11 @@ and ad.name = #{labelName} - - and a.source !='管理员' + + and a.source = #{source} + + + and a.source in (#{source},'管理员') and acc.user_id = #{userId}