From 12808f035eec4cb7ea0dad67833dc9f11a281a4c Mon Sep 17 00:00:00 2001
From: 81041 <81041@192.168.10.29>
Date: 星期一, 15 十月 2018 11:32:13 +0800
Subject: [PATCH] 基站统计

---
 gx_tieta/src/com/fgkj/dao/impl/BattInfImpl.java |   76 +++++++++++++++++++++++++++++++++++++-
 1 files changed, 74 insertions(+), 2 deletions(-)

diff --git a/gx_tieta/src/com/fgkj/dao/impl/BattInfImpl.java b/gx_tieta/src/com/fgkj/dao/impl/BattInfImpl.java
index a3e889b..d55984c 100644
--- a/gx_tieta/src/com/fgkj/dao/impl/BattInfImpl.java
+++ b/gx_tieta/src/com/fgkj/dao/impl/BattInfImpl.java
@@ -3691,15 +3691,86 @@
 		});
 		return list;
 	}
+	//鐢垫睜閰嶇粍绠$悊(閲嶈)
+	public List serchGroupByInfor(Object obj){
+		BattInf binf=(BattInf) obj;
+		String sql="SELECT distinct BattGroupId,battgroupname,stationid,stationname1,stationname2,stationname,stationname3,BattProducer,MonVolStd,MonCapStd,monCount " +
+				" ,battinf_re.old_stationname,old_battgroupname,old_battproducer,old_stationid,old_battgroupid,old_monum,new_stationname,new_battgroupname,new_battproducer,new_stationid,new_battgroupid,new_monum,rebuild_time,rebuild_uid,rebuild_address,rebuild_clear_type " +
+				" from db_battinf.tb_battinf " +
+				" left outer join (select * from db_battinf.tb_battinf_rebuild where tb_battinf_rebuild.rebuild_clear_type=1 ) as battinf_re " +
+				" on BattGroupId=battinf_re.new_battgroupid or BattGroupId=battinf_re.old_battgroupid " +
+				" where stationname1 like ? and stationname2 like ? and stationname3 like ?  and battgroupname like ?  and battgroupid=? ";
+		List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{"%"+binf.getStationName1()+"%","%"+binf.getStationName2()+"%","%"+binf.getStationName3()+"%","%"+binf.getBattGroupName()+"%",binf.getBattGroupId()}, new CallBack() {
+			
+			public List getResults(ResultSet rs) {
+				List<BattInf> list=new ArrayList();
+				int battgroupid=0;
+				try {
+					while(rs.next()){
+						BattInf binf=new BattInf();
+						binf.setBattGroupId(rs.getInt("battGroupId"));
+						binf.setBattGroupName(rs.getString("battGroupName"));
+						binf.setStationId(rs.getString("stationId"));
+						binf.setStationName(rs.getString("stationName"));
+						binf.setStationName1(rs.getString("stationName1"));
+						binf.setStationName2(rs.getString("stationName2"));
+						binf.setStationName3(rs.getString("stationName3"));
+						binf.setBattProducer(rs.getString("battProducer"));
+						binf.setMonVolStd(rs.getFloat("monVolStd"));
+						binf.setMonCapStd(rs.getFloat("monCapStd"));
+						binf.setMonCount(rs.getInt("monCount"));
+						
+						BattInf_Rebuild brinf=new BattInf_Rebuild();
+						brinf.setNew_battgroupid(rs.getInt("new_battgroupid"));
+						brinf.setNew_battgroupname(rs.getString("new_battgroupname"));
+						brinf.setNew_battproducer(rs.getString("new_battproducer"));
+						brinf.setNew_monum(rs.getInt("new_monum"));
+						brinf.setNew_stationid(rs.getString("new_stationid"));
+						brinf.setNew_stationname(rs.getString("new_stationname"));
+						brinf.setOld_battgroupid(rs.getInt("old_battgroupid"));
+						brinf.setOld_battgroupname(rs.getString("old_battgroupname"));
+						brinf.setOld_battproducer(rs.getString("old_battproducer"));
+						brinf.setOld_monum(rs.getInt("old_monum"));
+						brinf.setOld_stationid(rs.getString("old_stationid"));
+						brinf.setOld_stationname(rs.getString("old_stationname"));
+						brinf.setRebuild_address(rs.getString("rebuild_address"));
+						brinf.setRebuild_clear_type(rs.getInt("rebuild_clear_type"));
+						brinf.setRebuild_time(rs.getTimestamp("rebuild_time"));
+						brinf.setRebuild_uid(rs.getInt("rebuild_uid"));
+						
+                        if(binf.getBattGroupId()==battgroupid){
+							((ArrayList)list.get(list.size()-1).getObj()).add(brinf);
+							continue;
+						}
+						List listr=new ArrayList();
+						listr.add(brinf);
+						binf.setObj(listr);
+						battgroupid=binf.getBattGroupId();
+						
+						list.add(binf);
+					}
+				} catch (SQLException e) {
+					// TODO Auto-generated catch block
+					e.printStackTrace();
+				}
+				return list;
+			}
+		});
+		return list;
+	}
+	
+	
 	public static void main(String[] args) throws ParseException {
 		//new BattInfImpl().searchAll();
 		
 		BattInfImpl biml = new BattInfImpl();
 		BattInf binf = new BattInf();
-		binf.setBattGroupId(1000967);
+		binf.setBattGroupId(1000001);
 		binf.setStationName("");
 		binf.setStationName1("");
 		binf.setStationName2("");
+		binf.setStationName3("姝︽眽婧愭殺瀹為獙瀹�1");
+		binf.setBattGroupName("");
 		binf.setBattProducer("1");
 		User_inf uinf=new User_inf();
 		uinf.setUId(1002);
@@ -3725,7 +3796,8 @@
 		//List<BattInf> list = biml.serchByConditionNew(bmd);
 		//List<BattInf> list=biml.serchByTestType(bmd);
 		//List<BattInf> list=biml.serchGroupAssess(bmd);
-		List<BattInf> list=biml.serchMakeGroup(binf);
+		//List<BattInf> list=biml.serchMakeGroup(binf);
+		List<BattInf> list=biml.serchGroupByInfor(binf);
 		for (BattInf b : list) {
 			System.out.println(b);
 		}

--
Gitblit v1.9.1