|
@@ -15,6 +15,7 @@ import com.xjrsoft.module.base.dto.*;
|
|
import com.xjrsoft.module.base.entity.*;
|
|
import com.xjrsoft.module.base.entity.*;
|
|
import com.xjrsoft.module.base.service.IBaseClassCourseService;
|
|
import com.xjrsoft.module.base.service.IBaseClassCourseService;
|
|
import com.xjrsoft.module.base.service.impl.BaseCourseSubjectServiceImpl;
|
|
import com.xjrsoft.module.base.service.impl.BaseCourseSubjectServiceImpl;
|
|
|
|
+import com.xjrsoft.module.base.vo.BaseClassCourseExportListVo;
|
|
import com.xjrsoft.module.base.vo.BaseClassCourseListVo;
|
|
import com.xjrsoft.module.base.vo.BaseClassCourseListVo;
|
|
import com.xjrsoft.module.base.vo.BaseClassCoursePageVo;
|
|
import com.xjrsoft.module.base.vo.BaseClassCoursePageVo;
|
|
import com.xjrsoft.module.base.vo.BaseClassCourseVo;
|
|
import com.xjrsoft.module.base.vo.BaseClassCourseVo;
|
|
@@ -231,10 +232,24 @@ public class BaseClassCourseController {
|
|
|
|
|
|
@GetMapping("/export")
|
|
@GetMapping("/export")
|
|
@ApiOperation(value = "导出")
|
|
@ApiOperation(value = "导出")
|
|
- public ResponseEntity<byte[]> exportData(@Valid BaseClassCoursePageDto dto, @RequestParam(defaultValue = "false") Boolean isTemplate) {
|
|
|
|
- List<BaseClassCoursePageVo> customerList = isTemplate != null && isTemplate ? new ArrayList<>() : ((PageOutput<BaseClassCoursePageVo>) page(dto).getData()).getList();
|
|
|
|
|
|
+ public ResponseEntity<byte[]> exportData() {
|
|
|
|
+ MPJLambdaWrapper<BaseClassCourse> baseClassCourseMPJLambdaWrapper = new MPJLambdaWrapper<>();
|
|
|
|
+ baseClassCourseMPJLambdaWrapper
|
|
|
|
+ .select(BaseClassCourse::getCourseId)
|
|
|
|
+ .selectAs(BaseClass::getName, BaseClassCourseExportListVo::getClassIdCn)
|
|
|
|
+ .selectAs(BaseCourseSubject::getName, BaseClassCourseExportListVo::getCourseIdCn)
|
|
|
|
+ .selectAs(Textbook::getBookName, BaseClassCourseExportListVo::getTextbookIdCn)
|
|
|
|
+ .selectAs(BaseSemester::getName, BaseClassCourseExportListVo::getBaseSemesterIdCn)
|
|
|
|
+ .select(BaseClassCourse.class, x -> VoToColumnUtil.fieldsToColumns(BaseClassCourseExportListVo.class).contains(x.getProperty()))
|
|
|
|
+ .leftJoin(BaseClass.class, BaseClass::getId, BaseClassCourse::getClassId)
|
|
|
|
+ .leftJoin(BaseCourseSubject.class, BaseCourseSubject::getId, BaseClassCourse::getCourseId)
|
|
|
|
+ .leftJoin(Textbook.class, Textbook::getId, BaseClassCourse::getTextbookId)
|
|
|
|
+ .leftJoin(BaseSemester.class, BaseSemester::getId, BaseClassCourse::getBaseSemesterId)
|
|
|
|
+ ;
|
|
|
|
+
|
|
|
|
+ List<BaseClassCourseExportListVo> customerList = baseClassCourseService.selectJoinList(BaseClassCourseExportListVo.class, baseClassCourseMPJLambdaWrapper);
|
|
ByteArrayOutputStream bot = new ByteArrayOutputStream();
|
|
ByteArrayOutputStream bot = new ByteArrayOutputStream();
|
|
- EasyExcel.write(bot, BaseClassCoursePageVo.class).automaticMergeHead(false).excelType(ExcelTypeEnum.XLSX).sheet().doWrite(customerList);
|
|
|
|
|
|
+ EasyExcel.write(bot, BaseClassCourseExportListVo.class).automaticMergeHead(false).excelType(ExcelTypeEnum.XLSX).sheet().doWrite(customerList);
|
|
|
|
|
|
return RT.fileStream(bot.toByteArray(), "BaseClassCourse" + ExcelTypeEnum.XLSX.getValue());
|
|
return RT.fileStream(bot.toByteArray(), "BaseClassCourse" + ExcelTypeEnum.XLSX.getValue());
|
|
}
|
|
}
|