<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: DJ  
    $Date: 2013-3-22 下午1:38:39  
    $Revision: 1.0  
    $Purpose: 
-->
<ns1:model xmlns:ns1="http://www.leaf-framework.org/schema/bm" alias="t1" extend="sch.SCH102.sch_task" extendMode="reference">
    <ns1:fields>
        <ns1:field name="task_code" displayWidth="200" forDisplay="true" forQuery="true"/>
        <ns1:field name="task_name" displayWidth="250" forDisplay="true" forQuery="true"/>
        <ns1:field name="task_para_count"/>
    </ns1:fields>
    <ns1:operations>
        <ns1:operation name="query">
            <ns1:query-sql><![CDATA[
    			SELECT t1.TASK_CODE,
				       t1.TASK_NAME,
				       (select count(1)
				          from sch_task_parameter p
				         where p.task_code = t1.task_code) as task_para_count
				  FROM SCH_TASK t1
				  #WHERE_CLAUSE#
				 ORDER BY t1.TASK_CODE
    		]]></ns1:query-sql>
        </ns1:operation>
    </ns1:operations>
    <ns1:data-filters>
        <ns1:data-filter enforceOperations="query" expression="t1.enabled_flag=&apos;Y&apos;"/>
        <ns1:data-filter enforceOperations="query" expression="exists( select 1 from sch_task_authorize a where a.task_code = t1.task_code and a.role_id = ${/session/@role_id} AND a.start_date &lt; sysdate AND (a.end_date is null or a.end_date &gt; sysdate))"/>
    </ns1:data-filters>
    <ns1:query-fields>
        <ns1:query-field field="task_code" queryOperator="like"/>
        <ns1:query-field field="task_name" queryOperator="like"/>
    </ns1:query-fields>
</ns1:model>
