<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features">
    <bm:fields>
        <bm:field name="instance_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="INSTANCE_ID" prompt="ZJ_WFL_INSTANCE_NODE_RECIPIENT.INSTANCE_ID"/>
        <bm:field name="approve_count" databaseType="NUMBER" datatype="java.lang.Long" physicalName="APPROVE_COUNT" prompt="ZJ_WFL_INSTANCE_NODE_RECIPIENT.APPROVE_COUNT"/>
        <bm:field name="node_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="NODE_ID" prompt="ZJ_WFL_INSTANCE_NODE_RECIPIENT.NODE_ID"/>
        <bm:field name="submitted_by" databaseType="NUMBER" datatype="java.lang.Long" physicalName="SUBMITTED_BY" prompt="ZJ_WFL_INSTANCE_NODE_RECIPIENT.NODE_ID"/>
        <bm:field name="submitted_by_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="SUBMITTED_BY_NAME"/>
        <bm:field name="seq_number" databaseType="NUMBER" datatype="java.lang.Long" physicalName="SEQ_NUMBER" prompt="ZJ_WFL_INSTANCE_NODE_RECIPIENT.SEQ_NUMBER"/>
        <bm:field name="user_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="USER_ID" prompt="ZJ_WFL_INSTANCE_NODE_RECIPIENT.USER_ID"/>
        <bm:field name="date_limit" databaseType="DATE" datatype="java.util.Date" physicalName="DATE_LIMIT" prompt="ZJ_WFL_INSTANCE_NODE_RECIPIENT.DATE_LIMIT"/>
        <bm:field name="record_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="RECORD_ID" prompt="ZJ_WFL_INSTANCE_NODE_RECIPIENT.RECORD_ID"/>
        <bm:field name="commision_by" databaseType="NUMBER" datatype="java.lang.Long" physicalName="COMMISION_BY" prompt="ZJ_WFL_INSTANCE_NODE_RECIPIENT.COMMISION_BY"/>
        <bm:field name="commision_desc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="COMMISION_DESC" prompt="ZJ_WFL_INSTANCE_NODE_RECIPIENT.COMMISION_DESC"/>
        <bm:field name="last_notify_date" databaseType="DATE" datatype="java.util.Date" physicalName="LAST_NOTIFY_DATE" prompt="ZJ_WFL_INSTANCE_NODE_RECIPIENT.LAST_NOTIFY_DATE"/>
        <bm:field name="hierarchy_record_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="HIERARCHY_RECORD_ID" prompt="ZJ_WFL_INSTANCE_NODE_RECIPIENT.HIERARCHY_RECORD_ID"/>
        <bm:field name="workflow_id" databaseType="NUMBER" datatype="java.lang.Long" forInsert="false" forUpdate="false"/>
        <bm:field name="workflow_code" databaseType="VARCHAR2" datatype="java.lang.String" forInsert="false" forUpdate="false"/>
        <bm:field name="document_info" databaseType="VARCHAR2" datatype="java.lang.String" forInsert="false" forUpdate="false"/>
        <bm:field name="workflow_info" databaseType="VARCHAR2" datatype="java.lang.String" forInsert="false" forUpdate="false"/>
        <bm:field name="node_desc" databaseType="VARCHAR2" datatype="java.lang.String" forInsert="false" forUpdate="false"/>
        <bm:field name="workflow_desc" databaseType="VARCHAR2" datatype="java.lang.String" forInsert="false" forUpdate="false"/>
        <bm:field name="creation_date_format" databaseType="VARCHAR2" datatype="java.lang.String" forInsert="false" forUpdate="false"/>
        <bm:field name="urgent_type"/>


        <bm:field name="record_type"/>
        <bm:field name="residence_date_format"/>
        <bm:field name="list_type"/>
        <bm:field name="url_link"/>
        <bm:field name="creation_date"/>
        <bm:field name="winid"/>
    </bm:fields>
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
    			select * from ( select s.instance_id,
        s.approve_count,
        s.submitted_by,
        s.submitted_by_name,
        s.node_id,
        s.node_desc,
        s.hierarchy_record_id,
        s.seq_number,
        s.user_id,
        s.date_limit,
        s.record_id,
        s.commision_by,
        s.commision_desc,
        s.last_notify_date,
        s.workflow_id,
        s.workflow_code,
        s.workflow_desc,
        s.workflow_desc || '-' || s.node_desc as workflow_info,
        s.document_info,
        to_char(s.creation_date, 'yyyy-mm-dd hh24:mi:ss') as creation_date_format,
        CAST(sysdate AS TIMESTAMP) - CAST(s.creation_date AS TIMESTAMP) || '' as residence_date_format,
        s.urgent_type,

        s.record_type,
        'SYS_WFL' LIST_TYPE,
        null url_link,
        s.creation_date,
        null winid
   from zj_wfl_instance_node_rcpt_v s
)t1
#WHERE_CLAUSE#
    		]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:data-filters>
        <bm:data-filter enforceOperations="query" expression="t1.user_id = ${/session/@user_id}"/>
    </bm:data-filters>
    <bm:query-fields>
        <bm:query-field name="any_info" queryExpression="(t1.workflow_desc like  &apos;%&apos;|| ${@any_info} || &apos;%&apos; or t1.node_desc like  &apos;%&apos;|| ${@any_info} || &apos;%&apos; or t1.document_info like  &apos;%&apos;|| ${@any_info} || &apos;%&apos; or to_char(t1.creation_date, &apos;yyyy-mm-dd hh24:mi:ss&apos;) like &apos;%&apos;|| ${@any_info} || &apos;%&apos; or t1.submitted_by_name like &apos;%&apos;|| ${@any_info} || &apos;%&apos; )"/>
        <bm:query-field name="workflow_info" queryExpression="(t1.workflow_desc like  &apos;%&apos;|| ${@workflow_info} || &apos;%&apos; or t1.node_desc like  &apos;%&apos;|| ${@workflow_info} || &apos;%&apos;)"/>
        <bm:query-field name="document_info" queryExpression="t1.document_info like  &apos;%&apos;|| ${@document_info} || &apos;%&apos;"/>
    </bm:query-fields>
</bm:model>
