场景

在使用MyBatis传递多个参数并且传递的参数作为判断条件时提示:

invalid comparison: java.util.LinkedHashMap and java.lang.String

 

 

注:

博客:
https://blog.csdn.net/badao_liumang_qizhi
关注公众号
霸道的程序猿
获取编程相关电子书、教程推送与免费下载。

实现

在Mapper文件中使用动态sql时,对传递的参数进行判断时使用了如下的

        <where>
            <if test="#{lx} != null  and #{lx}!= ''"> and g.ryfl = #{lx}</if>
        </where>

在test语句中使用了#{lx}

正确应该是直接使用参数名

        <where>
            <if test="lx != null  and lx!= ''"> and g.ryfl = #{lx}</if>
        </where>

 

posted on 2020-07-20 22:28  霸道流氓  阅读(1748)  评论(0编辑  收藏  举报

Live2D