mybatis模糊查询
List<User> selectlike(String password);
<select id="selectlike" resultType="Tool.MybatisUtils.pojo.User">
select * from mybatis.mybatis where password like #{value};
</select>
@Test
public void addlike(){
SqlSession sqlSession = MybatisUtils.getSqlSession();
UserDao mapper = sqlSession.getMapper(UserDao.class);
List<User> userList = mapper.selectlike("%1%");
for (User user:userList){
System.out.println(user.getName() + " " + user.getPassword());
}
sqlSession.close();
}
本质还是百分号