标签:text 枚举类 开始 org server map size 传参 union
mybatis的原因!!!!!
数据库这个样子
在postman中调用接口:SQL
select * from T_TRAIN_MARSHALLING where TRAIN_NUM is null and PRE_TRAIN_NUMBER is null and RECEIVE_SEND=#{RECEIVE_SEND} union all select * from T_TRAIN_MARSHALLING where TRAIN_NUM = #{TRAIN_NUM} and PRE_TRAIN_NUMBER is null
查询结果:
在SQLserver中的测试如下:
然后就开始找原因,解决方案就是加trim,这个很恶心,或者mybaits下就不要用char了
select * from T_TRAIN_MARSHALLING where TRAIN_NUM is null and PRE_TRAIN_NUMBER is null and trim(RECEIVE_SEND)=#{RECEIVE_SEND}
union all
select * from T_TRAIN_MARSHALLING where TRAIN_NUM = #{TRAIN_NUM} and PRE_TRAIN_NUMBER is null
<typeHandlers> <!--Oracle CHAR fix --> <typeHandler handler="cn.com.git.cbs.mybatis.typehandler.OracleCharStringTypeHandler" javaType="String" jdbcType="CHAR" /> </typeHandlers>
/* * @author XueWeiWei * @date 2019/8/14 14:01 */ public class OracleCharStringTypeHandler implements TypeHandler<String> { @Override public void setParameter(PreparedStatement ps, int i, String parameter, JdbcType jdbcType) throws SQLException { OraclePreparedStatement ops = ps.unwrap(OraclePreparedStatement.class); ops.setFixedCHAR(i, parameter); } }
标签:text 枚举类 开始 org server map size 传参 union
原文地址:https://www.cnblogs.com/xww115/p/11351567.html