From c23514be82a698042d32d6e1ef1555ad4a50abfb Mon Sep 17 00:00:00 2001 From: 81041 <81041@DESKTOP-025NVD9> Date: 星期三, 26 十二月 2018 16:13:40 +0800 Subject: [PATCH] 批量设置参数的查询 --- gx_tieta/src/com/fgkj/dao/impl/BattInfImpl.java | 45 ++++++++++++++++++++++++++++++++++----------- 1 files changed, 34 insertions(+), 11 deletions(-) diff --git a/gx_tieta/src/com/fgkj/dao/impl/BattInfImpl.java b/gx_tieta/src/com/fgkj/dao/impl/BattInfImpl.java index 466cc94..2c1cfa9 100644 --- a/gx_tieta/src/com/fgkj/dao/impl/BattInfImpl.java +++ b/gx_tieta/src/com/fgkj/dao/impl/BattInfImpl.java @@ -4378,14 +4378,37 @@ public List serchByDischarge(Object obj) { BattInf binf=(BattInf) obj; Page page=binf.getPage(); - Connection conn=DBUtil.getConn(); - String numberSql=" SELECT FOUND_ROWS() number"; + /*Connection conn=DBUtil.getConn(); + String numberSql=" SELECT FOUND_ROWS() number";*/ String sql=" select SQL_CALC_FOUND_ROWS * from db_battinf.tb_battinf " - + " where StationName1 like ? and StationName2 like ? and StationName3 like ? and StationName5 like ? " - + " and GroupIndexInFBSDevice=? and MonVolStd=? " - + " order by StationId asc,GroupIndexInFBSDevice asc " - + " limit ?,? "; - List<BattInf> list=DAOHelper.executeQueryLimit(sql, conn, new Object[] {"%"+binf.getStationName1()+"%","%"+binf.getStationName2()+"%","%"+binf.getStationName3()+"%","%"+binf.getStationName5()+"%",binf.getGroupIndexInFBSDevice(),binf.getMonVolStd(),(page.getPageCurr()-1)*page.getPageSize(),page.getPageSize()}, new CallBack() { + + " where " + + " GroupIndexInFBSDevice=? and MonVolStd=? "; + //+ " limit ?,? ";StationName1 like ? and StationName2 like ? and StationName3 like ? and StationName5 like ? " + //,(page.getPageCurr()-1)*page.getPageSize(),page.getPageSize(),"%"+binf.getStationName1()+"%","%"+binf.getStationName2()+"%","%"+binf.getStationName3()+"%", + //鏉′欢 + String sql0=" and stationid=? "; //鍏蜂綋鏈烘埧 + String sql1=" and stationname1=? ";//鐪� + String sql2=" and stationname2=? ";//甯� + String sql5=" and stationname5=? ";//鍖哄幙 + switch (binf.getNum()) { + case 0: + sql+=sql0; + break; + case 1: + sql+=sql1; + break; + case 2: + sql+=sql2; + break; + case 5: + sql+=sql5; + break; + default: + return null; + } + String orderSql=" order by StationId asc,GroupIndexInFBSDevice asc "; + sql+=orderSql; + List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[] {binf.getGroupIndexInFBSDevice(),binf.getMonVolStd(),binf.getStationName()}, new CallBack() { @Override public List getResults(ResultSet rs) { @@ -4438,12 +4461,12 @@ return list; } }); - //鍘绘帀limit鏉′欢鍚庣殑鎬绘暟 + /*//鍘绘帀limit鏉′欢鍚庣殑鎬绘暟 int number=LimitNumberFactory.GetLimtitNumber(conn, numberSql); //System.out.println("number: "+number); if(list!=null&&list.size()>0){ list.get(list.size()-1).setNum(number); - } + }*/ return list; } @@ -4452,9 +4475,9 @@ BattInfImpl biml = new BattInfImpl(); BattInf binf = new BattInf(); - binf.setNum(1002); + binf.setNum(2); binf.setBattGroupId(1000001); - binf.setStationName("骞胯タ鐪�-鐧捐壊-GX鐧捐壊涔愪笟鍘跨珛鏂板皬鍖篧F-BTS璁惧"); + binf.setStationName("鐧捐壊"); binf.setStationName1(""); binf.setStationName2("鐧捐壊"); binf.setStationName3(""); -- Gitblit v1.9.1