IFNULL -> NVL, 추가: now, today 오라클 버젼, MapperSupport, download()

master
mjkhan21 11 months ago
parent 12a56a6dfd
commit 3b38866be5

@ -57,7 +57,7 @@ SELECT A.*, REPLACE(FILE_PATH, 'C://workspace/xit/base', '') URL
<selectKey keyProperty="file.id,file.path" keyColumn="NEW_ID,PATH" resultType="map" order="BEFORE"> <selectKey keyProperty="file.id,file.path" keyColumn="NEW_ID,PATH" resultType="map" order="BEFORE">
SELECT NEW_ID, CONCAT(DIR, NEW_ID, '.', #{file.extension}) PATH SELECT NEW_ID, CONCAT(DIR, NEW_ID, '.', #{file.extension}) PATH
FROM ( FROM (
SELECT IFNULL(MAX(FILE_ID) + 1, CONCAT(THIS_DAY, '00001')) NEW_ID SELECT NVL(MAX(FILE_ID) + 1, CONCAT(THIS_DAY, '00001')) NEW_ID
FROM TB_FILE A, (<include refid="utility.selectThisDay" />) B FROM TB_FILE A, (<include refid="utility.selectThisDay" />) B
WHERE FILE_ID LIKE CONCAT(THIS_DAY, '%') WHERE FILE_ID LIKE CONCAT(THIS_DAY, '%')
) T1, ( ) T1, (

@ -31,7 +31,7 @@ SELECT A.*
<insert id="insertMenu" parameterType="map">/* 메뉴 등록(menuMapper.insertMenu) */ <insert id="insertMenu" parameterType="map">/* 메뉴 등록(menuMapper.insertMenu) */
<selectKey order="BEFORE" resultType="map" keyColumn="NEW_NO,NEW_ORD" keyProperty="menu.id,menu.sortOrder"> <selectKey order="BEFORE" resultType="map" keyColumn="NEW_NO,NEW_ORD" keyProperty="menu.id,menu.sortOrder">
SELECT NEW_NO, NEW_ORD SELECT NEW_NO, NEW_ORD
FROM (SELECT IFNULL(MAX(MENU_NO) + 1, 0) NEW_NO FROM TB_MENU) A, FROM (SELECT NVL(MAX(MENU_NO) + 1, 0) NEW_NO FROM TB_MENU) A,
(<include refid="newSortOrder" />) B</selectKey> (<include refid="newSortOrder" />) B</selectKey>
INSERT INTO TB_MENU ( INSERT INTO TB_MENU (
MENU_NO MENU_NO
@ -69,7 +69,7 @@ UPDATE TB_MENU SET
, IMG_CNF = #{menu.imageConf} , IMG_CNF = #{menu.imageConf}
WHERE MENU_NO = #{menu.id}</update> WHERE MENU_NO = #{menu.id}</update>
<sql id="newSortOrder">SELECT IFNULL(MAX(SRT_ORD) + 1, 0) NEW_ORD FROM TB_MENU WHERE PRNT_NO = IFNULL(#{parentID}, IFNULL(#{menu.parentID}, 0))</sql> <sql id="newSortOrder">SELECT NVL(MAX(SRT_ORD) + 1, 0) NEW_ORD FROM TB_MENU WHERE PRNT_NO = NVL(#{parentID}, NVL(#{menu.parentID}, 0))</sql>
<update id="moveMenus" parameterType="map">/* 메뉴 이동(menuMapper.moveMenus) */ <update id="moveMenus" parameterType="map">/* 메뉴 이동(menuMapper.moveMenus) */
UPDATE TB_MENU SET UPDATE TB_MENU SET

@ -89,7 +89,7 @@ SELECT *
AND NSTT_CD = #{institute}</select> AND NSTT_CD = #{institute}</select>
<insert id="insertUser" parameterType="cokr.xit.base.user.ManagedUser"> <insert id="insertUser" parameterType="cokr.xit.base.user.ManagedUser">
<selectKey resultType="string" keyProperty="id" keyColumn="NEW_ID" order="BEFORE">SELECT LPAD(IFNULL(MAX(USER_ID) + 1, 1), 10, '0') NEW_ID FROM TB_USER</selectKey> <selectKey resultType="string" keyProperty="id" keyColumn="NEW_ID" order="BEFORE">SELECT LPAD(NVL(MAX(USER_ID) + 1, 1), 10, '0') NEW_ID FROM TB_USER</selectKey>
/* 사용자 정보 등록(userMapper.insertUser) */ /* 사용자 정보 등록(userMapper.insertUser) */
INSERT INTO TB_USER ( INSERT INTO TB_USER (
USER_ID USER_ID

@ -20,16 +20,23 @@ SELECT FOUND_ROWS() TOT_CNT</select>
<sql id="orderBy"><if test="fetchSize == null or fetchSize &lt; 1"><include refid="utility.sortBy" /></if></sql> <sql id="orderBy"><if test="fetchSize == null or fetchSize &lt; 1"><include refid="utility.sortBy" /></if></sql>
<sql id="now">DATE_FORMAT(CURRENT_TIMESTAMP(), '%Y%m%d%H%i%s')</sql> <!-- 마리아 DB -->
<sql id="now">DATE_FORMAT(CURRENT_TIMESTAMP, '%Y%m%d%H%i%s')</sql>
<sql id="selectNow">SELECT<include refid="utility.now" />NOW</sql>
<sql id="today">DATE_FORMAT(CURRENT_DATE, '%Y%m%d')</sql> <sql id="today">DATE_FORMAT(CURRENT_DATE, '%Y%m%d')</sql>
<sql id="selectToday">SELECT<include refid="utility.today" />TODAY</sql> <!-- 오라클
<sql id="now">TO_CHAR(CURRENT_TIMESTAMP, 'YYYYMMDDHH24MISS')</sql>
<sql id="today">TO_CHAR(CURRENT_DATE, 'YYYYMMDD')</sql>
-->
<sql id="selectNow">SELECT<include refid="utility.now" />NOW FROM DUAL</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="thisDay">NVL(#{thisDay},<include refid="utility.today" />)</sql>
<sql id="selectThisDay">SELECT<include refid="utility.thisDay" />THIS_DAY</sql> <sql id="selectThisDay">SELECT<include refid="utility.thisDay" />THIS_DAY FROM DUAL</sql>
</mapper> </mapper>

@ -19,7 +19,7 @@
</typeHandlers> </typeHandlers>
<plugins> <plugins>
<plugin interceptor="cokr.xit.foundation.data.paging.PagingSupport" /> <plugin interceptor="cokr.xit.foundation.data.paging.MapperSupport" />
</plugins> </plugins>
</configuration> </configuration>

@ -227,7 +227,7 @@ var ajax = {
dialog.alert({ dialog.alert({
title:resp.title, title:resp.title,
content:resp.message content:[resp.description, resp.message].join("<br />")
}); });
debug("stacktrace", stacktrace); debug("stacktrace", stacktrace);

@ -1275,6 +1275,7 @@ class DatasetControl {
_load() { _load() {
if (!this.query.pageNum) if (!this.query.pageNum)
this.query.pageNum = 1; this.query.pageNum = 1;
ajax.get({ ajax.get({
url:this.urls.load, url:this.urls.load,
data:this.query, data:this.query,
@ -1287,6 +1288,14 @@ class DatasetControl {
} }
}); });
} }
download(all) {
if (all)
this.query.fetchAll = all;
let query = toQuery(this.query);
this.query.download = this.query.fetchAll = null;
document.location.href = this.urls.load + "? " + query;
}
setData(obj) { setData(obj) {
this.dataset.setData(obj); this.dataset.setData(obj);

Loading…
Cancel
Save