|
@@ -3,9 +3,12 @@ package cn.com.qmth.examcloud.service.core.api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
|
|
+import java.util.ArrayList;
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
|
+
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.http.HttpStatus;
|
|
import org.springframework.http.HttpStatus;
|
|
import org.springframework.http.ResponseEntity;
|
|
import org.springframework.http.ResponseEntity;
|
|
@@ -21,9 +24,12 @@ import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import cn.com.qmth.examcloud.common.util.excel.ExcelError;
|
|
import cn.com.qmth.examcloud.common.util.excel.ExcelError;
|
|
|
|
+import cn.com.qmth.examcloud.service.core.assemble.CourseAssembler;
|
|
|
|
+import cn.com.qmth.examcloud.service.core.dto.CourseDTO;
|
|
import cn.com.qmth.examcloud.service.core.entity.Course;
|
|
import cn.com.qmth.examcloud.service.core.entity.Course;
|
|
import cn.com.qmth.examcloud.service.core.repo.CourseRepo;
|
|
import cn.com.qmth.examcloud.service.core.repo.CourseRepo;
|
|
import cn.com.qmth.examcloud.service.core.service.CourseService;
|
|
import cn.com.qmth.examcloud.service.core.service.CourseService;
|
|
|
|
+import cn.com.qmth.examcloud.service.core.util.ExportUtils;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 课程服务API
|
|
* 课程服务API
|
|
@@ -35,9 +41,10 @@ public class CourseApi {
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
CourseRepo courseRepo;
|
|
CourseRepo courseRepo;
|
|
-
|
|
|
|
@Autowired
|
|
@Autowired
|
|
CourseService courseService;
|
|
CourseService courseService;
|
|
|
|
+ @Autowired
|
|
|
|
+ CourseAssembler courseAssembler;
|
|
|
|
|
|
@ApiOperation(value="查询所有课程",notes="enable为查询条件,可为空")
|
|
@ApiOperation(value="查询所有课程",notes="enable为查询条件,可为空")
|
|
@GetMapping
|
|
@GetMapping
|
|
@@ -88,4 +95,14 @@ public class CourseApi {
|
|
return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR);
|
|
return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @ApiOperation(value="导出课程",notes = "导出")
|
|
|
|
+ @GetMapping("/export")
|
|
|
|
+ public void exportCourse(@RequestParam Long orgId,HttpServletResponse response){
|
|
|
|
+ List<CourseDTO> list = new ArrayList<CourseDTO>();
|
|
|
|
+ courseRepo.findByOrgId(orgId).forEach(c -> {
|
|
|
|
+ list.add(courseAssembler.toDTO(c));
|
|
|
|
+ });
|
|
|
|
+ ExportUtils.exportEXCEL("课程列表", CourseDTO.class, list, response);
|
|
|
|
+ }
|
|
}
|
|
}
|