📄 query.java
字号:
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package ActiveObject.core;import ActiveObject.exception.ArgumentFormatError;import ActiveObject.exception.ObjectAnalysisException;import ActiveObject.vo.IntermediaryExpression;import java.sql.SQLException;import java.util.List;/** * @author tanjiazhang */public class Query extends CustomizedOperation{ // private int limitStart = -1;// private int limitLength = -1; public Query(Object[] objectTypes, String condition, Object[] params) throws ArgumentFormatError { super(objectTypes, condition, params); expression.setOperateType(IntermediaryExpression.Query); } /** * 设置记录范围,从0开始计数。 * @param start 如果不需要指定该位,可以设为-1值 * @param length 如果不需要指定该位,可以设为-1值 * @return */ public Query setRange(int start, int length) { this.expression.setLimitStart(start); this.expression.setLimitLength(length); return this; } public Query setStart(int start) { this.expression.setLimitStart(start); return this; } public Query setLength(int length) { this.expression.setLimitLength(length); return this; } /** * 添加排序条件 * @param field * @param sortOrder */ public Query addOrder (String field, Order sortOrder) { this.addOrderUtil(field, sortOrder); return this; } public List run() throws SQLException, ObjectAnalysisException { return this.excuteQuery(); } @Override protected String toSQLString() throws ObjectAnalysisException{ return new SQLCreator(expression).toSQLString();// String sortSQL = this.createOrderStatement();// StringBuffer selectSql = new StringBuffer(200);// selectSql.append("select * from ");// selectSql.append(this.createAliasStatement());// if(!OQLParser.isContentEmpty(condition))// {// selectSql.append(" where ");// selectSql.append(condition);// }// if(sortSQL != null)// selectSql.append(sortSQL);//// //添加记录个数限制// if(this.limitLength > -1)// {// selectSql.append(" limit ");// if(this.limitStart > -1)// {// selectSql.append(this.limitStart);// selectSql.append(",");// }// selectSql.append(this.limitLength);// }// //System.err.println(selectSql);// return OQLParser.parseLikeSyntax(selectSql, params); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -