Mybatis:caused by: : Error evaluating expression ‘‘

时间:2025-02-18 08:34:14

1、报错信息

caused by:  : Error evaluating expression ''
xxxxxxxxx
xxxxxxxxx

2、我遇到的报错场景

传入:type==null

      @Param("s") 实体类 
     <if test=" !=null">
	      and type=#{}
	 </if>

3、解决方法

在外面增加一层判断—

        <if test="s !=null ">
			<if test=" !=null">
				and type=#{}
			</if>
		</if>

或者这样写

		<if test="s !=null and  !=null">
			and type=#{}
		</if>