<select id="selectStudentLikeName1" resultType="stu">
select * from t_student where name like '%' #{xxx} '%'
</select>
<!-- 使用数据库提供的字符串拼接函数实现模糊查询
注意:不是所有数据库中的都提供concat函数
不推荐
-->
<select id="selectStudentLikeName2" resultType="stu">
select * from t_student where name like concat('%',#{name},'%')
</select>
<!--
$ 是字符串拼接
使用字符拼接实现模糊查询,没使用预编译,因此执行效率低、安全性低
使用语法如果参数对象为基本数据格式那么只能填写value 如果是实体类则填写属性名
不推荐
-->
<select id="selectStudentLikeName3" resultType="stu">
select * from t_student where name like '%${value}%'
</select>