<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: hp  
    $Date: 2014-10-8 上午11:22:58  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" needAccessControl="false">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
                SELECT DISTINCT
                    t1.bp_name,
                    t1.bp_id,
                    r.related_bp_id,
                    DECODE(r.related_bp_id, NULL, 'N',DECODE(r.bp_id,${@bp_id},'Y','N')) AS bp_relation_flag,
                    t1.bp_id
                    ||'_s' AS bp_id_s
                FROM
                    HLS_BP_MASTER_LV t1,
                    hls_bp_master_relation r
                WHERE
                    1                  = 1 AND
                    r.related_bp_id(+) = t1.bp_id AND
                    t1.bp_type         = 'CUSM'
                ORDER BY  t1.bp_id asc  
            ]]></bm:query-sql>
        </bm:operation>
        <bm:operation name="delete">
            <bm:update-sql><![CDATA[
            	begin
            		 delete from hls_bp_master_relation r where  r.relation_type= 'INSR' and r.relation_category = 'INSR' and r.bp_id = ${@bp_id};
            		
            	end;
            ]]></bm:update-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="bp_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_NAME"/>
        <bm:field name="bp_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="BP_ID" required="true"/>
        <bm:field name="related_bp_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="RELATED_BP_ID"/>
        <bm:field name="bp_relation_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_RELATION_FLAG"/>
        <bm:field name="bp_id_s" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="bp_id_s"/>
    </bm:fields>
    <bm:query-fields>
        <bm:query-field field="bp_id" queryOperator="="/>
    </bm:query-fields>
</bm:model>
