在MyBatis中,if语句的条件表达式书写规范如下:
示例:
<select id="selectUserByName" parameterType="String" resultType="User">
SELECT * FROM users
<where>
<if test="name != null and name != ''">
AND name = #{name}
</if>
</where>
</select>
在上面的示例中,
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
推荐阅读:shell if语句中的条件表达式有哪些