一、< if test= " " >< /if >
● test中填写判断的条件,条件成立则标签内的内容有效,反之无效
<!--用户名模糊查询-->
<select id="selectUserByIdAndNameOrAge" resultType="com.pojo.User">
SELECT id, user_name, password, name, age, sex, birthday, created, updated
FROM tb_user
< if test=" null!=name and name.trim()!='' " >
WHERE name LIKE '%' #{name} '%'
< /if >
</select>
二、< choose test= " " > < /choose >
三、< where> < /where >
四、< set > < /set >
五、< foreach > < /foreach >