package com.nanometer.smartlab.entity.handler;
|
|
import com.nanometer.smartlab.entity.enumtype.ReplaceDictType;
|
import org.apache.ibatis.type.BaseTypeHandler;
|
import org.apache.ibatis.type.JdbcType;
|
|
import java.sql.CallableStatement;
|
import java.sql.PreparedStatement;
|
import java.sql.ResultSet;
|
import java.sql.SQLException;
|
|
public class ReplaceDictTypeHandler extends BaseTypeHandler<ReplaceDictType> {
|
|
@Override
|
public void setNonNullParameter(PreparedStatement ps, int i, ReplaceDictType parameter, JdbcType jdbcType) throws SQLException {
|
ps.setInt(i, parameter.getKey());
|
}
|
|
@Override
|
public ReplaceDictType getNullableResult(ResultSet rs, String columnName) throws SQLException {
|
return ReplaceDictType.parse(rs.getInt(columnName));
|
}
|
|
@Override
|
public ReplaceDictType getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
|
return ReplaceDictType.parse(rs.getInt(columnIndex));
|
}
|
|
@Override
|
public ReplaceDictType getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
|
return ReplaceDictType.parse(cs.getInt(columnIndex));
|
}
|
}
|