Authored by qinchao

sql查询去掉分页

@@ -189,7 +189,7 @@ public class SqlOperateServiceImpl implements SqlOperateService { @@ -189,7 +189,7 @@ public class SqlOperateServiceImpl implements SqlOperateService {
189 return res; 189 return res;
190 } 190 }
191 selectFlag=true; 191 selectFlag=true;
192 - rtnList.put("showPi",true); 192 + rtnList.put("showPi",false);//////////////// 前台数据安全的原因考虑,不再分页显示,只显示前30条 modify by craig.qin 2018-04-11
193 rtnList.put("pageSizePi",SqlQueryConstant.MAX_QUERY_RESULT_COUNT); 193 rtnList.put("pageSizePi",SqlQueryConstant.MAX_QUERY_RESULT_COUNT);
194 rtnList.put("currentPagePi",sqlOperateModel.getCurrentPage()); 194 rtnList.put("currentPagePi",sqlOperateModel.getCurrentPage());
195 }else{ 195 }else{
@@ -298,7 +298,7 @@ public class SqlOperateServiceImpl implements SqlOperateService { @@ -298,7 +298,7 @@ public class SqlOperateServiceImpl implements SqlOperateService {
298 } 298 }
299 299
300 //计算总页数 300 //计算总页数
301 - if(selectFlag){ 301 + if(selectFlag&&(Boolean)rtnList.get("showPi")){
302 if(count<SqlQueryConstant.MAX_QUERY_RESULT_COUNT&&sqlOperateModel.getCurrentPage()==0){ 302 if(count<SqlQueryConstant.MAX_QUERY_RESULT_COUNT&&sqlOperateModel.getCurrentPage()==0){
303 //当查询第一页时,如果返回的数量小于游标循环的数量,则总数量=本次游标循环的数量,不需要再查询一次了 303 //当查询第一页时,如果返回的数量小于游标循环的数量,则总数量=本次游标循环的数量,不需要再查询一次了
304 rtnList.put("totalPi",count); 304 rtnList.put("totalPi",count);
@@ -308,16 +308,6 @@ public class SqlOperateServiceImpl implements SqlOperateService { @@ -308,16 +308,6 @@ public class SqlOperateServiceImpl implements SqlOperateService {
308 st_pi.setMaxRows(1); 308 st_pi.setMaxRows(1);
309 309
310 boolean countSqlExeFlag=false; 310 boolean countSqlExeFlag=false;
311 - /* String countSql=this.ayaSqlToCount(sql.substring(6));  
312 - if(StringUtils.isNotBlank(countSql)){  
313 - try{  
314 - rs_pi = st_pi.executeQuery(countSql);  
315 - countSqlExeFlag=true;  
316 - }catch (Exception e){  
317 - log.error("query4Table exe select count error "+countSql);  
318 - countSqlExeFlag=false;  
319 - }  
320 - }*/  
321 if(!countSqlExeFlag){ 311 if(!countSqlExeFlag){
322 rs_pi = st_pi.executeQuery(" select count(1) from ( "+sql+" ) _tmp_sqloeaer_49_cnt "); 312 rs_pi = st_pi.executeQuery(" select count(1) from ( "+sql+" ) _tmp_sqloeaer_49_cnt ");
323 } 313 }
@@ -390,13 +380,13 @@ public class SqlOperateServiceImpl implements SqlOperateService { @@ -390,13 +380,13 @@ public class SqlOperateServiceImpl implements SqlOperateService {
390 return res; 380 return res;
391 } 381 }
392 382
393 - /** 383 + /*
394 * 解析select * from tt 到 select count(1) from tt 384 * 解析select * from tt 到 select count(1) from tt
395 * 包括复杂的sql解析,例如:select col1,col2,'aaaa',"bbbb",'"""""""',"''''''''''''''",'''',"""" ' \",\'\' FROM from ' FROM user 385 * 包括复杂的sql解析,例如:select col1,col2,'aaaa',"bbbb",'"""""""',"''''''''''''''",'''',"""" ' \",\'\' FROM from ' FROM user
396 - * @param selectSqlWithoutFirstSelect 386 + * @param
397 * @return 387 * @return
398 */ 388 */
399 - public String ayaSqlToCount(String selectSqlWithoutFirstSelect){ 389 + /*public String ayaSqlToCount(String selectSqlWithoutFirstSelect){
400 String FROM_CONSTANT=" from "; 390 String FROM_CONSTANT=" from ";
401 int FROM_CONSTANT_LENGTH=FROM_CONSTANT.length(); 391 int FROM_CONSTANT_LENGTH=FROM_CONSTANT.length();
402 selectSqlWithoutFirstSelect=selectSqlWithoutFirstSelect.trim(); 392 selectSqlWithoutFirstSelect=selectSqlWithoutFirstSelect.trim();
@@ -497,7 +487,7 @@ public class SqlOperateServiceImpl implements SqlOperateService { @@ -497,7 +487,7 @@ public class SqlOperateServiceImpl implements SqlOperateService {
497 } 487 }
498 return ""; 488 return "";
499 489
500 - } 490 + }*/
501 491
502 492
503 493