<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: qwm  
    $Date: 2012-11-13 下午01:59:30  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
                SELECT
                    *
                FROM
                    (SELECT
                        'content' type,
                        'a'
                        ||f.line_number field,
                        f.field_description_dis title,
                        f.header_style titlestyle,
                        f.cell_style cellStyle,
                        f.subtotal_type groupFormula,
                        (SELECT
                            DECODE(f.subtotal_type, 1, '平均值 ', 2, '计数 ', 3, '计数 ', 4, '最大值 ', 5, '最小值 ', 6, '乘积 ', 7, '标准偏差 ', 9, '汇总 ')
                        FROM
                            dual
                        ) groupdesc,
                        (SELECT
                            DECODE(f.subtotal_type, 1, '总计平均值 ', 2, '总计数 ', 3, '总计数 ', 4, '总计最大值 ', 5, '总计最小值 ', 6, '总计乘积 ', 7, '总计标准偏差 ', 9, '总计 ')
                        FROM
                            dual
                        ) totalDesc,
                        '' groupField,
                        (SELECT
                            g.line_number
                        FROM
                            psr_report_groups g
                        WHERE
                            g.report_header_id  = ${@report_header_id} AND
                            g.field_line_number =f.line_number
                        ) grouplevel,
                        f.REPORT_FIELD_ID,
                        f.line_number
                    FROM
                        psr_report_headers h,
                        psr_report_fields f
                    WHERE
                        h.report_header_id = f.report_header_id AND
                        h.report_header_id = ${@report_header_id}
                    ) v #WHERE_CLAUSE#
                ORDER BY
                    v.line_number
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TYPE" required="true"/>
        <bm:field name="field" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FIELD" required="true"/>
        <bm:field name="title" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TITLE" required="true"/>
        <bm:field name="titlestyle" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TITLESTYLE"/>
        <bm:field name="cellstyle" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CELLSTYLE"/>
        <bm:field name="grouplevel" databaseType="NUMBER" datatype="java.lang.Long" physicalName="GROUPLEVEL"/>
        <bm:field name="report_field_id" datatype="java.lang.Long"/>
        <!-- <bm:field name="groupFormula" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="GROUPFORMULA"/>
        <bm:field name="groupDesc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="GROUPDESC"/>
        <bm:field name="totalDesc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TOTALDESC"/>
        <bm:field name="groupField" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="GROUPFIELD"/> -->
    </bm:fields>
    <!-- <bm:query-fields>
        <bm:query-field name="instance_id" dataType="java.lang.Long" queryExpression="v.instance_id = ${@instance_id}"/>
    </bm:query-fields> -->
</bm:model>
