From 80d3e2eb20e671954fde45e43889bf8f4befdccf Mon Sep 17 00:00:00 2001
From: 81041 <81041@192.168.10.25>
Date: 星期二, 30 十月 2018 15:47:11 +0800
Subject: [PATCH] 第三层修改distinct

---
 gx_tieta/src/com/fgkj/dao/impl/BattInfImpl.java |  154 ++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 138 insertions(+), 16 deletions(-)

diff --git a/gx_tieta/src/com/fgkj/dao/impl/BattInfImpl.java b/gx_tieta/src/com/fgkj/dao/impl/BattInfImpl.java
index b8f8349..841de97 100644
--- a/gx_tieta/src/com/fgkj/dao/impl/BattInfImpl.java
+++ b/gx_tieta/src/com/fgkj/dao/impl/BattInfImpl.java
@@ -230,6 +230,48 @@
 		}
 		return list;
 	}
+	//鏍规嵁缁存姢鍖哄拰鏈烘埧鍚嶇О鏌ヨ鐢垫睜缁勪俊鎭�(鐢垫睜缁勪俊鎭厤缃�)
+	public List searchInform1(Object obj){
+		Batt_Maint_Dealarm bmd=(Batt_Maint_Dealarm) obj;
+		BattInf binf=bmd.getBinf();
+		Page page=bmd.getPage();
+		Connection conn= DBUtil.getConn();
+		String numberSql=" SELECT FOUND_ROWS() number";
+		String sql="select SQL_CALC_FOUND_ROWS distinct(StationId),StationId_ex,StationName1,StationName2,StationName3,StationName,FBSDeviceId  " +
+				 " From db_battinf.tb_battinf " +
+				 " limit ?,?";
+		List<BattInf> list=DAOHelper.executeQueryLimit(sql,conn, new Object[]{(page.getPageCurr()-1)*page.getPageSize(),page.getPageSize()},new CallBack() {
+			
+			public List getResults(ResultSet rs) {
+				List list = new ArrayList<BattInf>();
+				int id=0;
+				
+				try {
+					while (rs.next()) {
+						BattInf binf = new BattInf();
+						binf.setStationId(rs.getString("stationId"));
+						binf.setStationName1(rs.getString("stationName1"));
+						binf.setStationName2(rs.getString("stationName2"));
+						binf.setStationName3(rs.getString("stationName3"));
+						binf.setFBSDeviceId(rs.getInt("fBSDeviceId"));
+						binf.setStationName(rs.getString("stationName"));
+						binf.setStationId_ex(rs.getString("stationId_ex"));
+						list.add(binf);
+
+					}
+				} catch (SQLException e) {
+					e.printStackTrace();
+				}		
+				return list;
+			}
+		});
+		//鍘绘帀limit鏉′欢鍚庣殑鎬绘暟
+		int number=LimitNumberFactory.GetLimtitNumber(conn, numberSql);
+		if(list!=null&&list.size()>0){
+			list.get(list.size()-1).setNum(number);
+		}
+		return list;
+	}
 	//娣诲姞鐢垫睜缁勬椂鏌ヨ鍑烘渶澶х殑鏈烘埧id鍜岀數姹犵粍id
 	public List searchMaxId(){
 		String sql="select max(stationid) as maxs,max(battgroupid) as maxb from db_battinf.tb_battinf limit 1";
@@ -3365,10 +3407,10 @@
 		} );
 		return list;
 	}
-	//鏌ヨ绠$悊鐨勬満鎴�(宸︿晶瀵艰埅绗笁灞傦紝鏌ユ墍鏈夌殑鏈烘埧,num涓瓨鏀緐id)
-	public List serchStationName3(Object obj){
+	//鏌ヨ绠$悊鐨勫幙/鍖�(宸︿晶瀵艰埅绗笁灞傦紝鏌ユ墍鏈夌殑鍘�/鍖�)
+	public List serchStationName5(Object obj){
 		BattInf binf=(BattInf) obj;
-		String sql="select DISTINCT StationName,StationName1,StationName2,StationName3,stationid,fbsdeviceid,FBSDeviceName  " +
+		String sql="select DISTINCT stationName5,StationName,StationName1,StationName2,StationName3,stationid,fbsdeviceid,FBSDeviceName  " +
 				" FROM db_battinf.tb_battinf " +
 				" where StationId in(" +
 				" select distinct db_user.tb_user_battgroup_baojigroup_battgroup.StationId from db_user.tb_user_battgroup_baojigroup_battgroup,db_user.tb_user_battgroup_baojigroup_usr where db_user.tb_user_battgroup_baojigroup_battgroup.baoji_group_id=db_user.tb_user_battgroup_baojigroup_usr.baoji_group_id  and db_user.tb_user_battgroup_baojigroup_usr.uId=?" +
@@ -3385,6 +3427,7 @@
 							batt.setStationName1(rs.getString("stationName1"));
 							batt.setStationName2(rs.getString("stationName2"));
 							batt.setStationName3(rs.getString("stationName3"));
+							batt.setStationName5(rs.getString("stationName5"));
 							batt.setStationId(rs.getString("stationId"));
 							batt.setFBSDeviceName(rs.getString("fBSDeviceName"));
 							batt.setFBSDeviceId(rs.getInt("fBSDeviceId"));
@@ -3399,14 +3442,14 @@
 		} );
 		return list;
 	}
-	//鏌ヨ绠$悊鐨勬満鎴�(宸︿晶瀵艰埅绗笁灞傦紝鏌ユ墍鏈夌殑鏈烘埧)
-	public List serchStationName3_all(Object obj){
+	//鏌ヨ绠$悊鐨勫幙/鍖�(宸︿晶瀵艰埅绗笁灞傦紝鏌ユ墍鏈夌殑鍘�/鍖�)
+	public List serchStationName5_all(Object obj){
 		BattInf binf=(BattInf) obj;
-		String sql="select DISTINCT StationName,StationName1,StationName2,StationName3,stationid,fbsdeviceid,FBSDeviceName  " +
+		String sql="select DISTINCT stationName5,StationName,StationName1,StationName2,StationName3,stationid,fbsdeviceid,FBSDeviceName  " +
 				" FROM db_battinf.tb_battinf " +
 				" where StationName1 like ? and StationName2 like ?  " +
 				" ORDER BY CONVERT( StationName USING gbk ) COLLATE gbk_chinese_ci ASC ";
-		List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{"%"+binf.getStationName1()+"%","%"+binf.getStationName2()+"%"},new CallBack() {
+		List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{binf.getNum(),"%"+binf.getStationName1()+"%","%"+binf.getStationName2()+"%"},new CallBack() {
 			
 			public List getResults(ResultSet rs) {
 				List list=new ArrayList();
@@ -3417,6 +3460,75 @@
 							batt.setStationName1(rs.getString("stationName1"));
 							batt.setStationName2(rs.getString("stationName2"));
 							batt.setStationName3(rs.getString("stationName3"));
+							batt.setStationName5(rs.getString("stationName5"));
+							batt.setStationId(rs.getString("stationId"));
+							batt.setFBSDeviceName(rs.getString("fBSDeviceName"));
+							batt.setFBSDeviceId(rs.getInt("fBSDeviceId"));
+							list.add(batt);
+						}
+					} catch (SQLException e) {
+						// TODO Auto-generated catch block
+						e.printStackTrace();
+					}
+				return list;
+			}
+		} );
+		return list;
+	}
+	//鏌ヨ绠$悊鐨勬満鎴�(宸︿晶瀵艰埅绗洓灞傦紝鏌ユ墍鏈夌殑鏈烘埧,num涓瓨鏀緐id)
+	public List serchStationName3(Object obj){
+		BattInf binf=(BattInf) obj;
+		String sql="select DISTINCT StationName,StationName1,StationName2,StationName3,StationName5,stationid,fbsdeviceid,FBSDeviceName  " +
+				" FROM db_battinf.tb_battinf " +
+				" where StationId in(" +
+				" select distinct db_user.tb_user_battgroup_baojigroup_battgroup.StationId from db_user.tb_user_battgroup_baojigroup_battgroup,db_user.tb_user_battgroup_baojigroup_usr where db_user.tb_user_battgroup_baojigroup_battgroup.baoji_group_id=db_user.tb_user_battgroup_baojigroup_usr.baoji_group_id  and db_user.tb_user_battgroup_baojigroup_usr.uId=?" +
+				" ) and StationName1 like ? and StationName2 like ? and StationName5 like ?  " +
+				" ORDER BY CONVERT( StationName USING gbk ) COLLATE gbk_chinese_ci ASC ";
+		List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{binf.getNum(),"%"+binf.getStationName1()+"%","%"+binf.getStationName2()+"%","%"+binf.getStationName5()+"%"},new CallBack() {
+			
+			public List getResults(ResultSet rs) {
+				List list=new ArrayList();
+					try {
+						while(rs.next()){
+							BattInf batt = new BattInf();
+							batt.setStationName(rs.getString("stationName"));
+							batt.setStationName1(rs.getString("stationName1"));
+							batt.setStationName2(rs.getString("stationName2"));
+							batt.setStationName3(rs.getString("stationName3"));
+							batt.setStationName5(rs.getString("stationName5"));
+							batt.setStationId(rs.getString("stationId"));
+							batt.setFBSDeviceName(rs.getString("fBSDeviceName"));
+							batt.setFBSDeviceId(rs.getInt("fBSDeviceId"));
+							list.add(batt);
+						}
+					} catch (SQLException e) {
+						// TODO Auto-generated catch block
+						e.printStackTrace();
+					}
+				return list;
+			}
+		} );
+		return list;
+	}
+	//鏌ヨ绠$悊鐨勬満鎴�(宸︿晶瀵艰埅绗洓灞傦紝鏌ユ墍鏈夌殑鏈烘埧)
+	public List serchStationName3_all(Object obj){
+		BattInf binf=(BattInf) obj;
+		String sql="select DISTINCT StationName,StationName1,StationName2,StationName3,StationName5,stationid,fbsdeviceid,FBSDeviceName  " +
+				" FROM db_battinf.tb_battinf " +
+				" where StationName1 like ? and StationName2 like ?  and StationName5 like ? " +
+				" ORDER BY CONVERT( StationName USING gbk ) COLLATE gbk_chinese_ci ASC ";
+		List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{"%"+binf.getStationName1()+"%","%"+binf.getStationName2()+"%","%"+binf.getStationName5()+"%"},new CallBack() {
+			
+			public List getResults(ResultSet rs) {
+				List list=new ArrayList();
+					try {
+						while(rs.next()){
+							BattInf batt = new BattInf();
+							batt.setStationName(rs.getString("stationName"));
+							batt.setStationName1(rs.getString("stationName1"));
+							batt.setStationName2(rs.getString("stationName2"));
+							batt.setStationName3(rs.getString("stationName3"));
+							batt.setStationName5(rs.getString("stationName5"));
 							batt.setStationId(rs.getString("stationId"));
 							batt.setFBSDeviceName(rs.getString("fBSDeviceName"));
 							batt.setFBSDeviceId(rs.getInt("fBSDeviceId"));
@@ -3433,11 +3545,11 @@
 	}
    
 	
-	//鏍规嵁鏈烘埧id鏌ヨ鏈烘埧涓嬬殑鐢垫睜缁勪俊鎭�(宸︿晶瀵艰埅绗洓灞�,鏍规嵁鏈烘埧鏌ヨ涓嬮潰鐨勭數姹犵粍,num涓瓨鏀緐id)
+	//鏍规嵁鏈烘埧id鏌ヨ鏈烘埧涓嬬殑鐢垫睜缁勪俊鎭�(宸︿晶瀵艰埅绗簲灞�,鏍规嵁鏈烘埧鏌ヨ涓嬮潰鐨勭數姹犵粍,num涓瓨鏀緐id)
 	public List serchBattByStation(Object obj){
 		BattInf binf=(BattInf) obj;
-		String sql="select DISTINCT StationName,StationId,StationIP,FBSDeviceId,BattGroupName,BattGroupName1,BattGroupName2,MonCount,battgroupId,MonCapStd,MonVolStd,MonResStd,MonSerStd,BattProducer,BattInUseDate,GroupIndexInFBSDevice,Load_curr,DisCurrMax " +
-				"from db_battinf.tb_battinf  where StationName1 like ? and StationName2 like ?  and  StationName like ?  ";
+		String sql="select DISTINCT StationName,StationName1,StationName2,StationName3,StationName5,StationId,stationid_ex,StationIP,FBSDeviceId,BattGroupName,BattGroupName1,BattGroupName2,MonCount,battgroupId,MonCapStd,MonVolStd,MonResStd,MonSerStd,BattProducer,BattInUseDate,GroupIndexInFBSDevice,Load_curr,DisCurrMax " +
+				"from db_battinf.tb_battinf  where StationName1 like ? and StationName2 like ?   and  StationName like ? and StationName5 like ?  ";
 	    //鏈烘埧id
 		String idSqlT=" and  Stationid like ? ";
 		sql+=idSqlT;
@@ -3450,7 +3562,7 @@
 		String orderSql=" ORDER BY StationName1,battgroupId ";
 		sql+=orderSql;
 		//System.out.println(sql);
-		List list=DAOHelper.executeQuery(sql, DBUtil.getConn(),new Object[]{"%"+binf.getStationName1()+"%","%"+binf.getStationName2()+"%","%"+binf.getStationName()+"%","%"+binf.getStationId()+"%",binf.getNum()},new CallBack() {
+		List list=DAOHelper.executeQuery(sql, DBUtil.getConn(),new Object[]{"%"+binf.getStationName1()+"%","%"+binf.getStationName2()+"%","%"+binf.getStationName()+"%","%"+binf.getStationName5()+"%","%"+binf.getStationId()+"%",binf.getNum()},new CallBack() {
 			
 			public List getResults(ResultSet rs) {
 				List list = new ArrayList();
@@ -3458,7 +3570,12 @@
 					while (rs.next()) {
 						BattInf batt = new BattInf();
 						batt.setStationName(rs.getString("stationName"));
+						batt.setStationName1(rs.getString("stationName1"));
+						batt.setStationName2(rs.getString("stationName2"));
+						batt.setStationName3(rs.getString("stationName3"));
+						batt.setStationName5(rs.getString("stationName5"));
 						batt.setStationId(rs.getString("StationId"));
+						batt.setStationId_ex(rs.getString("stationId_ex"));
 						batt.setStationIp(rs.getString("StationIP"));
 						batt.setBattGroupName(rs.getString("BattGroupName").trim());
 						batt.setBattGroupName1(rs.getString("BattGroupName1").trim());
@@ -3485,11 +3602,11 @@
 		});
 		return list;
 		}
-	//鏍规嵁鏈烘埧id鏌ヨ鏈烘埧涓嬬殑鐢垫睜缁勪俊鎭�(宸︿晶瀵艰埅绗洓灞�,鏍规嵁鏈烘埧鏌ヨ涓嬮潰鐨勭數姹犵粍,num涓瓨鏀緐id)
+	//鏍规嵁鏈烘埧id鏌ヨ鏈烘埧涓嬬殑鐢垫睜缁勪俊鎭�(宸︿晶瀵艰埅绗簲灞�,鏍规嵁鏈烘埧鏌ヨ涓嬮潰鐨勭數姹犵粍,num涓瓨鏀緐id)
 	public List serchBattByStation_all(Object obj){
 		BattInf binf=(BattInf) obj;
-		String sql="select DISTINCT StationName,StationId,StationIP,FBSDeviceId,BattGroupName,BattGroupName1,BattGroupName2,MonCount,battgroupId,MonCapStd,MonVolStd,MonResStd,MonSerStd,BattProducer,BattInUseDate,GroupIndexInFBSDevice " +
-				"from db_battinf.tb_battinf  where StationName1 like ? and StationName2 like ?  and  StationName like ?  ";
+		String sql="select DISTINCT StationName,StationName1,StationName2,StationName3,StationName4,StationName5,StationId,StationIP,FBSDeviceId,BattGroupName,BattGroupName1,BattGroupName2,MonCount,battgroupId,MonCapStd,MonVolStd,MonResStd,MonSerStd,BattProducer,BattInUseDate,GroupIndexInFBSDevice " +
+				"from db_battinf.tb_battinf  where StationName1 like ? and StationName2 like ?  and  StationName like ? and StationName5 like ? ";
 	    //鏈烘埧id
 		String idSqlT=" and  Stationid like ? ";
 		sql+=idSqlT;
@@ -3502,7 +3619,7 @@
 		String orderSql=" ORDER BY StationName1,battgroupId ";
 		sql+=orderSql;
 		//System.out.println(sql);
-		List list=DAOHelper.executeQuery(sql, DBUtil.getConn(),new Object[]{"%"+binf.getStationName1()+"%","%"+binf.getStationName2()+"%","%"+binf.getStationName()+"%","%"+binf.getStationId()+"%"},new CallBack() {
+		List list=DAOHelper.executeQuery(sql, DBUtil.getConn(),new Object[]{"%"+binf.getStationName1()+"%","%"+binf.getStationName2()+"%","%"+binf.getStationName()+"%","%"+binf.getStationName5()+"%","%"+binf.getStationId()+"%"},new CallBack() {
 			
 			public List getResults(ResultSet rs) {
 				List list = new ArrayList();
@@ -3510,6 +3627,10 @@
 					while (rs.next()) {
 						BattInf batt = new BattInf();
 						batt.setStationName(rs.getString("stationName"));
+						batt.setStationName1(rs.getString("stationName1"));
+						batt.setStationName2(rs.getString("stationName2"));
+						batt.setStationName3(rs.getString("stationName3"));
+						batt.setStationName5(rs.getString("stationName5"));
 						batt.setStationId(rs.getString("StationId"));
 						batt.setStationIp(rs.getString("StationIP"));
 						batt.setBattGroupName(rs.getString("BattGroupName").trim());
@@ -3811,8 +3932,9 @@
 		//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);
+		List<BattInf> list=biml.searchInform1(bmd);
 		for (BattInf b : list) {
 			System.out.println(b);
 		}

--
Gitblit v1.9.1