<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" baseTable="csh_terminal_manager" needAccessControl="false" xmlns:o="leaf.database.local.oracle" xmlns:f="leaf.database.features" alias="t1">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
	            SELECT * FROM ( select manager_id,terminal_number,administrant,agent_id,

	             (select EXTRA_NAM from HLS_BP_MASTER where bp_id = ctm.agent_id) agent_name,

	              provide_date,hand_over_date,enabled_flag,use_zone,notes from csh_terminal_manager ctm

                  order by manager_id
                  )t1

	             #WHERE_CLAUSE#

	             #ORDER_BY_CLAUSE#
	        ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="manager_id"/>
        <bm:field name="terminal_number"/>
        <bm:field name="administrant"/>
        <bm:field name="use_zone"/>
        <bm:field name="agent_id"/>
        <bm:field name="agent_name" forUpdate="false" forInsert="false"/>
        <bm:field name="provide_date"  datatype="java.util.Date"/>
        <bm:field name="hand_over_date"  datatype="java.util.Date"/>
        <bm:field name="enabled_flag"/>
        <bm:field name="notes"/>
    </bm:fields>

    <bm:features>
        <f:standard-who/>
        <o:sequence-pk/>
    </bm:features>

    <bm:primary-key>
        <bm:pk-field name="manager_id"/>
    </bm:primary-key>

    <bm:query-fields>
        <bm:query-field name="terminal_number" queryExpression="t1.terminal_number = ${@terminal_number}"/>
        <bm:query-field name="administrant" queryExpression="t1.administrant like &apos;%&apos;||${@administrant}||&apos;%&apos;"/>
        <bm:query-field name="agent_name" queryExpression="t1.agent_name like &apos;%&apos;||${@agent_name}||&apos;%&apos;"/>
        <bm:query-field name="provide_date" queryExpression="t1.provide_date = to_date(${@provide_date},'yyyy-mm-dd')"/>
        <bm:query-field name="hand_over_date" queryExpression="t1.hand_over_date = to_date(${@hand_over_date},'yyyy-mm-dd')"/>
        <bm:query-field name="enabled_flag" queryExpression="t1.enabled_flag = ${@enabled_flag}"/>
    </bm:query-fields>
</bm:model>
