课表申请功能重写 bug修复
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
package com.roomroot.jwgl.handler;
|
||||
|
||||
import com.roomroot.jwgl.utils.UuidUtil;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 达梦 VARBINARY(16) GUID 与 Java 字符串互转。
|
||||
* <p>
|
||||
* 仅通过实体 / resultMap 显式引用,避免把其它 VARBINARY 字段都当成 UUID。
|
||||
* 禁止把带横线的 CHAR UUID 直接绑定到 VARBINARY,达梦会按十六进制解析并报 -6147。
|
||||
* </p>
|
||||
*/
|
||||
public class DmGuidTypeHandler extends BaseTypeHandler<String> {
|
||||
|
||||
@Override
|
||||
public void setNonNullParameter(PreparedStatement ps, int i, String parameter, JdbcType jdbcType)
|
||||
throws SQLException {
|
||||
ps.setBytes(i, UuidUtil.toBytes(parameter));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNullableResult(ResultSet rs, String columnName) throws SQLException {
|
||||
return UuidUtil.fromBytes(rs.getBytes(columnName));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
|
||||
return UuidUtil.fromBytes(rs.getBytes(columnIndex));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
|
||||
return UuidUtil.fromBytes(cs.getBytes(columnIndex));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user