<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: Chris  
    $Date: 2017-12-14 下午5:58:31  
    $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
                        t.change_record_id,
                        t.change_req_id,
                        t.form_project_id,
                        t.bp_id,
                        t.bp_category,
                        t.bp_type,
                        (SELECT bt.description FROM hls_bp_type bt WHERE bt.bp_type = t.bp_type
                        ) AS bp_type_n,
                        (SELECT
                            bc.description
                        FROM
                            hls_bp_category bc
                        WHERE
                            bc.bp_category = t.bp_category
                        ) AS bp_category_n,
                        t2.bp_code,
                        t2.bp_name,
                        t.data_class
                    FROM
                        prj_project_bp_change t,
                        hls_bp_master t2
                    WHERE
                        t.bp_id = t2.bp_id
                    ) t1 #WHERE_CLAUSE#
            ]]></bm:query-sql>
        </bm:operation>
        <bm:operation name="insert">
            <bm:update-sql><![CDATA[
        begin
  -- Call the procedure
  prj_project_change_req_pkg.save_change_req_vender(p_change_record_id => ${@change_record_id},
                                                    p_change_req_id => ${@change_req_id},
                                                    p_bp_id => ${@bp_id},
                                                    p_bp_category => ${@bp_category},
                                                    p_bp_type => ${@bp_type},
                                                    p_data_class => ${@data_class},
                                                    p_user_id => ${/session/@user_id});
end;
        
        ]]></bm:update-sql>
        </bm:operation>
        <bm:operation name="update">
            <bm:update-sql><![CDATA[
        begin
  -- Call the procedure
  prj_project_change_req_pkg.save_change_req_vender(p_change_record_id => ${@change_record_id},
                                                    p_change_req_id => ${@change_req_id},
                                                    p_bp_id => ${@bp_id},
                                                    p_bp_category => ${@bp_category},
                                                    p_bp_type => ${@bp_type},
                                                    p_data_class => ${@data_class},
                                                    p_user_id => ${/session/@user_id});
end;
        
             ]]></bm:update-sql>
        </bm:operation>
        <bm:operation name="delete">
            <bm:update-sql><![CDATA[
        delete from prj_project_bp_change t1 where t1.change_record_id = ${@change_record_id}
                ]]></bm:update-sql>
        </bm:operation>
    </bm:operations>
    <bm:query-fields>
        <bm:query-field name="data_class" queryExpression="t1.data_class = ${@data_class}"/>
    </bm:query-fields>
    <bm:data-filters>
        <bm:data-filter expression="t1.change_req_id = ${@change_req_id}"/>
    </bm:data-filters>
</bm:model>
