|
|
@ -1,40 +0,0 @@ |
|
|
|
package com.iflytop.colortitration.common.handler; |
|
|
|
|
|
|
|
import com.iflytop.colortitration.common.enums.Device; |
|
|
|
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; |
|
|
|
|
|
|
|
@MappedJdbcTypes(JdbcType.VARCHAR) |
|
|
|
@MappedTypes(Device.class) |
|
|
|
public class DeviceTypeHandler extends BaseTypeHandler<Device> { |
|
|
|
|
|
|
|
@Override |
|
|
|
public void setNonNullParameter(PreparedStatement ps, int i, Device parameter, JdbcType jdbcType) throws SQLException { |
|
|
|
ps.setString(i, parameter.name()); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Device getNullableResult(ResultSet rs, String columnName) throws SQLException { |
|
|
|
String name = rs.getString(columnName); |
|
|
|
return name == null ? null : Device.valueOf(name); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Device getNullableResult(ResultSet rs, int columnIndex) throws SQLException { |
|
|
|
String name = rs.getString(columnIndex); |
|
|
|
return name == null ? null : Device.valueOf(name); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Device getNullableResult(CallableStatement cs, int columnIndex) throws SQLException { |
|
|
|
String name = cs.getString(columnIndex); |
|
|
|
return name == null ? null : Device.valueOf(name); |
|
|
|
} |
|
|
|
} |