<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: chenlingfeng
    $Date: 2018-12-31 18:17:30
    $Revision: 1.0
    $Purpose:
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" defaultOrderBy="t1.sys_level">
    <bm:operations>
        <bm:operation name="execute">
            <bm:update-sql><![CDATA[
                begin
  -- Call the procedure
  ds_report_common_pkg.init_as_discernment_report(p_base_date_from => to_date(${@base_date_from},'yyyy-mm-dd'),
                                            p_base_date_to => to_date(${@base_date_to},'yyyy-mm-dd'),
                                            p_base_area => ${@base_area},
                                            p_base_agent_id => ${@base_agent_id},
                                            p_base_model => ${@base_model},
                                            p_bp_class => ${@bp_class},
                                            p_session_id => ${/session/@session_id},
                                            p_user_id => ${/session/@user_id});
end;
            ]]></bm:update-sql>
        </bm:operation>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
	    	  select decode(t1.sys_level,9999,'合计',t1.sys_level) sys_level,
	    	  execute_num_good,
         execute_num_bad,
         rate_good,
         rate_bad,
         total_rate_good,
         total_rate_bad,
         defective_rate,
         auc,
         gini
  from CON_AS_DISCERNMENT_REPORT t1
#WHERE_CLAUSE#
#ORDER_BY_CLAUSE#

	    	]]></bm:query-sql>
        </bm:operation>
    </bm:operations>

    <bm:data-filters>
        <bm:data-filter name="query" expression="t1.session_id = ${/session/@session_id}"/>
    </bm:data-filters>
</bm:model>
