package com.nova.sankuai.domain.enums.alipayrefund;
|
|
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.CallableStatement;
|
import java.sql.PreparedStatement;
|
import java.sql.ResultSet;
|
import java.sql.SQLException;
|
|
@MappedTypes(RefundStatus.class)
|
@MappedJdbcTypes(JdbcType.VARCHAR)
|
public class RefundStatusTypeHandler extends BaseTypeHandler<RefundStatus> {
|
@Override
|
public void setNonNullParameter(PreparedStatement ps, int i, RefundStatus parameter, JdbcType jdbcType) throws SQLException {
|
ps.setInt(i, parameter.getCode());
|
}
|
|
@Override
|
public RefundStatus getNullableResult(ResultSet rs, String columnName) throws SQLException {
|
return RefundStatus.fromCode(rs.getInt(columnName));
|
}
|
|
@Override
|
public RefundStatus getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
|
return RefundStatus.fromCode(rs.getInt(columnIndex));
|
}
|
|
@Override
|
public RefundStatus getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
|
return RefundStatus.fromCode(cs.getInt(columnIndex));
|
}
|
}
|