Authored by qinchao

sql查询去掉分页

... ... @@ -189,7 +189,7 @@ public class SqlOperateServiceImpl implements SqlOperateService {
return res;
}
selectFlag=true;
rtnList.put("showPi",true);
rtnList.put("showPi",false);//////////////// 前台数据安全的原因考虑,不再分页显示,只显示前30条 modify by craig.qin 2018-04-11
rtnList.put("pageSizePi",SqlQueryConstant.MAX_QUERY_RESULT_COUNT);
rtnList.put("currentPagePi",sqlOperateModel.getCurrentPage());
}else{
... ... @@ -298,7 +298,7 @@ public class SqlOperateServiceImpl implements SqlOperateService {
}
//计算总页数
if(selectFlag){
if(selectFlag&&(Boolean)rtnList.get("showPi")){
if(count<SqlQueryConstant.MAX_QUERY_RESULT_COUNT&&sqlOperateModel.getCurrentPage()==0){
//当查询第一页时,如果返回的数量小于游标循环的数量,则总数量=本次游标循环的数量,不需要再查询一次了
rtnList.put("totalPi",count);
... ... @@ -308,16 +308,6 @@ public class SqlOperateServiceImpl implements SqlOperateService {
st_pi.setMaxRows(1);
boolean countSqlExeFlag=false;
/* String countSql=this.ayaSqlToCount(sql.substring(6));
if(StringUtils.isNotBlank(countSql)){
try{
rs_pi = st_pi.executeQuery(countSql);
countSqlExeFlag=true;
}catch (Exception e){
log.error("query4Table exe select count error "+countSql);
countSqlExeFlag=false;
}
}*/
if(!countSqlExeFlag){
rs_pi = st_pi.executeQuery(" select count(1) from ( "+sql+" ) _tmp_sqloeaer_49_cnt ");
}
... ... @@ -390,13 +380,13 @@ public class SqlOperateServiceImpl implements SqlOperateService {
return res;
}
/**
/*
* 解析select * from tt 到 select count(1) from tt
* 包括复杂的sql解析,例如:select col1,col2,'aaaa',"bbbb",'"""""""',"''''''''''''''",'''',"""" ' \",\'\' FROM from ' FROM user
* @param selectSqlWithoutFirstSelect
* @param
* @return
*/
public String ayaSqlToCount(String selectSqlWithoutFirstSelect){
/*public String ayaSqlToCount(String selectSqlWithoutFirstSelect){
String FROM_CONSTANT=" from ";
int FROM_CONSTANT_LENGTH=FROM_CONSTANT.length();
selectSqlWithoutFirstSelect=selectSqlWithoutFirstSelect.trim();
... ... @@ -497,7 +487,7 @@ public class SqlOperateServiceImpl implements SqlOperateService {
}
return "";
}
}*/
... ...