databaseIdProvider 추가

master
mjkhan21 11 months ago
parent d887642502
commit 7172ee6724

@ -20,11 +20,20 @@
-->
</bean>
<bean id="databaseIdProvider" class="org.apache.ibatis.mapping.VendorDatabaseIdProvider">
<property name="properties">
<props>
<prop key="Oracle">oracle</prop>
<prop key="MariaDB">mariadb</prop>
</props>
</property>
</bean>
<bean id="sqlSession" class="org.mybatis.spring.SqlSessionFactoryBean"
p:dataSource-ref="dataSource"
p:configLocation="classpath:sql/mybatis-config.xml"
p:mapperLocations="classpath:sql/mapper/**/*.xml"
/>
p:databaseIdProvider-ref="databaseIdProvider"/>
<bean id="mapperConfigurer" class="org.egovframe.rte.psl.dataaccess.mapper.MapperConfigurer">
<property name="basePackage" value="cokr.xit" />

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

Loading…
Cancel
Save