From de8f3559c7e3bfe2153efded3b2885435aa93f0e Mon Sep 17 00:00:00 2001
From: 81041 <81041@DESKTOP-025NVD9>
Date: 星期五, 18 一月 2019 16:16:21 +0800
Subject: [PATCH] 修改设备连接和电池组连接

---
 gx_tieta/src/com/fgkj/dao/impl/App_bts_comm_taskImpl.java |   55 ++++++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 44 insertions(+), 11 deletions(-)

diff --git a/gx_tieta/src/com/fgkj/dao/impl/App_bts_comm_taskImpl.java b/gx_tieta/src/com/fgkj/dao/impl/App_bts_comm_taskImpl.java
index eca5a0d..e9daa0e 100644
--- a/gx_tieta/src/com/fgkj/dao/impl/App_bts_comm_taskImpl.java
+++ b/gx_tieta/src/com/fgkj/dao/impl/App_bts_comm_taskImpl.java
@@ -14,6 +14,7 @@
 import com.fgkj.dto.App_bts_comm_task;
 import com.fgkj.dto.BattInf;
 import com.fgkj.dto.Page;
+import com.fgkj.dto.User_inf;
 import com.mysql.fabric.xmlrpc.base.Array;
 
 public class App_bts_comm_taskImpl implements BaseDAO,CallBack{
@@ -42,26 +43,37 @@
 		// TODO Auto-generated method stub
 		return null;
 	}
-    //鏍规嵁鐪佸競鍖烘満鎴垮悕绉版煡璇�(uid鏀惧湪num涓�)
+    //鏍规嵁璁惧id鏌ヨ(uid鏀惧湪num涓�)
 	public List serchByCondition(Object obj) {
 		BattInf binf=(BattInf) obj;
 		Page page=binf.getPage();
 		Connection conn=DBUtil.getConn();
 		String numberSql=" SELECT FOUND_ROWS() number";
-		String sql=" select SQL_CALC_FOUND_ROWS distinct dev_id,thread_id,battgroup_cnt,battgroup_id1,battgroup_index1,battgroup_id2,battgroup_index2,battgroup_id3,battgroup_index3,battgroup_id4,battgroup_index4,connect_time,dev_comm_runtime,break_type " +
+		String sql=" select SQL_CALC_FOUND_ROWS distinct dev_id,thread_id,dev_mcu_uid,battgroup_cnt,battgroup_id1,battgroup_index1,battgroup_id2,battgroup_index2,battgroup_id3,battgroup_index3,battgroup_id4,battgroup_index4,connet_time,dev_comm_runtime,break_type " +
 				"  ,stationName,stationName1,stationName2,stationName3,stationName5,StationId " +
-				" from db_app_sys.tb_app_bts_comm_task,db_battinf.tb_battinf  " +
-				" where db_app_sys.tb_app_bts_comm_task.dev_id=db_battinf.tb_battinf.fBSDeviceId " +
-				" and stationName1 like ? and stationName2 like ? and stationId like ? and stationName5 like ? " +
-				"  and db_app_sys.tb_app_bts_comm_task.dev_id in (" +
+				" from db_app_sys.tb_app_bts_comm_task " +
+				" left outer join db_battinf.tb_battinf  on db_app_sys.tb_app_bts_comm_task.dev_id=db_battinf.tb_battinf.fBSDeviceId " +
+				" where  ";
+				//stationName1 like ? and stationName2 like ? and stationId like ? and stationName5 like ? " +
+				/*"  and db_app_sys.tb_app_bts_comm_task.dev_id in (" +
 				"  select distinct db_battinf.tb_battinf.fBSDeviceId  " +
 				"  from db_battinf.tb_battinf " +
 				"  left outer join db_user.tb_user_battgroup_baojigroup_battgroup on db_user.tb_user_battgroup_baojigroup_battgroup.stationid=db_battinf.tb_battinf.stationid " +
 				"  left outer join db_user.tb_user_battgroup_baojigroup_usr on db_user.tb_user_battgroup_baojigroup_usr.baoji_group_id=db_user.tb_user_battgroup_baojigroup_battgroup.baoji_group_id " +
 				"  left outer join db_user.tb_user_inf on tb_user_inf.uid=db_user.tb_user_battgroup_baojigroup_usr.uid " +
-				"  where db_user.tb_user_inf.uid=? and db_battinf.tb_battinf.station_install=1 ) "+
-				"  limit ?,? ";
-		List<App_bts_comm_task> list=DAOHelper.executeQueryLimit(sql, conn,new Object[]{"%"+binf.getStationName1()+"%","%"+binf.getStationName2()+"%","%"+binf.getStationId()+"%","%"+binf.getStationName5()+"%",binf.getNum(),(page.getPageCurr()-1)*page.getPageSize(),page.getPageSize()}, new CallBack() {
+				"  where db_user.tb_user_inf.uid=? and db_battinf.tb_battinf.station_install=1 ) "+*/
+		//FBSDeviceId绛涢��
+		String dev_idT=" db_app_sys.tb_app_bts_comm_task.dev_id=? ";
+		String dev_idF=" db_app_sys.tb_app_bts_comm_task.dev_id!=? ";
+		if(binf.getFBSDeviceId()==0){
+			sql+=dev_idF;
+		}else{
+			sql+=dev_idT;
+		}
+		String orderSql="  order by dev_id limit ?,? ";
+		sql+=orderSql;
+		//System.out.println(sql);                                                    //"%"+binf.getStationName1()+"%","%"+binf.getStationName2()+"%","%"+binf.getStationId()+"%","%"+binf.getStationName5()+"%",binf.getNum()
+		List<App_bts_comm_task> list=DAOHelper.executeQueryLimit(sql, conn,new Object[]{binf.getFBSDeviceId(),(page.getPageCurr()-1)*page.getPageSize(),page.getPageSize()}, new CallBack() {
 			
 			public List getResults(ResultSet rs) {
 				List list=new ArrayList();
@@ -71,6 +83,7 @@
 						atask.setDev_id(rs.getInt("dev_id"));
 						atask.setThread_id(rs.getInt("thread_id"));
 						atask.setBattgroup_cnt(rs.getInt("battgroup_cnt"));
+						atask.setDev_mcu_uid(rs.getString("dev_mcu_uid"));
 						atask.setBattgroup_id1(rs.getInt("battgroup_id1"));
 						atask.setBattgroup_index1(rs.getInt("battgroup_index1"));
 						atask.setBattgroup_id2(rs.getInt("battgroup_id2"));
@@ -79,7 +92,7 @@
 						atask.setBattgroup_index3(rs.getInt("battgroup_index3"));
 						atask.setBattgroup_id4(rs.getInt("battgroup_id4"));
 						atask.setBattgroup_index4(rs.getInt("battgroup_index4"));
-						atask.setConnect_time(rs.getTimestamp("connect_time"));
+						atask.setConnet_time(rs.getTimestamp("connet_time"));
 						atask.setDev_comm_runtime(rs.getTimestamp("dev_comm_runtime"));
 						atask.setBreak_type(rs.getInt("break_type"));
 						atask.setStationId(rs.getString("stationId"));
@@ -106,7 +119,27 @@
 		}
 		return list;
 	}
-
+    public static void main(String[] args) {
+		App_bts_comm_taskImpl aimpl=new App_bts_comm_taskImpl();
+		BattInf binf=new BattInf();
+		binf.setNum(1002);
+		binf.setStationName1("");
+		binf.setStationName2("");
+		binf.setStationName3("");
+		binf.setStationName5("");
+		binf.setStationId("");
+		binf.setBattGroupNum(62);
+		binf.setFBSDeviceId(0);
+		Page p=new Page();
+		p.setPageCurr(1);
+		p.setPageSize(100);
+		binf.setPage(p);
+		List<App_bts_comm_task> list=aimpl.serchByCondition(binf);
+		for (App_bts_comm_task task : list) {
+			System.out.println(task);
+		}
+		System.out.println(list.size());
+	}
 	public List serchByInfo(Object obj) {
 		// TODO Auto-generated method stub
 		return null;

--
Gitblit v1.9.1