# report-engine **Repository Path**: yugouai/report-engine ## Basic Information - **Project Name**: report-engine - **Description**: 基于freemarket的报表引擎 - **Primary Language**: Java - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2016-11-17 - **Last Updated**: 2021-08-09 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ############################################ report engine 主要结构描述 ############################################ 主要相关技术: xstream (xml parse) highchart (html5 chart) bootstrape (css framework) jackson (json) groovy spring (report可以引用spring定义的bean) 一. XML结构: params 查询参数 dataSources 数据源 querys 数据库SQL查询,查询完的结果集将放在context中 groovy 脚本,在查询开始前及查询数据结果后执行 charts 图形 tables 表格 二. 执行 1. 解析XML得到 Report对象 2. 执行Report对象的 querys,及 groovy,得到 context 3. 通过 context渲染freemarker报表 三. freemarker渲染报表 renderParams(params) renderChart(chart) renderTable(table) 四. 工具类方法 SelectorUtil,应用在 report.getElementById(id) public static Object getElementById(Object root, String id) /** * 报表引擎生命周期接口 * * @author Irwin * */ public interface ReportEngineLifecycle { public void beforeQuery(Map context); public void afterQuery(Map context); } ############################################ report engine 使用描述 ############################################ 1. maven依赖 com.duowan.common duowan-report-engine 0.1.1-SNAPSHOT 2. web.xml配置 contextConfigLocation classpath*:spring/report_engine/*.xml, org.springframework.web.context.ContextLoaderListener ReportEngineServlet com.duowan.reportengine.web.servlet.ReportEngineServlet 1 ReportEngineServlet /ReportEngine/* 3. spring配置: report_engine.xml 4. spring属性 配置 report_baseReportDir=classpath:report_conf frameset.ftl 用于将报表与参数联合展现在一起 parameter.ftl 用于展现参数 macro.ftl 包含标准的macro函数,macro如下 renderParams 渲染参数 renderChart 渲染图形 renderTable 渲染表格 renderPagination 渲染分页 5. 静态资源 需要将reportEngine中css,img,js等静态资源拷贝至项目中