<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: ZLF  
    $Date: 2014-12-18 下午01:55:59  
    $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
                        pb.prj_bp_id,
                        pb.bp_id,
                        pb.bp_code,
                        pb.bp_name,
                        pb.bp_seq,
                        pb.project_id,
                        pb.bp_category,
                        pb.bp_category_desc,
                        pb.bp_type,
                        pb.bp_type_desc,
                        pb.bp_class,
                        pb.bp_class_desc,
                        pb.contract_seq,
                        'PB' table_name
                    FROM
                        prj_project_bp_v pb
                    WHERE
                        pb.project_id =${@project_id}
                    UNION ALL
                    SELECT
                        pah.prj_bp_id,
                        pah.bp_id,
                        pah.bp_code,
                        pah.bp_name,
                        pah.bp_seq,
                        pah.project_id,
                        pah.bp_category,
                        pah.bp_category_desc,
                        pah.bp_type,
                        pah.bp_type_desc,
                        pah.bp_class,
                        pah.bp_class_desc,
                        pah.contract_seq,
                        'PAH' table_name
                    FROM
                        prj_act_ctrler_hd_lv pah
                    WHERE
                        pah.project_id = ${@project_id}
                    )v #WHERE_CLAUSE#
                ORDER BY
                    bp_category,
                    contract_seq
            ]]></bm:query-sql>
        </bm:operation>
        <bm:operation name="delete">
            <bm:update-sql><![CDATA[
        		BEGIN
                    prj_project_pkg.delete_prj_bp_count_parameter(p_project_id                  =>${@project_id},
					                                              p_bp_category            		=>${@bp_category},
					                                              p_bp_class         			=>${@bp_class},
					                                              p_bp_seq 						=>${@bp_seq},
					                                              p_table_name 					=> ${@table_name},
					                                              p_user_id                     =>${/session/@user_id});
                END;
        	]]></bm:update-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="prj_bp_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="PRJ_BP_ID" required="true"/>
        <bm:field name="bp_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="BP_ID" required="true"/>
        <bm:field name="bp_seq" databaseType="NUMBER" datatype="java.lang.Long" physicalName="BP_SEQ" required="true"/>
        <bm:field name="bp_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_CODE"/>
        <bm:field name="bp_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_NAME"/>
        <bm:field name="project_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="PROJECT_ID" required="true"/>
        <bm:field name="bp_category" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_CATEGORY" required="true"/>
        <bm:field name="bp_category_desc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_CATEGORY_DESC"/>
        <bm:field name="bp_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_TYPE"/>
        <bm:field name="bp_type_desc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_TYPE_DESC"/>
        <bm:field name="bp_class" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_CLASS"/>
        <bm:field name="bp_class_desc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_CLASS_DESC"/>
        <bm:field name="contract_seq" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CONTRACT_SEQ"/>
        <bm:field name="table_name" databaseType="CHAR" datatype="java.lang.String" physicalName="TABLE_NAME"/>
    </bm:fields>
</bm:model>
