2022-04-20 08:40:27.664 [http-nio-8080-exec-4] ERROR
o.jeecg.common.exception.JeecgBootExceptionHandler:58 -

### Error querying database. Cause:
org.postgresql.util.PSQLException: 错误: 操作符不存在: smallint = character
varying 建议:没有匹配指定名称和参数类型的操作符. 您也许需要增加明确的类型转换. 位置:1469

postgresql对变量类型比较敏感,对相应的变量进行类型转换之后就可以了

修改前

<if test="lx !=null and  lx.size>0 ">
            AND t.lx in
            <foreach collection="lx" item="lxItem" separator="," open="(" close=")">
            #{lxItem} 
            </foreach>
        </if>

修改后

<if test="lx !=null and  lx.size>0 ">
            AND t.lx in
            <foreach collection="lx" item="lxItem" separator="," open="(" close=")">
                CAST(#{lxItem} AS SMALLINT)
            </foreach>
        </if>

参考资料:

  1. https://blog.csdn.net/CS_370682/article/details/108484152
  2. http://www.zzvips.com/article/144729.html
Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐