sunshine
2024-11-05 1bd51ea22b75760704843d9bed886a7262bb1cb1
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
34
35
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));
    }
}