diff --git a/src/main/java/com/iflytop/colortitration/common/handler/DeviceTypeHandler.java b/src/main/java/com/iflytop/colortitration/common/handler/DeviceTypeHandler.java deleted file mode 100644 index bc61ca2..0000000 --- a/src/main/java/com/iflytop/colortitration/common/handler/DeviceTypeHandler.java +++ /dev/null @@ -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 { - - @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); - } -} \ No newline at end of file