新增三方接口,修改bug
parent
19c8409164
commit
b976826f0f
@ -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<SysOneCatalog> 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<SysKnowledgeSummary> sysKnowledgeSummaries = knowledgeSummaryMapper.selectByExampleWithBLOBs(example);
|
||||
if (sysKnowledgeSummaries != null && !sysKnowledgeSummaries.isEmpty()) {
|
||||
return sysKnowledgeSummaries.get(0);
|
||||
} else return null;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue