📄 genericquery.java
字号:
package com.easyjf.core.support;import java.util.Collection;import java.util.List;import com.easyjf.core.dao.GenericDAO;import com.easyjf.web.tools.IQuery;public class GenericQuery implements IQuery { private GenericDAO dao; private int begin; private int max; private Collection paraValues; public GenericQuery(GenericDAO dao) { this.dao = dao; } public List getResult(String condition) { Object[] params = null; if (this.paraValues != null) { params = this.paraValues.toArray(); } return dao.find(condition, params, begin, max); } public List getResult(String condition, int begin, int max) { Object[] params = null; if (this.paraValues != null) { params = this.paraValues.toArray(); } return this.dao.find(condition, params, begin, max); } public int getRows(String condition) { int n = condition.toLowerCase().indexOf("order by"); Object[] params = null; if (this.paraValues != null) { params = this.paraValues.toArray(); } if (n > 0) { condition = condition.substring(0, n); } List ret = dao.query(condition, params, 0, 0); if (ret != null && ret.size() > 0) { return ((Long) ret.get(0)).intValue(); } else { return 0; } } public void setFirstResult(int begin) { this.begin = begin; } public void setMaxResults(int max) { this.max = max; } public void setParaValues(Collection params) { this.paraValues = params; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -