diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/pdf/PdfUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/pdf/PdfUtils.java index a70d983..db00422 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/pdf/PdfUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/pdf/PdfUtils.java @@ -12,6 +12,7 @@ import com.ruoyi.common.core.domain.pdf.PdfProperty; import com.ruoyi.common.core.domain.pdf.ShoulderItem; import com.ruoyi.common.utils.StringUtils; import lombok.extern.slf4j.Slf4j; +import org.springframework.http.MediaType; import javax.servlet.http.HttpServletResponse; import java.io.ByteArrayOutputStream; @@ -94,9 +95,11 @@ public class PdfUtils { // 5. 关闭文档 document.close(); // 6. 将PDF输出到浏览器 - response.setContentType("application/pdf"); + response.setContentType(MediaType.APPLICATION_PDF_VALUE); response.setCharacterEncoding("utf-8"); response.setContentLength(baos.size()); + response.setHeader("Pragma", "public"); + response.setHeader("Cache-Control", "public, must-revalidate"); response.setHeader("Content-Disposition", "inline; filename=example.pdf"); response.getOutputStream().write(baos.toByteArray()); response.getOutputStream().flush(); diff --git a/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm b/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm index 5f140f0..aa62209 100644 --- a/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm +++ b/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm @@ -105,9 +105,9 @@ - - - + + + #foreach($column in $columns) #set($javaField=$column.javaField) #set($parentheseIndex=$column.columnComment.indexOf("("))