Skip to content

Commit

Permalink
分页优化
Browse files Browse the repository at this point in the history
  • Loading branch information
think-gem committed Aug 17, 2015
1 parent 7660a87 commit 3bf01ca
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.apache.ibatis.type.TypeHandler;
import org.apache.ibatis.type.TypeHandlerRegistry;

import com.thinkgem.jeesite.common.config.Global;
import com.thinkgem.jeesite.common.persistence.Page;
import com.thinkgem.jeesite.common.persistence.dialect.Dialect;
import com.thinkgem.jeesite.common.utils.Reflections;
Expand Down Expand Up @@ -100,8 +101,14 @@ public static void setParameters(PreparedStatement ps, MappedStatement mappedSta
public static int getCount(final String sql, final Connection connection,
final MappedStatement mappedStatement, final Object parameterObject,
final BoundSql boundSql, Log log) throws SQLException {
// final String countSql = "select count(1) from (" + sql + ") tmp_count";
final String countSql = "select count(1) " + removeSelect(removeOrders(sql));
String dbName = Global.getConfig("jdbc.type");
final String countSql;
if("oracle".equals(dbName)){
countSql = "select count(1) from (" + sql + ") tmp_count";
}else{
countSql = "select count(1) from (" + removeOrders(sql) + ") tmp_count";
// countSql = "select count(1) " + removeSelect(removeOrders(sql));
}
Connection conn = connection;
PreparedStatement ps = null;
ResultSet rs = null;
Expand Down
8 changes: 8 additions & 0 deletions src/main/webapp/WEB-INF/tlds/fns.tld
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,14 @@
<example>${fns:getDictList(type)}</example>
</function>

<function>
<description>获取字典对象列表</description>
<name>getDictListJson</name>
<function-class>com.thinkgem.jeesite.modules.sys.utils.DictUtils</function-class>
<function-signature>java.lang.String getDictListJson(java.lang.String)</function-signature>
<example>${fns:getDictListJson(type)}</example>
</function>

<!-- Encodes -->
<function>
<description>URL编码</description>
Expand Down

0 comments on commit 3bf01ca

Please sign in to comment.