<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
			select * from(
                SELECT hls_notice_definition_id,notice_msg,notice_name,user_show_flag,dealer_show_flag,sequence_num,to_char(start_date,'yyyy-mm-dd') start_date,to_char(end_date,'yyyy-mm-dd') end_date from(
                      SELECT t.hls_notice_definition_id,t.notice_name,t.notice_msg,t.user_show_flag,t.dealer_show_flag,t.sequence_num,
                      t.start_date,t.end_date
                      FROM hls_notice_definition t
                    ) t1
                    where t1.start_date <= trunc(sysdate)
                    and 
                    nvl(t1.end_date,sysdate) >= trunc(sysdate)
                    and (hls_common_pkg.show_notice(t1.hls_notice_definition_id,${/session/@user_id})) = 'Y'
                    ) t2
                    #WHERE_CLAUSE#
                ORDER BY t2.sequence_num desc
                
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="hls_notice_definition_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="HLS_NOTICE_DEFINITION_ID" required="true"/>
        <bm:field name="notice_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="NOTICE_NAME" required="true"/>
        <bm:field name="notice_msg" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="NOTICE_MSG"/>
        <bm:field name="user_show_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="USER_SHOW_FLAG"/>
        <bm:field name="dealer_show_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DEALER_SHOW_FLAG"/>
        <bm:field name="sequence_num" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="SEQUENCE_NUM"/>
        <bm:field name="start_date" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="START_DATE"/>
        <bm:field name="end_date" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="END_DATE"/>
    </bm:fields>
    <bm:query-fields>
        <bm:query-field field="hls_notice_definition_id" queryExpression="hls_notice_definition_id = ${/parameter/@hls_notice_definition_id}"/>
        <bm:query-field field="notice_name" queryOperator="like"/>
        <bm:query-field field="notice_msg" queryOperator="like"/>
        <bm:query-field field="start_date" queryExpression="t2.start_date &gt;= ${@start_date}"/>
        <bm:query-field field="end_date" queryExpression="t2.end_date &lt;= ${@end_date}"/>
    </bm:query-fields>
</bm:model>
