mirror of
https://gitee.com/elegant_wings/xiongan-meeting.git
synced 2025-06-22 03:49:36 +08:00
45 lines
1.5 KiB
Java
45 lines
1.5 KiB
Java
![]() |
package com.ics.admin.handler;
|
||
|
|
||
|
import com.ics.admin.domain.Customer;
|
||
|
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;
|
||
|
|
||
|
/**
|
||
|
* @author zzm
|
||
|
*/
|
||
|
@MappedJdbcTypes({JdbcType.INTEGER})
|
||
|
@MappedTypes({Customer.CustomerStatus.class})
|
||
|
public class CustomerStatusEnumHandler extends BaseTypeHandler<Customer.CustomerStatus> {
|
||
|
|
||
|
@Override
|
||
|
public void setNonNullParameter(PreparedStatement preparedStatement, int i, Customer.CustomerStatus customerStatus, JdbcType jdbcType) throws SQLException {
|
||
|
preparedStatement.setInt(i,customerStatus.getValue());
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public Customer.CustomerStatus getNullableResult(ResultSet resultSet, String columnName) throws SQLException {
|
||
|
int value = resultSet.getInt(columnName);
|
||
|
Customer.CustomerStatus instance = Customer.CustomerStatus.parse(value);
|
||
|
return instance;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public Customer.CustomerStatus getNullableResult(ResultSet resultSet, int columnIndex) throws SQLException {
|
||
|
int value = resultSet.getInt(columnIndex);
|
||
|
Customer.CustomerStatus instance = Customer.CustomerStatus.parse(value);
|
||
|
return instance;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public Customer.CustomerStatus getNullableResult(CallableStatement callableStatement, int i) throws SQLException {
|
||
|
return null;
|
||
|
}
|
||
|
}
|