|
|
@ -2,10 +2,7 @@ package com.sztzjy.resource_center.controller.api;
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
|
import com.sztzjy.resource_center.annotation.AnonymousAccess;
|
|
|
|
import com.sztzjy.resource_center.annotation.AnonymousAccess;
|
|
|
|
import com.sztzjy.resource_center.entity.SysOneCatalog;
|
|
|
|
import com.sztzjy.resource_center.entity.*;
|
|
|
|
import com.sztzjy.resource_center.entity.SysOneCatalogExample;
|
|
|
|
|
|
|
|
import com.sztzjy.resource_center.entity.SysResource;
|
|
|
|
|
|
|
|
import com.sztzjy.resource_center.entity.SysResourceAndCourse;
|
|
|
|
|
|
|
|
import com.sztzjy.resource_center.entity.dto.SysResourceDto;
|
|
|
|
import com.sztzjy.resource_center.entity.dto.SysResourceDto;
|
|
|
|
import com.sztzjy.resource_center.mapper.SysCaseQuestionMapper;
|
|
|
|
import com.sztzjy.resource_center.mapper.SysCaseQuestionMapper;
|
|
|
|
import com.sztzjy.resource_center.mapper.SysOneCatalogMapper;
|
|
|
|
import com.sztzjy.resource_center.mapper.SysOneCatalogMapper;
|
|
|
@ -21,8 +18,11 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
|
|
@RestController
|
|
|
|
@RestController
|
|
|
|
@Api(tags = "资源方面API")
|
|
|
|
@Api(tags = "资源方面API")
|
|
|
@ -151,6 +151,19 @@ public class ResourceApi {
|
|
|
|
* 参数:schoolId systemOwner
|
|
|
|
* 参数:schoolId systemOwner
|
|
|
|
* return: Map<String,Integer> 课件:121
|
|
|
|
* return: Map<String,Integer> 课件:121
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
@AnonymousAccess
|
|
|
|
|
|
|
|
@ApiOperation("获取资源类型数量")
|
|
|
|
|
|
|
|
@PostMapping("getResourceTypeCount")
|
|
|
|
|
|
|
|
public Map<String, Integer> getResourceTypeCount(@RequestParam String systemOwner,
|
|
|
|
|
|
|
|
@RequestParam String schoolId) {
|
|
|
|
|
|
|
|
SysOneCatalog sysOneCatalogs = getSysOneCatalogs(systemOwner);
|
|
|
|
|
|
|
|
SysResourceAndCourseExample example = new SysResourceAndCourseExample();
|
|
|
|
|
|
|
|
example.createCriteria().andOneIdEqualTo(sysOneCatalogs.getOneId());
|
|
|
|
|
|
|
|
List<SysResourceAndCourse> sysResourceAndCourses = sysResourceAndCourseMapper.selectByExample(example);
|
|
|
|
|
|
|
|
List<String> ids = sysResourceAndCourses.stream().map(SysResourceAndCourse::getResourceId).collect(Collectors.toList());
|
|
|
|
|
|
|
|
return sysResourceMapper.getCountByType(ids, schoolId);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 获取该系统下 学校上传和内置的全部资源数量
|
|
|
|
* 获取该系统下 学校上传和内置的全部资源数量
|
|
|
@ -158,6 +171,24 @@ public class ResourceApi {
|
|
|
|
* 参数:systemOwner schoolId
|
|
|
|
* 参数:systemOwner schoolId
|
|
|
|
* return: Integer
|
|
|
|
* return: Integer
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
@AnonymousAccess
|
|
|
|
|
|
|
|
@ApiOperation("获取该系统下 学校上传和内置的全部资源数量")
|
|
|
|
|
|
|
|
@PostMapping("getTotalResource")
|
|
|
|
|
|
|
|
public Integer getTotalResource(@RequestParam String systemOwner,
|
|
|
|
|
|
|
|
@RequestParam String schoolId) {
|
|
|
|
|
|
|
|
SysOneCatalog sysOneCatalogs = getSysOneCatalogs(systemOwner);
|
|
|
|
|
|
|
|
SysResourceAndCourseExample example = new SysResourceAndCourseExample();
|
|
|
|
|
|
|
|
example.createCriteria().andOneIdEqualTo(sysOneCatalogs.getOneId());
|
|
|
|
|
|
|
|
List<SysResourceAndCourse> sysResourceAndCourses = sysResourceAndCourseMapper.selectByExample(example);
|
|
|
|
|
|
|
|
List<String> ids = sysResourceAndCourses.stream().map(SysResourceAndCourse::getResourceId).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<String> list = Arrays.asList(schoolId, "管理员");
|
|
|
|
|
|
|
|
SysResourceExample example1 = new SysResourceExample();
|
|
|
|
|
|
|
|
example1.createCriteria().andResourceIdIn(ids).andResourceIdIn(list);
|
|
|
|
|
|
|
|
List<SysResource> sysResources = sysResourceMapper.selectByExample(example1);
|
|
|
|
|
|
|
|
return sysResources.size();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 获取最受欢迎的资源名称
|
|
|
|
* 获取最受欢迎的资源名称
|
|
|
|