接口:
@Query(value="select user_name,name from cyd_sys_user,t_user /*#pageable* ",countQuery="select count(*) from cyd_sys_user,t_user",nativeQuery=true)
Page<Object> find_SQL_obj(Pageable pageable);
获取数据:
Sort sort=new Sort(Direction.DESC,"user_name");
Pageable page=new PageRequest(2,10,sort);//第二页,每页10条
Page<Object> p=userRepository.find_SQL_obj(page);
打印SQL:
select user_name,name from cyd_sys_user,t_user order by user_name desc limit ?, ?
如何实现:
select user_name,name from cyd_sys_user,t_user limit ?, ? order by user_name desc