All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sourceforge.orm.dialect.OracleDialect Maven / Gradle / Ivy

Go to download

本项目主要弥补在使用mybatis3+springmvc+jquery easyui快速搭建web应用系统是遇到的框架不足. 主要工作包括: 1,扩展了ApplicationContextAware,通过单例注入spring容器,提供spring容器外的bean获取方法 2,扩展了apache shiro框架,统一了安全结构 3,扩展了mybatis3拦截器,在两个拦截器中自动完成分页注入,实现内存分页。 4,分页设计数据库方言 5,提供了一个easyuigrid的模型 6,提供了java泛型的jstl 7, xml工具包等一些小工具

The newest version!
package net.sourceforge.orm.dialect;

/**
 * @author [email protected]
 **/
public class OracleDialect extends Dialect {

	@Override
	public String getLimitString(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 getCountString(String sql) {
		// TODO Oracle分页查询
		return null;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy