新增课程系列API
parent
d2a134b976
commit
ce8eb9ae1c
@ -0,0 +1,62 @@
|
||||
package com.sztzjy.resource_center.controller.api;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.sztzjy.resource_center.annotation.AnonymousAccess;
|
||||
import com.sztzjy.resource_center.config.Constant;
|
||||
import com.sztzjy.resource_center.entity.*;
|
||||
import com.sztzjy.resource_center.mapper.SysOneCatalogMapper;
|
||||
import com.sztzjy.resource_center.mapper.SysThreeCatalogMapper;
|
||||
import com.sztzjy.resource_center.mapper.SysTwoCatalogMapper;
|
||||
import com.sztzjy.resource_center.util.ResultEntity;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@Api(tags = "课程方面API")
|
||||
@RequestMapping("api/sys/courseApi")
|
||||
public class CourseApi {
|
||||
@Autowired
|
||||
SysTwoCatalogMapper twoCatalogMapper;
|
||||
@Autowired
|
||||
SysOneCatalogMapper oneCatalogMapper;
|
||||
@Autowired
|
||||
SysThreeCatalogMapper threeCatalogMapper;
|
||||
|
||||
@AnonymousAccess
|
||||
@ApiOperation("查看二级目录")
|
||||
@PostMapping("getAllTwoCatalogList")
|
||||
public List<SysTwoCatalog> getAllTwoCatalogList(@RequestParam String schoolId,@RequestParam String systemOwner) {
|
||||
SysOneCatalogExample sysOneCatalogExample = new SysOneCatalogExample();
|
||||
sysOneCatalogExample.createCriteria().andOneNameEqualTo(systemOwner);
|
||||
SysOneCatalog sysOneCatalog = oneCatalogMapper.selectByExample(sysOneCatalogExample).get(0);
|
||||
SysTwoCatalogExample example = new SysTwoCatalogExample();
|
||||
SysTwoCatalogExample.Criteria criteria = example.createCriteria();
|
||||
ArrayList<String> list = new ArrayList<>();
|
||||
list.add(schoolId);
|
||||
list.add(Constant.ADMIN);
|
||||
criteria.andCreatorIn(list);
|
||||
criteria.andOneIdEqualTo(sysOneCatalog.getOneId());
|
||||
example.setOrderByClause("sort ASC");
|
||||
List<SysTwoCatalog> sysTwoCatalogs = twoCatalogMapper.selectByExample(example);
|
||||
return sysTwoCatalogs;
|
||||
}
|
||||
|
||||
@PostMapping("selectThreeCatalogListByTwoId")
|
||||
@ApiOperation("根据二级目录ID查寻所有三级目录信息")
|
||||
@AnonymousAccess
|
||||
public List<SysThreeCatalog> selectChapterByCourseId(@RequestParam String twoId){
|
||||
SysThreeCatalogExample example = new SysThreeCatalogExample();
|
||||
example.createCriteria().andTwoIdEqualTo(twoId);
|
||||
example.setOrderByClause("sort asc");
|
||||
List<SysThreeCatalog> sysThreeCatalogs = threeCatalogMapper.selectByExample(example);
|
||||
return sysThreeCatalogs;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue