parent
5b977d602f
commit
75828ce439
@ -0,0 +1,35 @@
|
||||
package com.bsmlab.dfx.dfxconsole.framework.support.mybatis.handler;
|
||||
|
||||
import org.apache.ibatis.type.BaseTypeHandler;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
import org.apache.ibatis.type.MappedJdbcTypes;
|
||||
import org.apache.ibatis.type.MappedTypes;
|
||||
|
||||
import java.sql.*;
|
||||
|
||||
@MappedTypes(Long.class)
|
||||
@MappedJdbcTypes(JdbcType.TIMESTAMP_WITH_TIMEZONE)
|
||||
public class EpochMillisWithTimeZoneTypeHandler extends BaseTypeHandler<Long> {
|
||||
@Override
|
||||
public void setNonNullParameter(PreparedStatement ps, int i, Long parameter, JdbcType jdbcType) throws SQLException {
|
||||
ps.setTimestamp(i, new Timestamp(parameter)); // 밀리초 → java.sql.Timestamp
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getNullableResult(ResultSet rs, String columnName) throws SQLException {
|
||||
Timestamp ts = rs.getTimestamp(columnName);
|
||||
return ts == null ? null : ts.getTime(); // Timestamp → 밀리초 long
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
|
||||
Timestamp ts = rs.getTimestamp(columnIndex);
|
||||
return ts == null ? null : ts.getTime();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
|
||||
Timestamp ts = cs.getTimestamp(columnIndex);
|
||||
return ts == null ? null : ts.getTime();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
log4jdbc.spylogdelegator.name=net.sf.log4jdbc.log.slf4j.Slf4jSpyLogDelegator
|
||||
log4jdbc.dump.sql.maxlinelength=-1
|
||||
log4jdbc.dump.sql.select=true
|
||||
log4jdbc.dump.sql.insert=true
|
||||
log4jdbc.dump.sql.update=true
|
||||
log4jdbc.dump.sql.delete=true
|
||||
log4jdbc.trim.sql=true
|
||||
Loading…
Reference in new issue