首页 新闻 会员 周边 捐助

springdata-jpa 如何先分页后排序

0
[已关闭问题] 关闭于 2018-01-09 14:53

接口:

@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

litblack的主页 litblack | 菜鸟二级 | 园豆:209
提问于:2018-01-09 14:52
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册