package com.nanometer.smartlab.entity.handler;
|
|
import com.nanometer.smartlab.entity.enumtype.RealStatus;
|
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 RealStatusHandler extends BaseTypeHandler<RealStatus> {
|
|
@Override
|
public RealStatus getNullableResult(ResultSet rs, String index) throws SQLException {
|
return RealStatus.parse(rs.getInt(index));
|
}
|
|
@Override
|
public RealStatus getNullableResult(ResultSet rs, int index) throws SQLException {
|
return RealStatus.parse(rs.getInt(index));
|
}
|
|
@Override
|
public RealStatus getNullableResult(CallableStatement cs, int index) throws SQLException {
|
return RealStatus.parse(cs.getInt(index));
|
}
|
|
@Override
|
public void setNonNullParameter(PreparedStatement ps, int index, RealStatus val, JdbcType arg3) throws SQLException {
|
ps.setInt(index, val.getKey());
|
}
|
}
|