接口
//模糊查询 查询所有姓傅的人
List<User> getUserLike(String value);
实现
<!-- 模糊查询-->
<select id="getUserLike" resultType="com.tt.pojo.User">
select * from mybatis.user where name like #{value}
</select>
测试
@Test
//模糊查询
public void testLike(){
SqlSession sqlSession = MybatisUtils.getSqlSession();
UserMapper mapper = sqlSession.getMapper(UserMapper.class);
List<User> userLike = mapper.getUserLike("%傅%");
for (User user : userLike) {
System.out.println(user);
}
}