gdg
2020-12-23 6207311d7df3d47d27fdd78de33f49875550f52f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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));
    }
}