Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

排序单独使用无效 #110

Closed
le0lu0 opened this issue Aug 31, 2017 · 2 comments
Closed

排序单独使用无效 #110

le0lu0 opened this issue Aug 31, 2017 · 2 comments

Comments

@le0lu0
Copy link

le0lu0 commented Aug 31, 2017

单独使用startPage有效.
单独使用orderBy没有效果.
两个一起使用是有效果的.
PageHelper.startPage(1, 10);
PageHelper.orderBy("sort asc, id asc");

@abel533
Copy link
Collaborator

abel533 commented Aug 31, 2017

order by 确实无效,并且还会 count,已经解决了,会发布一个 5.1.2版本。

@ChanaLii
Copy link

单独使用orderBy,sql使用 if 函数后台会抛异常

  1. java代码
    @Override public List<Clerk> findClerkList(Map<String, Object> params) { PageHelper.startPage(((Integer) params.get("pageNum")), ((Integer) params.get("pageSize"))); if (params.containsKey("orderBy")) { if (!StringUtil.empty(params.get("orderBy").toString())) { PageHelper.orderBy(params.get("orderBy").toString()); } } List<Clerk> clerkList = clerkMapper.findClerkList(params); return clerkList; }
  2. sql语句
    SELECT 1 AS all_apply_customer, count(if(xataa.accept_status = 1, TRUE, NULL)) AS accept_apply_customer, count(if(xataa.accept_status = 0, TRUE, NULL)) AS reject_apply_customer, count(if(xataa.accept_status = 2, TRUE, NULL)) AS invalid_apply_customer FROM xft_apply_task_assign_agent xataa ORDER BY all_apply_customer DESC
  3. 执行sql后台抛异常
    Caused by: net.sf.jsqlparser.parser.ParseException: Encountered " "(" "( "" at line 3, column 11. Was expecting one of: <EOF> "AS" ... "DO" ... "INTO" ... "FROM" ... "WHERE" ... "XML" ... "GROUP" ... "VALUE" ... "HAVING" ... "REPLACE" ... "TRUNCATE" ... "CAST" ... "PARTITION" ... "EXTRACT" ... "MATERIALIZED" ...

点击查看异常详情

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants