- Overview
- New conditions
- New input box type condition
- New fixed single-selection list type criteria
- New Dynamic single-selection list type criteria
- New fixed multi-marquee type condition
- New dynamic Multi-marquee type condition
- New Form
- New graphics
- Save Report
- Resource Management configuration
- To see if the report was successful
- Write a report manually
Overview
original link : http://blog.csdn.net/u011506468/article/details/47682417
Because before the company internal report demand too much, development too tired, they wrote an automated build report of things, follow-up can be more perfect. Now write down my thoughts. More advanced configuration reports may be completed recently and will be logged when completed.
Configure the Add report, currently only support a table one diagram of the display, support export reports, do not need to write pages, only need to use the following methods to configure. If you want to show a rich page, you must hand-write.
This document describes how the dynamic Add Report tool is used. First I prepared some relatively simple data for testing, the following is used to test the table, such as
New conditions
noun Introduction
- Owning SQL Condition: conditional name match to insert condition in SQL
- Condition Type: Multimedia function, here is only one function, choose to create the input box when the date effect added
- Condition name: The conditional noun displayed on the interface
- Options: Condition Type
New input box type condition
There are two types of input boxes to choose from
- Normal input box, such as select the option as "form (input)", the condition type is selected as "text"
- An input box with a date control, such as selecting the option as "form (input)", selecting the condition type as "date", and then clicking the New button, you can add an input box type condition.
New fixed single-selection list type criteria
Select the option as "Radio (SELECT)", enter the data you want to show in the value, comma as the delimiter, and here I enter a one-and-one and click Add, you can add a single-selection list of criteria
New Dynamic single-selection list type criteria
And the new fixed single-selection list type conditions are different, here can be based on the user input SQL dynamic display of the radio conditions
Select the option as "Radio (SELECT)", enter it in the value select to_char(rp_date,‘yyyy-mm-dd‘) rp_date from test
, and then click Add to increase the criteria for a single radio list
New fixed multi-marquee type condition
Select the option as multiple selection (checkbox), enter the data you want to show in the value, comma as the delimiter, and here I enter a three-to-one and click Add, you can add a multi-marquee condition
New dynamic Multi-marquee type condition
And the new fixed multi box type conditions are different, here can be based on the user input SQL dynamic display multi-selection criteria
Select the option as "Multiple selection (checkbox)", enter it in the value select to_char(rp_date,‘yyyy-mm-dd‘) rp_date from test
and click Add, you can add a multi-marquee condition, notice here try not to show too many marquee, not beautiful
New Form
Noun Explanation:
- Report flag: When you save a report and the page URL that is configured in resource management
- Title: report Title
- Chinese column name: A Chinese explanation of the listed names found in SQL
- Database column name: Aliases found in SQL, you must alias the listed columns
- SQL Name: Fill in here with the same title, convenient in Rp_report_sql SQL configuration table to quickly find the SQL belongs to which report
- Next to the SQL name of the Radio box: flag This SQL belongs to the report of which time dimension, you can click Save SQL to save to different time dimension , when viewing the report, click on the middle of the report by the hour, by day, by week, etc. will be dynamically converted data, Save SQL to be careful
As described above, there is a property in the condition "owning SQL condition", which is mainly when the table is created and the conditions in SQL correspond, if the condition is written in {1},sql, write: {1}. At this point I entered the SQL for select to_char(rp_date,‘yyyy-mm-dd‘) rp_date, amt, cnt from test where rp_date > to_date(:{1},‘yyyy-mm-dd‘) and rp_date < to_date(:{2},‘yyyy-mm-dd‘) order by 1 desc
, then I added two input boxes for the date type of the condition "Start time" and "End Time", respectively, corresponding to the SQL condition {1} and {2}, after all created, click to view the results.
New graphics
Noun Explanation:
- The option in chart Option:echarts, where you don't need to fill in the data, mainly constructs the title of the graph, the horizontal axis, the ordinate attribute, the legend, the ordinate of the displayed data, and so on.
- DataColumn and Legend Correspondence: The database column name of the table above and the corresponding relationship of the legend to be displayed, in the format "Rp_date: Date, Amt: Amount, CNT: Number of pens", the first time column, will be used as a horizontal axis .
If you do not want to save the graphic, this step can be ignored, "Save Graphics" select No. Graphics frame using echarts, want to use graphics features, please first understand the Echarts graphics frame, here can not fill in, click on the "Refresh icon", the default presentation rule is: from the table in the first column obtained from the data is the horizontal axis, followed by the order shown as a bar chart. It is best not to use the default refresh icon because the data in the table is not meant to be shown in each column, and some columns will have Chinese.
Save Report
Save the report is in order, after saving the table successfully, please remember to save the corresponding SQL, without saving SQL, save the report button is not allowed to click. Reason: I designed a report can save a number of time dimensions, so a report may correspond to multiple SQL, so first save the SQL, and then the sqlid assembled together to save it.
Resource Management configuration
Once the report is saved successfully, only some elements of the report are stored, and there is no correspondence on the page. Need to go to the Resource Management page in the Rights management system to configure a report page, and then assign permissions to the corresponding user.
Resource Configuration Description: The configured URL format is the tpl/tool/smartreportshow.jsp?reportflag= report flag |time= Time dimension , which is the report flag that you fill in the new report page. The time dimension is by hour: H, by day: D, by week: W, by month: M. Plus the time dimension is primarily due to the fact that the URLs of multiple time dimensions of the same report are differentiated, and are configured in strict format .
Described here the report resource management rules, you can see the top left corner of the report system has a module of choice, after selecting the module left to display the corresponding module of the report sub-module , and then the resource management will have a Times, daily, weekly, monthly and other menus, this part is mainly Distinguish which time dimension the report belongs to, and automatically switch to the report under the corresponding menu when you click the Times, daily, and other buttons in the middle of the report. If you do not put in the daily, weekly and other menus, click the report in the middle of the Times, daily and other buttons when the page will exist in multiple time dimensions .
To see if the report was successful
To do this, go to the resource page you just configured to see if it was successful
Write a report manually
Manual write reports are primarily used when displaying a rich interface. Completely different from the one described above, you need to manually add a SQL to the Rp_report_sql (remember to add 1 to the sequence, otherwise the next new error). Conditions for manually writing reports I use the old framework of the previous report conditional configuration, with the automatic configuration of this difference, such as to get the above results, the need for SQL select rp_date,amt,cnt from test where 1=1 {whereclause} order by 1 desc
, at this time the page needs to configure the conditions encapsulated as
filters = {groupOp:"and",rules:[{field:"rp_date",op:"ge",data:beginTime,funcBefore:"to_date(",funcAfter:",‘yyyymmdd‘)"},{field:"rp_date",op:"le",data:endTime,funcBefore:"to_date(",funcAfter:",‘yyyymmdd‘)"}]};
The URL of the resource management is the path of this JSP, can refer to the following iboxpay-report-main\iboxpay-report-webapp\src\main\webapp\tpl\merchant_tran_num_d_ Rp.jsp. Conditional configuration method is more troublesome, can refer to iboxpay-report-main\iboxpay-report-core\src\main\java\com\iboxpay\omp\report\queryrule\ The main function in Queryfilter.java. Because it was the old frame before, I didn't go to modify this way.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Echarts,java-based Automation Configuration Report Project construction