con_get_period.lwm 1.46 KB
Newer Older
Spencer Chang's avatar
Spencer Chang committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: chenlingfeng7543
$Date: 2018/8/13 11:13
$Revision: 1.0
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" needAccessControl="false">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
select to_char(sysdate,'yyyy-mm-dd') now_date, --当前时间
       to_char(nvl(to_date(${@current_date},'yyyy-mm-dd'),sysdate), 'yyyy') now_year, --年
       to_char(nvl(to_date(${@current_date},'yyyy-mm-dd'),sysdate), 'MM') now_month, --月
       to_char(nvl(to_date(${@current_date},'yyyy-mm-dd'),sysdate), 'dd') now_day, --日
       to_char(trunc(sysdate, 'mm'),'yyyy-mm-dd') month_first_day, --当月第一天
       trunc(last_day(nvl(to_date(${@current_date},'yyyy-mm-dd'),sysdate))) month_last_day, --当月最后一天
       trunc(add_months(nvl(to_date(${@current_date},'yyyy-mm-dd'),sysdate), 1), 'mm') next_month_first_day, --下个月第一天
       to_char(nvl(to_date(${@current_date},'yyyy-mm-dd'),sysdate), 'Q') quarter, --季度
       to_char(nvl(to_date(${@current_date},'yyyy-mm-dd'),sysdate), 'D') week_day, --本周的第几天,周日为第一天
       to_char(nvl(to_date(${@current_date},'yyyy-mm-dd'),sysdate), 'WW') year_week_num, --本周是当年的第几周
       to_char(nvl(to_date(${@current_date},'yyyy-mm-dd'),sysdate), 'W') month_week_num --本周是当月的第几周
  from dual
]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
</bm:model>