sql mapper 추가
parent
c28d281aff
commit
057b00c823
@ -0,0 +1,15 @@
|
|||||||
|
<?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="cokr.xit.foundation.test.TestMapper">
|
||||||
|
|
||||||
|
<select id="select" parameterType="map" resultType="dataobject">${sql}</select>
|
||||||
|
|
||||||
|
<insert id="insert" parameterType="map">${sql}</insert>
|
||||||
|
|
||||||
|
<update id="update" parameterType="map">${sql}</update>
|
||||||
|
|
||||||
|
<delete id="delete" parameterType="map">${sql}</delete>
|
||||||
|
|
||||||
|
<update id="commit">COMMIT</update>
|
||||||
|
|
||||||
|
</mapper>
|
@ -0,0 +1,37 @@
|
|||||||
|
<?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">
|
||||||
|
|
||||||
|
<!-- For Maria DB -->
|
||||||
|
<sql id="paging-prefix"><if test="fetchSize != null and fetchSize > 0">
|
||||||
|
SELECT QROWS.* FROM (
|
||||||
|
SELECT ROW_NUMBER() OVER(<include refid="utility.sortBy" />) ROW_NUM
|
||||||
|
, COUNT(*) OVER() TOT_CNT, QBODY.*
|
||||||
|
FROM (</if></sql>
|
||||||
|
|
||||||
|
<sql id="paging-suffix"><if test="fetchSize != null and fetchSize > 0"> ) QBODY
|
||||||
|
) QROWS
|
||||||
|
WHERE ROW_NUM BETWEEN ((#{pageNum} - 1) * #{fetchSize}) + 1 AND (#{pageNum} * #{fetchSize})</if></sql>
|
||||||
|
|
||||||
|
<select id="foundRows" resultType="dataobject">/* 전체 결과수 가져오기(utility.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 < 1"><include refid="utility.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.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.today" />TODAY FROM DUAL</sql>
|
||||||
|
|
||||||
|
<sql id="thisDay">IFNULL(#{thisDay},<include refid="utility.today" />)</sql>
|
||||||
|
|
||||||
|
<sql id="selectThisDay">SELECT<include refid="utility.thisDay" />THIS_DAY</sql>
|
||||||
|
|
||||||
|
</mapper>
|
Loading…
Reference in New Issue