<?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.bs_level">
    <bm:operations>
        <bm:operation name="execute">
            <bm:update-sql><![CDATA[
                begin
  -- Call the procedure
  ds_report_common_pkg.init_bs_discernment_report(p_base_date_from => to_date(${@base_internal_period_num},'yyyymm'),
                                            p_base_date_to => last_day(to_date(${@base_internal_period_num},'yyyymm')),
                                            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.bs_level,9999,'合计',t1.bs_level) bs_level,
	    	  execute_num_all,
         execute_num_bad,
         rate_all,
         rate_bad,
         total_rate_all,
         total_rate_bad,
         defective_rate,
         auc,
         gini
  from CON_bs_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>
