<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: DJ  
    $Date: 2014-1-9 下午1:37:03  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:o="leaf.database.local.oracle" xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="t1" baseTable="ZJ_SYS_NOTIFY_TEMPLATE_LN">
    <bm:fields>
        <bm:field name="notify_template_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="NOTIFY_TEMPLATE_ID" prompt="ZJ_SYS_NOTIFY_TEMPLATE_LN.NOTIFY_TEMPLATE_ID"/>
        <bm:field name="employee_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="EMPLOYEE_ID" prompt="ZJ_SYS_NOTIFY_TEMPLATE_LN.EMPLOYEE_ID"/>
        <bm:field name="employee_name" datatype="java.lang.String" forInsert="false" forUpdate="false"/>
        <bm:field name="email" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="EMAIL" prompt="ZJ_SYS_NOTIFY_TEMPLATE_LN.EMAIL"/>
        <bm:field name="mobil" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="MOBIL" prompt="ZJ_SYS_NOTIFY_TEMPLATE_LN.MOBIL"/>
        <bm:field name="enabled_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="ENABLED_FLAG" prompt="ZJ_SYS_NOTIFY_TEMPLATE_LN.ENABLED_FLAG"/>
        <bm:field name="notify_template_ln_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="NOTIFY_TEMPLATE_LN_ID" prompt="ZJ_SYS_NOTIFY_TEMPLATE_LN.NOTIFY_TEMPLATE_LN_ID"/>
        <bm:field name="email_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="EMAIL_TYPE" prompt="ZJ_SYS_NOTIFY_TEMPLATE_LN.EMAIL_TYPE"/>
        <bm:field name="email_type_desc" datatype="java.lang.String" forInsert="false" forUpdate="false"/>
    </bm:fields>
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
    			select t1.notify_template_id,
				       t1.notify_template_ln_id,
				       t1.employee_id,
				       u.employee_name,
				       t1.email,
				       t1.mobil,
				       t1.enabled_flag,
				       t1.email_type,
				       (select v.code_value_name
				          from sys_code_values_v v
				         where v.code = 'SYS_MAIL_RECEIVE_TYPE'
				           and v.code_value = t1.email_type) as email_type_desc
				  from zj_sys_notify_template_ln t1, zj_wfl_users_v u
				 where t1.employee_id = u.employee_id(+)
				   and t1.notify_template_id = ${@notify_template_id}
    		]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:primary-key>
        <bm:pk-field name="notify_template_ln_id"/>
    </bm:primary-key>
    <bm:features>
        <f:standard-who/>
        <o:sequence-pk/>
    </bm:features>
</bm:model>
