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

Cnd中添加orderBy(String name, String dir)方法 #667

Closed
qinains opened this issue May 28, 2014 · 2 comments
Closed

Cnd中添加orderBy(String name, String dir)方法 #667

qinains opened this issue May 28, 2014 · 2 comments
Milestone

Comments

@qinains
Copy link
Contributor

qinains commented May 28, 2014

在平时的项目中,经常会遇到到排序方向问题
public List getByXXXId(long XXXId, int pageNumber, int pageSize, String sortName, String dir) {
if ("desc".equals(dir)) {
return query(Cnd.where("targetId", "=", XXXId).and("enabled", "=", true).desc(sortName), new Pager().setPageNumber(pageNumber).setPageSize(pageSize));
} else {
return query(Cnd.where("targetId", "=", XXXId).and("enabled", "=", true).asc(sortName), new Pager().setPageNumber(pageNumber).setPageSize(pageSize));
}
}
能不能提供一个方法,实现
public List getByXXXId(long XXXId, int pageNumber, int pageSize, String sortName, String dir) {
if (!"desc".equals(dir)) {
dir = "asc";
}
return query(Cnd.where("targetId", "=", XXXId).and("enabled", "=", true).orderBy(sortName,dir), new Pager().setPageNumber(pageNumber).setPageSize(pageSize));
}

@wendal
Copy link
Member

wendal commented Jul 23, 2014

额...

@wendal
Copy link
Member

wendal commented Feb 10, 2015

早已fix, 不知道哪个版本了

@wendal wendal closed this as completed Feb 10, 2015
@wendal wendal added this to the 1.b.52 milestone Feb 10, 2015
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
@qinains @wendal and others