// Path: QuickProject-Core/src/main/java/chanedi/dao/complexQuery/Sort.java
// @Data
// public class Sort implements Serializable {
// 
//     private static final long serialVersionUID = 7026434198845897214L;
//     private String property;
//     private String tableAlias;
//     private String column;
//     private Direction direction;
// 
//     public Sort() {
//         super();
//         direction = Direction.ASC;
//     }
// 
//     public Sort(String property) {
//         this();
//         this.property = property;
//     }
// 
//     public Sort(String property, Direction direction) {
//         this();
//         this.property = property;
//         this.direction = direction;
//     }
// 
//     public static enum Direction {
//         ASC, DESC;
//     }
// 
// }


import chanedi.dao.complexQuery.Sort;
import java.util.List;
package chanedi.dao.dialect;



/**
 * Created by unknown
 * Modify by Chanedi
 */
public class OracleDialect extends Dialect {

	@Override
	public String addLimitString(String sql, int offset, int limit) {
		sql = sql.trim();
		boolean isForUpdate = false;
		if (sql.toLowerCase().endsWith(" FOR UPDATE")) {
			sql = sql.substring(0, sql.length() - 11);
			isForUpdate = true;
		}

		StringBuffer pagingSelect = new StringBuffer(sql.length() + 100);

		pagingSelect.append("SELECT * FROM ( SELECT ROW_.*, ROWNUM ROWNUM_ FROM ( ");

		pagingSelect.append(sql);

		pagingSelect.append(" ) ROW_ ) WHERE ROWNUM_ > " + offset + " AND ROWNUM_ <= " + (offset + limit));

		if (isForUpdate) {
			pagingSelect.append(" FOR UPDATE");
		}

		return pagingSelect.toString();
	}

    @Override
// Path: QuickProject-Core/src/main/java/chanedi/dao/complexQuery/Sort.java
// @Data
// public class Sort implements Serializable {
// 
//     private static final long serialVersionUID = 7026434198845897214L;
//     private String property;
//     private String tableAlias;
//     private String column;
//     private Direction direction;
// 
//     public Sort() {
//         super();
//         direction = Direction.ASC;
//     }
// 
//     public Sort(String property) {
//         this();
//         this.property = property;
//     }
// 
//     public Sort(String property, Direction direction) {
//         this();
//         this.property = property;
//         this.direction = direction;
//     }
// 
//     public static enum Direction {
//         ASC, DESC;
//     }
// 
// }


// Path: QuickProject-Core/src/main/java/chanedi/dao/dialect/OracleDialect.java
import chanedi.dao.complexQuery.Sort;
import java.util.List;

package chanedi.dao.dialect;



/**
 * Created by unknown
 * Modify by Chanedi
 */
public class OracleDialect extends Dialect {

	@Override
	public String addLimitString(String sql, int offset, int limit) {
		sql = sql.trim();
		boolean isForUpdate = false;
		if (sql.toLowerCase().endsWith(" FOR UPDATE")) {
			sql = sql.substring(0, sql.length() - 11);
			isForUpdate = true;
		}

		StringBuffer pagingSelect = new StringBuffer(sql.length() + 100);

		pagingSelect.append("SELECT * FROM ( SELECT ROW_.*, ROWNUM ROWNUM_ FROM ( ");

		pagingSelect.append(sql);

		pagingSelect.append(" ) ROW_ ) WHERE ROWNUM_ > " + offset + " AND ROWNUM_ <= " + (offset + limit));

		if (isForUpdate) {
			pagingSelect.append(" FOR UPDATE");
		}

		return pagingSelect.toString();
	}

    @Override
    public String addSortString(String sql, List<Sort> sortList) {