Search in sources :

Example 1 with ExportParams

use of cn.afterturn.easypoi.excel.entity.ExportParams in project my_curd by qinyou.

the class SysVisitLogController method exportExcel.

/**
 * 导出excel
 */
@RequirePermission("sysVisitLog:export")
@Before(SearchSql.class)
public void exportExcel() {
    String where = getAttr(Constant.SEARCH_SQL);
    if (SysVisitLog.dao.findCountByWhere(where) > 50000) {
        setAttr("msg", "一次导出数据不可大于 5W 条,请修改查询条件。");
        render("common/card.ftl");
        return;
    }
    // 测试大数据量导出
    List<SysVisitLog> list = SysVisitLog.dao.findByWhere(where);
    Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams("访问日志", "访问日志"), SysVisitLog.class, list);
    render(ExcelRender.me(workbook).fileName("访问日志.xls"));
}
Also used : ExportParams(cn.afterturn.easypoi.excel.entity.ExportParams) SysVisitLog(com.github.qinyou.system.model.SysVisitLog) Workbook(org.apache.poi.ss.usermodel.Workbook) Before(com.jfinal.aop.Before) RequirePermission(com.github.qinyou.common.annotation.RequirePermission)

Example 2 with ExportParams

use of cn.afterturn.easypoi.excel.entity.ExportParams in project my_curd by qinyou.

the class ExSingleTableController method exportExcel.

/**
 * 导出excel
 */
@Before(SearchSql.class)
public void exportExcel() {
    String where = getAttr(Constant.SEARCH_SQL);
    if (ExSingleTable.dao.findCountByWhere(where) > 50000) {
        setAttr("msg", "一次导出数据不可大于 5W 条,请修改查询条件。");
        render("common/card.ftl");
        return;
    }
    List<ExSingleTable> list = ExSingleTable.dao.findByWhere(where);
    Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams("例子单表结构", "例子单表结构"), ExSingleTable.class, list);
    render(ExcelRender.me(workbook).fileName("例子单表结构.xls"));
}
Also used : ExportParams(cn.afterturn.easypoi.excel.entity.ExportParams) ExSingleTable(com.github.qinyou.example.model.ExSingleTable) Workbook(org.apache.poi.ss.usermodel.Workbook) Before(com.jfinal.aop.Before)

Example 3 with ExportParams

use of cn.afterturn.easypoi.excel.entity.ExportParams in project my_curd by qinyou.

the class SysSettingController method exportExcel.

/**
 * 导出excel
 */
@Before(SearchSql.class)
public void exportExcel() {
    String where = getAttr(Constant.SEARCH_SQL);
    if (SysSetting.dao.findCountByWhere(where) > 50000) {
        setAttr("msg", "一次导出数据不可大于 5W 条,请修改查询条件。");
        render("common/card.ftl");
        return;
    }
    List<SysSetting> list = SysSetting.dao.findByWhere(where);
    Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams("系统设置项", "系统设置项"), SysSetting.class, list);
    render(ExcelRender.me(workbook).fileName("系统设置项.xls"));
}
Also used : ExportParams(cn.afterturn.easypoi.excel.entity.ExportParams) SysSetting(com.github.qinyou.system.model.SysSetting) Workbook(org.apache.poi.ss.usermodel.Workbook) Before(com.jfinal.aop.Before)

Aggregations

ExportParams (cn.afterturn.easypoi.excel.entity.ExportParams)3 Before (com.jfinal.aop.Before)3 Workbook (org.apache.poi.ss.usermodel.Workbook)3 RequirePermission (com.github.qinyou.common.annotation.RequirePermission)1 ExSingleTable (com.github.qinyou.example.model.ExSingleTable)1 SysSetting (com.github.qinyou.system.model.SysSetting)1 SysVisitLog (com.github.qinyou.system.model.SysVisitLog)1