<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: Cfz  
    $Date: 2016-04-19 上午10:10:18  
    $Revision: 1.0  
    $Purpose: 
    $Last_updated_by:zhuxianfei
    $Last_updated_date:2016-06-08
-->
<bm:model xmlns:s="leaf.plugin.script" xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features">
    <bm:fields>
        <bm:field name="bp_id"/>
        <bm:field name="bp_code"/>
        <bm:field name="bp_name"/>
        <bm:field name="bp_class_desc"/>
        <bm:field name="bp_type_desc"/>
        <bm:field name="bp_category_desc"/>
        <bm:field name="enabled_flag_desc"/>
        <bm:field name="if_to_zx_flag_desc"/>
        <bm:field name="zx_last_updated_by_desc"/>
        <bm:field name="zx_last_update_date"/>
        <!--  <bm:field name="id_card_desc" expression="(decode(t1.id_type,&apos;ID_CARD&apos;,t1.id_card_no,&apos;&apos;))" forInsert="false" forUpdate="false"/>
        <bm:field name="id_check_result" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="ID_CHECK_RESULT"/> -->
    </bm:fields>
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
        		select t1.* from (select
        		    bp.bp_id,
        		    bp.bp_code,
        		    bp.bp_name,
        		    bp.bp_class_desc,
        		    bp.bp_type_desc,
        		    bp.bp_category_desc,
        		    bp.enabled_flag_desc,
        		    bp.if_to_zx_flag_desc,
        		    bp.zx_last_updated_by_desc,
        		    to_char(bp.zx_last_update_date,'yyyy-mm-dd') zx_last_update_date
        		from
        		    zx_bp_master_v bp 
        		where
        		   bp.bp_class ='ORG') t1
        		  #WHERE_CLAUSE#
        		    ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:query-fields>
        <!-- <bm:query-field field="bp_class" queryOperator="="/>
        <bm:query-field field="bp_type" queryOperator="="/> -->
        <bm:query-field name="bp_code_from" queryExpression="t1.bp_code &gt;= ${@bp_code_from} "/>
        <bm:query-field name="bp_code_to" queryExpression="t1.bp_code &lt;= ${@bp_code_to} "/>
        <!-- <bm:query-field name="bp_contract_number" queryExpression="( t1.contract_number = ${@bp_contract_number} or exists (select 1 from con_contract c where c.contract_number=${@bp_contract_number} and c.data_class=&apos;NORMAL&apos; and c.agent_bp_id=t1.bp_id)) "/> -->
        <!-- <bm:query-field field="enabled_flag" queryExpression="(t1.enabled_flag=${@enabled_flag} or ${@enabled_flag}=&apos;ALL&apos;)"/> -->
        <!--   <bm:query-field name="search_term_1_from" queryExpression="search_term_1 &gt;= ${@search_term_1_from} "/>
        <bm:query-field name="search_term_1_to" queryExpression="search_term_1 &lt;= ${@search_term_1_to} "/>
        <bm:query-field name="search_term_2_from" queryExpression="search_term_2 &gt;= ${@search_term_2_from} "/>
        <bm:query-field name="search_term_2_to" queryExpression="search_term_2 &lt;= ${@search_term_2_to} "/> -->
        <!--  <bm:query-field field="bp_id" queryOperator="="/> -->
        <!-- <bm:query-field field="bp_category" queryOperator="="/> -->
        <!--  <bm:query-field field="extra_nam" queryOperator="like"/> -->
        <!-- <bm:query-field field="bp_name" queryOperator="="/> -->
        <bm:query-field name="bp_name" queryExpression="t1.bp_name=${@bp_name}"/>
        <!-- <bm:query-field field="if_to_zx_flag_desc" queryOperator="like"/> -->
        <bm:query-field name="if_to_zx_flag_desc" queryExpression="t1.if_to_zx_flag_desc=${@if_to_zx_flag_desc}"/>
        <bm:query-field field="bp_class_desc" queryOperator="like"/>
        <!-- <bm:query-field name="bp_class_desc" queryExpression="t1.bp_class_desc=${@bp_class_desc}"/> -->
        <bm:query-field field="bp_type_desc" queryOperator="like"/>
        <!-- <bm:query-field name="bp_type_desc" queryExpression="t1.bp_type_desc=${@bp_type_desc}"/> -->
        <bm:query-field field="enabled_flag_desc" queryOperator="like"/>
        <bm:query-field field="zx_last_updated_by_desc" queryOperator="like"/>
        <!--  <bm:query-field name="zx_last_update_date_from" queryExpression="t1.zx_last_update_date &gt;=to_date(${@zx_last_update_date_from},&apos;yyyy-mm-dd&apos;)"/>
        <bm:query-field name="zx_last_update_date_to" queryExpression="t1.zx_last_update_date &lt;=to_date(${@zx_last_update_date_to},&apos;yyyy-mm-dd&apos;)"/> -->
        <bm:query-field name="zx_last_update_date_from" queryExpression="t1.zx_last_update_date &gt;${@zx_last_update_date_from}"/>
        <bm:query-field name="zx_last_update_date_to" queryExpression="t1.zx_last_update_date &lt;=${@zx_last_update_date_to}"/>
        <!-- <bm:query-field field="id_check_result" queryExpression="t1.id_check_result = ${@id_check_result_desc}"/>
        <bm:query-field name="bp_project_id" queryExpression="(t1.bp_id in (select ppb.bp_id from prj_project pp ,prj_project_bp ppb where pp.project_id=ppb.project_id and pp.project_id=${@bp_project_id}) or t1.bp_id in (select h.bp_id from prj_project_act_ctrler_hd h, prj_project pp where pp.project_id = h.project_id and pp.project_id = ${@bp_project_id}))"/>
        <bm:query-field name="bp_project_name" queryExpression="(t1.bp_id in (select ppb.bp_id from prj_project pp ,prj_project_bp ppb where pp.project_id=ppb.project_id and pp.project_name like ${@bp_project_name})  or t1.bp_id in (select h.bp_id from prj_project_act_ctrler_hd h, prj_project pp where pp.project_id = h.project_id and pp.project_name like ${@bp_project_name}))"/>
        <bm:query-field name="bp_contract_id" queryExpression="(t1.bp_id in (select ccb.bp_id from con_contract cc ,con_contract_bp ccb where cc.contract_id=ccb.contract_id and cc.contract_id =${@bp_contract_id}) or exists (select 1 from con_contract c where c.contract_id=${@bp_contract_id} and c.data_class=&apos;NORMAL&apos; and c.agent_bp_id=t1.bp_id) )"/> -->
        <!-- <bm:query-field name="bp_contract_name" queryExpression="t1.bp_id in (select ccb.bp_id from con_contract cc ,con_contract_bp ccb where cc.contract_id=ccb.contract_id and cc.contract_name like ${@bp_contract_name})"/> -->
    </bm:query-fields>
    <!-- <bm:data-filters>
        <bm:data-filter enforceOperations="query" expression="t1.bp_class = &apos;ORG&apos; "/>
    </bm:data-filters> -->
    <bm:features>
        <f:standard-who/>
        <s:bm-script><![CDATA[
            var cx = Packages.leaf.javascript.Context.getCurrentContext();
            Packages.leaf.plugin.script.engine.ScriptImportor.defineExternScript(cx, this, $ctx.getData(), "aut_authority_bm_validate.js");
        ]]></s:bm-script>
    </bm:features>
</bm:model>
