李林
2023-10-07 658d4927d468c47208fd012d9128b09249c07eff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package com.chinaztt.mes.report.service;
 
import com.baomidou.mybatisplus.extension.service.IService;
import com.chinaztt.mes.report.entity.Template;
 
import java.util.Map;
 
 
/**
 * @Author: zhangxy
 * @Date: 2021-06-03 11:08
 */
 
public interface JasperReportService extends IService<Template> {
 
    /**
     * 报表类型
     */
    enum ReportType {
        /**
         * PDF
         */
        PDF("application/pdf", "pdf"),
        /**
         * CSV
         */
        CSV("text/csv", "csv"),
        /**
         * XLS
         */
        XLS("application/vnd.ms-excel", "xls"),
        /**
         * XLSX
         */
        XLSX("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "xlsx");
 
        private final String mimeType;
 
        private final String extension;
 
        ReportType(final String mimeType, final String extension) {
            this.mimeType = mimeType;
            this.extension = extension;
        }
 
        public String getMimeType() {
            return mimeType;
        }
 
        public String getExtension() {
            return extension;
        }
    }
 
 
    /**
     * 根据类型生成报表
     * @param templatePath
     * @param type
     * @param params
     * @return
     */
    public byte[] gen(final String templatePath, final ReportType type, final Map<String, Object> params);
}