<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: wangwei  
    $Date: 2015-2-5 上午9:24:26  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="t1" baseTable="HLS_SMS_LIST">
    <bm:fields>
        <bm:field name="sms_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="SMS_ID" prompt="HLS_SMS_LIST.SMS_ID"/>
        <bm:field name="phone_number" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PHONE_NUMBER" prompt="HLS_SMS_LIST.PHONE_NUMBER"/>
        <bm:field name="content" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CONTENT" prompt="HLS_SMS_LIST.CONTENT"/>
        <bm:field name="signature" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="SIGNATURE" prompt="HLS_SMS_LIST.SIGNATURE"/>
        <bm:field name="channel" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CHANNEL" prompt="HLS_SMS_LIST.CHANNEL"/>
        <bm:field name="response" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="RESPONSE" prompt="HLS_SMS_LIST.RESPONSE"/>
        <bm:field name="priority" databaseType="NUMBER" datatype="java.lang.Long" physicalName="PRIORITY" prompt="HLS_SMS_LIST.PRIORITY"/>
        <bm:field name="status" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="STATUS" prompt="HLS_SMS_LIST.STATUS"/>
        <bm:field name="send_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="SEND_FLAG" prompt="HLS_SMS_LIST.SEND_FLAG"/>
        <bm:field name="send_times" databaseType="NUMBER" datatype="java.lang.Long" physicalName="SEND_TIMES" prompt="HLS_SMS_LIST.SEND_TIMES"/>
        <bm:field name="fsirst_send_date" databaseType="DATE" datatype="java.util.Date" physicalName="FIRST_SEND_DATE" prompt="HLS_SMS_LIST.FIRST_SEND_DATE"/>
        <bm:field name="sms_send_date" databaseType="DATE" datatype="java.util.Date" physicalName="SMS_SEND_DATE" prompt="HLS_SMS_LIST.SMS_SEND_DATE"/>
        <bm:field name="balance" databaseType="NUMBER" datatype="java.lang.Long" physicalName="BALANCE" prompt="HLS_SMS_LIST.BALANCE"/>
        <bm:field name="source_table" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="SOURCE_TABLE" prompt="HLS_SMS_LIST.SOURCE_TABLE"/>
        <bm:field name="source_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="SOURCE_ID" prompt="HLS_SMS_LIST.SOURCE_ID"/>
        <bm:field name="contract_number" expression="(select b.contract_number from con_contract_cashflow a,con_contract b where a.contract_id=b.contract_id and a.cashflow_id=t1.source_id)"/>
        <bm:field name="tenant_name" expression="(select b.bp_name from con_contract a,hls_bp_master b,con_contract_cashflow c where a.contract_id=c.contract_id and a.bp_id_tenant=b.bp_id and c.cashflow_id=t1.source_id)"/>
        <bm:field name="sms_type_des" expression="(select a.code_value_name from sys_code_values_v a where a.code=&apos;YONDA_SMS_NAME&apos; and a.code_value=t1.sms_type  )"/>
    </bm:fields>
    <bm:features>
        <f:standard-who/>
    </bm:features>
    <bm:primary-key>
        <bm:pk-field name="sms_id"/>
    </bm:primary-key>
    <bm:query-fields>
        <bm:query-field name="contract_number" queryExpression="(select b.contract_number from con_contract_cashflow a,con_contract b where a.contract_id=b.contract_id and a.cashflow_id=t1.source_id) like ${@contract_number}"/>
        <bm:query-field name="tenant_name" queryExpression="(select b.bp_name from con_contract a,hls_bp_master b,con_contract_cashflow c where a.contract_id=c.contract_id and a.bp_id_tenant=b.bp_id and c.cashflow_id=t1.source_id) like ${@tenant_name}"/>
        <bm:query-field name="sms_type" queryExpression="t1.sms_type=${@sms_type}"/>
    </bm:query-fields>
    <bm:operations>
        <bm:operation name="update">
            <bm:update-sql><![CDATA[
         begin
         ${@v_return_char}:=hls_sms_ws_pkg.call_send_sms;
         end;
         ]]></bm:update-sql>
            <bm:parameters>
                <bm:parameter name="v_return_char" dataType="java.lang.String" output="true" outputPath="@v_return_char"/>
            </bm:parameters>
        </bm:operation>
    </bm:operations>
</bm:model>
