<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: chenlingfeng  
    $Date: 2017-12-14 下午4:54:33  
    $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_req_number,
                        t.description,
                        t2.project_number,
                        t2.project_name,
                        t2.lease_organization_desc,
                        t2.employee_name,
                        t2.bp_name,
                        t2.finance_amount,
                        t.change_req_id,
                        t.project_id
                    FROM
                        prj_project_change_req t,
                        prj_project_v t2
                    WHERE
                        t.project_id = t2.project_id
                    ) t1 #WHERE_CLAUSE#
            ]]></bm:query-sql>
        </bm:operation>
        <bm:operation name="update">
            <bm:update-sql><![CDATA[
            update prj_project_change_req t set t.description = ${@description}
            where t.change_req_id=${@change_req_id}
        ]]></bm:update-sql>
        </bm:operation>
        <bm:operation name="execute">
            <bm:update-sql><![CDATA[
            begin
              prj_project_change_req_pkg.submit_change_req_vender(p_change_req_id => ${@change_req_id},
                                                      p_user_id => ${/session/@user_id});
                                                      end;
        ]]></bm:update-sql>
        </bm:operation>
        <bm:operation name="delete">
            <bm:update-sql><![CDATA[
            begin
              prj_project_change_req_pkg.cancel_change_req_vender(p_change_req_id => ${@change_req_id},
                                                      p_user_id => ${/session/@user_id});
                                                      end;
        ]]></bm:update-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="change_req_id"/>
        <bm:field name="project_id"/>
        <bm:field name="finance_amount" databaseType="NUMBER" datatype="java.lang.Double"/>
        <bm:field name="change_req_number" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CHANGE_REQ_NUMBER"/>
        <bm:field name="description" databaseType="CLOB" datatype="java.sql.Clob" physicalName="DESCRIPTION"/>
        <bm:field name="project_number" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PROJECT_NUMBER" required="true"/>
        <bm:field name="project_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PROJECT_NAME"/>
        <bm:field name="lease_organization_desc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LEASE_ORGANIZATION_DESC"/>
        <bm:field name="employee_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="EMPLOYEE_NAME"/>
        <bm:field name="bp_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_NAME"/>
    </bm:fields>
    <bm:data-filters>
        <bm:data-filter name="change_req_id" expression="t1.change_req_id=${@change_req_id}"/>
    </bm:data-filters>
</bm:model>
