admin
2019-02-21 7e57a20c0ccde504c2f2b2b9fd4a9fd7c89d5e92
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package org.fanli.facade.user.util.typehandler;
 
import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
 
import org.apache.ibatis.type.BaseTypeHandler;
import org.apache.ibatis.type.JdbcType;
import org.fanli.facade.user.entity.money.msg.MsgMoneyDetail.MsgTypeMoneyTypeEnum;
 
public class MsgTypeMoneyTypeEnumHandler extends BaseTypeHandler<MsgTypeMoneyTypeEnum> {
 
    @Override
    public MsgTypeMoneyTypeEnum getNullableResult(ResultSet arg0, String arg1) throws SQLException {
        String key = arg0.getString(arg1);
        if (arg0.wasNull()) {
            return null;
        } else {
            return MsgTypeMoneyTypeEnum.valueOf(key);
        }
    }
 
    @Override
    public MsgTypeMoneyTypeEnum getNullableResult(ResultSet arg0, int arg1) throws SQLException {
        String key = arg0.getString(arg1);
        if (arg0.wasNull()) {
            return null;
        } else {
            // 根据数据库中的key值,定位SexEnum子类
            return MsgTypeMoneyTypeEnum.valueOf(key);
        }
    }
 
    @Override
    public MsgTypeMoneyTypeEnum getNullableResult(CallableStatement arg0, int arg1) throws SQLException {
        String key = arg0.getString(arg1);
        if (arg0.wasNull()) {
            return null;
        } else {
            // 根据数据库中的key值,定位SexEnum子类
            return MsgTypeMoneyTypeEnum.valueOf(key);
        }
    }
 
    @Override
    public void setNonNullParameter(PreparedStatement arg0, int arg1, MsgTypeMoneyTypeEnum arg2, JdbcType arg3)
            throws SQLException {
        arg0.setString(arg1, arg2.name());
    }
 
}