<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" accessControlMode="false" needAccessControl="false">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
               select a.* from (SELECT rownum as row_num, 
               		t1.instance_id,--
                    t1.workflow_id,t1.workflow_code,t1.workflow_desc,--
                    zj_wfl_core_pkg.can_cancel_instance (
                      t1.instance_id,${/session/@user_id}
                    ) AS can_cancel,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,t2.node_id, --
                    '提交日期：' || to_char((select t3.creation_date from zj_wfl_workflow_instance t3 where t3.instance_id = t1.instance_id),'YYYY-MM-DD') as creation_date
                FROM zj_wfl_workflow_instance_v t1,zj_wfl_workflow_node t2
                WHERE t1.workflow_id = t2.workflow_id
                    AND t1.current_seq = t2.sequence_num
                    AND t1.submitted_by = ${/session/@user_id}
                    AND EXISTS (SELECT 1
          							FROM wfl_workflow_pages
         						WHERE workflow_id = t1.WORKFLOW_ID
               					AND device_type_id = 'IPHONE')
                ORDER BY t1.instance_id DESC) a where row_num >= to_number(nvl(${/parameter/@index},1)) 
              				and row_num < (to_number(nvl(${/parameter/@index},1))+to_number(nvl(${/parameter/@length},row_num)))
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
</bm:model>
