<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: ZLF  
    $Date: 2014-12-25 上午10:00:02  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:o="leaf.database.local.oracle" xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="t1" baseTable="PRJ_PROJECT_RISK_APPROVER" needAccessControl="false">
    <bm:fields>
        <bm:field name="risk_approver_record_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="RISK_APPROVER_RECORD_ID" prompt="PRJ_PROJECT_RISK_APPROVER.RISK_APPROVER_RECORD_ID"/>
        <bm:field name="approval_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="APPROVAL_ID" prompt="PRJ_PROJECT_RISK_APPROVER.APPROVAL_ID"/>
        <bm:field name="approver_user_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="APPROVER_USER_ID" prompt="PRJ_PROJECT_RISK_APPROVER.APPROVER_USER_ID"/>
        <bm:field name="comment_risk" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="COMMENT_RISK" prompt="PRJ_PROJECT_RISK_APPROVER.COMMENT_RISK"/>
        <bm:field name="employee_name" forInsert="false" forUpdate="false"/>
        <bm:field name="position_name" forInsert="false" forUpdate="false"/>
    </bm:fields>
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
    		SELECT * FROM
        		(SELECT
        		    pra.risk_approver_record_id,
        		    pra.approval_id,
        		    pra.approver_user_id,
        		    pra.creation_date,
        		    pra.comment_risk,
        		    v.employee_name,
        		    v.position_name
        		FROM
        		    prj_project_risk_approver pra,
        		    exp_emp_assign_e_v v
        		WHERE
        		    pra.approver_user_id = v.user_id AND
        		    pra.approval_id      = ${@approval_id}
        		) t1 #WHERE_CLAUSE# order by t1.creation_date desc
    		 		]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:features>
        <o:sequence-pk/>
    </bm:features>
    <bm:primary-key>
        <bm:pk-field name="risk_approver_record_id"/>
    </bm:primary-key>
    <bm:features>
        <f:standard-who/>
    </bm:features>
    <bm:query-fields>
        <bm:query-field field="approver_user_id" queryOperator="="/>
    </bm:query-fields>
</bm:model>
