<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[select t1.instance_id,
               t1.workflow_id,
               t1.workflow_code,
               t1.workflow_desc,
               t1.current_seq,
               t1.created_by,
               t1.submitted_by,
               t1.instance_status,
               t1.instance_status_desc,
               t1.current_node_desc,
               t1.last_approve_date,
               t1.company_id,
               t1.company_info,
               t1.approve_user_code,
               t1.approve_user_name,
               t1.document_info,
               t1.creation_date,
               cus_get_date_str(t1.last_update_date - t1.creation_date) use_time,
               decode(t1.instance_status,10,to_char(t1.last_update_date,'YYYY-MM-DD HH24:mi:ss'),-1,to_char(t1.last_update_date,'YYYY-MM-DD HH24:mi:ss'),null) over_date,
               to_char(t1.creation_date,'YYYY-MM-DD HH24:mi:ss') submit_date,
               t1.submitted_by_name
          from zj_wfl_workflow_instance_v t1
          #WHERE_CLAUSE#
          order by t1.instance_id desc]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:query-fields>
        <bm:query-field name="instance_id" queryExpression="t1.instance_id = ${@instance_id}"/>
        <bm:query-field name="document_info" queryExpression="t1.document_info like &apos;%&apos;||${@document_info}||&apos;%&apos;"/>
        <bm:query-field name="submitted_by" queryExpression="t1.submitted_by=${@submitted_by}"/>
        <bm:query-field name="instance_status" queryExpression="t1.instance_status = ${@instance_status}"/>
        <bm:query-field name="workflow_code" queryExpression="t1.workflow_code like ${@workflow_code}"/>
        <bm:query-field name="node_desc" queryExpression="(t1.current_node_desc like ${@node_desc} or t1.current_seq like ${@node_desc})"/>
        <bm:query-field name="company_id" queryExpression="t1.company_id = ${/session/@company_id}"/>
        <bm:query-field name="approve_user_name" queryExpression="t1.approve_user_name like ${@approve_user_name}"/>
        <bm:query-field name="approve_user_code" queryExpression="t1.approve_user_code like ${@approve_user_code}"/>
    </bm:query-fields>
    <bm:data-filters>
        <bm:data-filter enforceOperations="query" expression="t1.workflow_code !=&apos;CUS_NOTICE&apos;"/>
    </bm:data-filters>
</bm:model>
