diff --git a/src/main/java/com/teaching/backend/service/impl/courses/CoursesServiceImpl.java b/src/main/java/com/teaching/backend/service/impl/courses/CoursesServiceImpl.java index 326939e..d4e4a57 100644 --- a/src/main/java/com/teaching/backend/service/impl/courses/CoursesServiceImpl.java +++ b/src/main/java/com/teaching/backend/service/impl/courses/CoursesServiceImpl.java @@ -37,6 +37,7 @@ import org.springframework.util.ResourceUtils; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; import java.io.File; +import java.io.FileInputStream; import java.math.BigDecimal; import java.time.LocalDateTime; import java.util.*; @@ -322,6 +323,10 @@ public class CoursesServiceImpl extends ServiceImpl impl public void down(HttpServletResponse response, String id) throws Exception { File rootPath = new File(ResourceUtils.getURL("classpath:").getPath()); //SpringBoot项目获取根目录的方式 File templatePath = new File(rootPath.getAbsolutePath(),"/templates/courses.docx");//------------------需要模板的地址 + // 加载Word模板 + FileInputStream template = new FileInputStream("/templates/courses.docx"); + XWPFDocument document = new XWPFDocument(template); + //准备导出数据 //查询课程通过课程id查--课程简介 Courses courses = this.getById(id); diff --git a/src/main/java/com/teaching/backend/service/impl/records/LearningRecordsServiceImpl.java b/src/main/java/com/teaching/backend/service/impl/records/LearningRecordsServiceImpl.java index c27b144..59e6607 100644 --- a/src/main/java/com/teaching/backend/service/impl/records/LearningRecordsServiceImpl.java +++ b/src/main/java/com/teaching/backend/service/impl/records/LearningRecordsServiceImpl.java @@ -9,6 +9,7 @@ import com.teaching.backend.mapper.records.LearningRecordsMapper; import com.teaching.backend.model.entity.records.LearningRecords; import com.teaching.backend.model.vo.records.LearningRecordsVo; +import com.teaching.backend.service.impl.CourseResourcesServiceImpl; import com.teaching.backend.service.impl.chapter.ChapterServiceImpl; import com.teaching.backend.service.impl.courses.CoursesServiceImpl; import com.teaching.backend.service.impl.know.KnowServiceimpl; @@ -31,8 +32,8 @@ public class LearningRecordsServiceImpl extends ServiceImpl lambdaQueryWrapper = new LambdaQueryWrapper<>();