第一种:
@Query(value = "select s from User as s where s.username like concat('%',?1,'%') and s.password = ?2")
Page<User> findByUsernameLikeAndPassword(String username, Integer password, Pageable pageable);
第二种:
是在不加@Query注解,在传参的时候在参数左右拼接 "%"+参数+"%",个人感觉强迫症犯了,所以还是推荐第一种