jar파일 내부에 utility.xml 추가

main
이범준 2 months ago
parent ad0bd92db7
commit 1b6841ae90

@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="utility-jar">
<!-- For Maria DB -->
<sql id="paging-prefix">
<if test="fetchSize != null and fetchSize &gt; 0">
SELECT QROWS.* FROM (
SELECT ROW_NUMBER() OVER(<include refid="utility-jar.sortBy" />) ROW_NUM
, COUNT(*) OVER() TOT_CNT, QBODY.*
FROM (</if>
</sql>
<sql id="paging-suffix">
<if test="fetchSize != null and fetchSize &gt; 0"> ) QBODY
) QROWS
WHERE ROW_NUM BETWEEN ((#{pageNum} - 1) * #{fetchSize}) + 1 AND (#{pageNum} * #{fetchSize})</if>
</sql>
<select id="foundRows" resultType="dataobject">/* 전체 결과수 가져오기(utility-jar.foundRows) */
SELECT FOUND_ROWS() TOT_CNT
</select>
<sql id="sortBy">
<if test="orderBy != null and orderBy != ''">ORDER BY ${orderBy}</if>
</sql>
<sql id="orderBy">
<if test="fetchSize == null or fetchSize &lt; 1"><include refid="utility-jar.sortBy" /></if>
</sql>
<sql id="now">
<if test="_databaseId == 'mariadb'">DATE_FORMAT(CURRENT_TIMESTAMP, '%Y%m%d%H%i%s')</if>
<if test="_databaseId == 'oracle'">TO_CHAR(CURRENT_TIMESTAMP, 'YYYYMMDDHH24MISS')</if>
</sql>
<sql id="selectNow">SELECT<include refid="utility-jar.now" />NOW FROM DUAL</sql>
<sql id="today">
<if test="_databaseId == 'mariadb'">DATE_FORMAT(CURRENT_DATE, '%Y%m%d')</if>
<if test="_databaseId == 'oracle'">TO_CHAR(CURRENT_DATE, 'YYYYMMDD')</if>
</sql>
<sql id="selectToday">
SELECT<include refid="utility-jar.today" />TODAY FROM DUAL
</sql>
<sql id="thisDay">
NVL(#{thisDay},<include refid="utility-jar.today" />)
</sql>
<sql id="selectThisDay">
SELECT<include refid="utility-jar.thisDay" />THIS_DAY FROM DUAL
</sql>
<sql id="currentYear">
<if test="_databaseId == 'mariadb'">DATE_FORMAT(CURRENT_DATE, '%Y')</if>
<if test="_databaseId == 'oracle'">TO_CHAR(CURRENT_DATE, 'YYYY')</if>
</sql>
</mapper>
Loading…
Cancel
Save