<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:oracle="leaf.database.local.oracle" xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="t" basetable="ZJ_WFL_WORKFLOW_DELIVER">
    <bm:fields>
        <bm:field name="recipient_id" databasetype="NUMBER" datatype="java.lang.Long"/>
        <bm:field name="date_from" databasetype="DATE" datatype="java.sql.Date" prompt="开始日期"/>
        <bm:field name="date_to" databasetype="DATE" datatype="java.sql.Date" prompt="结束日期"/>
        <bm:field name="deliver_to_id" databasetype="NUMBER" datatype="java.lang.Long"/>
        <bm:field name="deliver_reason" databasetype="VARCHAR2" datatype="java.lang.String" prompt="转交原因"/>
        <bm:field name="workflow_id" databasetype="NUMBER" datatype="java.lang.Long"/>
        <bm:field name="record_id" databasetype="NUMBER" datatype="java.lang.Long"/>
        <bm:field name="workflow_name" databasetype="VARCHAR2" datatype="java.lang.String" expression="(select z.workflow_desc workflow_name  from  zj_wfl_workflow z where z.workflow_id= t.workflow_id)" prompt="WFL_WORKFLOW.NAME"/>
        <bm:field name="workflow_desc" databasetype="VARCHAR2" datatype="java.lang.String" expression="(select z.workflow_desc workflow_name  from  zj_wfl_workflow z where z.workflow_id= t.workflow_id)" prompt="WFL_WORKFLOW.NAME"/>
    </bm:fields>
    <bm:primary-key>
        <bm:pk-field name="record_id"/>
    </bm:primary-key>
    <bm:query-fields>
        <bm:query-field field="recipient_id" queryexpression="t.recipient_id=${/session/@user_id}"/>
        <bm:query-field name="workflow_name" queryexpression="(select z.workflow_desc workflow_name  from  zj_wfl_workflow z where z.workflow_id= t.workflow_id)  like ${@workflow_name}"/>
    </bm:query-fields>
    <bm:relations>
        <bm:relation name="w" jointype="INNER" refmodel="zjwfl.zj_wfl_workflow">
            <bm:reference foreignfield="workflow_id" localfield="workflow_id"/>
        </bm:relation>
        <bm:relation name="u" jointype="INNER" refmodel="sys.sys_user">
            <bm:reference foreignfield="user_id" localfield="deliver_to_id"/>
        </bm:relation>
        <bm:relation name="e" jointype="INNER" refmodel="exp.exp_employees">
            <bm:reference expression="e.employee_id=u.employee_id"/>
        </bm:relation>
    </bm:relations>
    <bm:features>
        <oracle:sequence-pk/>
        <f:standard-who/>
    </bm:features>
    <bm:ref-fields>
        <bm:ref-field name="user_name" prompt="转交给" relationname="u" sourcefield="user_name"/>
        <!--  <bm:ref-field name="name_id" relationname="w" sourcefield="name_id"/> -->
        <bm:ref-field name="employee_name" prompt="WFL_WORKFLOW_DELIVER.DELIVER_TO" relationname="e" sourcefield="name"/>
    </bm:ref-fields>
</bm:model>
