We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Condition 类
public enum Sort{ ID("1", "js.id"), GMT_BASETIME("2", "js.gmt_basetime"), GMT_TRIGGER("3", "js.gmt_trigger") ; private String code; private String column; private Sort(String code, String column){ this.code = code; this.column = column; } @Override public String toString(){ return this.column; } } public String getSort(String code){ if(Strings.isNullOrEmpty(code)){ return Sort.ID.toString(); } for(Sort sort: Sort.values()){ if(code.equalsIgnoreCase(sort.code)){ return sort.toString(); } } return Sort.ID.toString(); }
xml 配置
<if test="page.sortColumn != null and page.sortColumn != '' "> order by ${page.sortColumn} ${page.dir} </if> limit #{page.start}, #{page.limit}
Class Pager 修改
private String sortColumn; public String getSortColumn() { return sortColumn; } public void setSortColumn(String sortColumn) { this.sortColumn = sortColumn; } private enum DIR{ DESC("desc"), ASC("asc"); private String dir; private DIR(String dir){ this.dir = dir; } @Override public String toString(){ return this.dir; } } public String getDir() { if(Strings.isNullOrEmpty(dir)){ return DIR.DESC.toString(); } for(DIR d: DIR.values()){ if(dir.equalsIgnoreCase(d.dir)){ return dir; } } return DIR.DESC.toString(); }
分页调用
page.setSortColumn(cond.getSort(page.getSort()));
The text was updated successfully, but these errors were encountered:
将此分类方面整理到 gist
Sorry, something went wrong.
x03570227
No branches or pull requests
Condition 类
xml 配置
Class Pager 修改
分页调用
The text was updated successfully, but these errors were encountered: