问题:<select id="" resultMap="resultMapPlate" parameterType="java.lang.String">
<if test="com != null">
and com = #{com,jdbcType=VARCHAR}
</if>
and open='chat'
</select>
解决:将<if test="com != null"> 换为<if test="_parameter != null">
本文介绍了一种在MyBatis中优化if条件判断的方法,通过将默认的if test=com !=null更改为if test=_parameter!=null,可以避免SQL语法错误,确保当参数为null时,SQL语句仍能正确执行。
2万+

被折叠的 条评论
为什么被折叠?



