From 35fefed0792c40cb99b8d15fa5811bbb5992bff9 Mon Sep 17 00:00:00 2001
From: D:/workspace/chenjingjing/git/gx_tieta/gx_tieta/.gitignore <chenjingjing@LAPTOP-E51P2139>
Date: 星期一, 21 一月 2019 10:42:24 +0800
Subject: [PATCH] 修改

---
 gx_tieta/src/com/fgkj/dao/impl/Bts_station_eventImpl.java |   73 +++++++++++++++++++++++++++++++-----
 1 files changed, 62 insertions(+), 11 deletions(-)

diff --git a/gx_tieta/src/com/fgkj/dao/impl/Bts_station_eventImpl.java b/gx_tieta/src/com/fgkj/dao/impl/Bts_station_eventImpl.java
index 852b89b..cbe910a 100644
--- a/gx_tieta/src/com/fgkj/dao/impl/Bts_station_eventImpl.java
+++ b/gx_tieta/src/com/fgkj/dao/impl/Bts_station_eventImpl.java
@@ -1,5 +1,6 @@
 package com.fgkj.dao.impl;
 
+import java.sql.Connection;
 import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.text.ParseException;
@@ -8,11 +9,14 @@
 import java.util.Date;
 import java.util.List;
 
+import sun.security.krb5.internal.PAEncTSEnc;
+
 import com.fgkj.actions.ActionUtil;
 import com.fgkj.dao.AlarmDaoFactory;
 import com.fgkj.dao.BaseDAO;
 import com.fgkj.dao.CallBack;
 import com.fgkj.dao.DAOHelper;
+import com.fgkj.dao.LimitNumberFactory;
 import com.fgkj.db.DBUtil;
 import com.fgkj.dto.BattInf;
 import com.fgkj.dto.Batt_Maint_Dealarm;
@@ -50,11 +54,15 @@
     //鏈烘埧浜嬩欢缁熻
 	public List serchByCondition(Object obj) {
 		final BattInf binf=(BattInf) obj;
-		String sql="select station_id,dev_id,station_event_type,record_datetime,station_event_trig ,tb_battinf.StationName,tb_battinf.StationName1,tb_battinf.StationName2,tb_battinf.StationName3 " +
+		//System.out.println(binf);
+		String sql="select distinct station_id,dev_id,station_event_type,record_datetime,station_event_trig ,tb_battinf.StationName,tb_battinf.StationName1,tb_battinf.StationName2,tb_battinf.StationName3,tb_battinf.StationName5 " +
 				" from db_alarm.tb_bts_station_event,db_battinf.tb_battinf " +
 				" where  tb_bts_station_event.dev_id=tb_battinf.FBSDeviceId " +
+				" and tb_bts_station_event.station_id 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  record_datetime>=?  and  record_datetime<=?  " +
-				" and stationname1 like ? and stationname2 like  ? and stationname3 like ? and stationid like ? " ;
+				" and stationname1 like ? and stationname2 like  ? and stationname3 like ? and stationname5 like ?  and stationid like ? " ;
 		/*//浜嬩欢绛涢��
 		String eventSqlT=" and station_event_type!=? ";
 		String eventSqlF=" and station_event_type=? ";
@@ -69,8 +77,8 @@
 		//鎺掑簭
 		String orderSql="  order by station_id,record_datetime,station_event_type asc  ";
 		sql+=orderSql;
-		System.err.println(sql);
-		List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{binf.getBattInUseDate(),binf.getBattInUseDate1(),"%"+binf.getStationName1()+"%","%"+binf.getStationName2()+"%","%"+binf.getStationName3()+"%","%"+binf.getStationId()+"%"}, new CallBack() {
+		//System.err.println(sql);
+		List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{binf.getNum(),binf.getBattInUseDate(),binf.getBattInUseDate1(),"%"+binf.getStationName1()+"%","%"+binf.getStationName2()+"%","%"+binf.getStationName3()+"%","%"+binf.getStationName5()+"%","%"+binf.getStationId()+"%"}, new CallBack() {
 			
 			public List getResults(ResultSet rs) {
 				List list=new ArrayList();
@@ -289,13 +297,35 @@
     //鏈烘埧浜嬩欢缁熻(璇︽儏)
 	public List serchByInfo(Object obj) {
 		Bts_station_event bevent=(Bts_station_event) obj;
-		String sql="select station_id,dev_id,station_event_type,record_datetime,station_event_trig ,tb_battinf.StationName,tb_battinf.StationName1,tb_battinf.StationName2,tb_battinf.StationName3 " +
-				" from tb_bts_station_event,db_battinf.tb_battinf " +
+		Page p=bevent.getPage();
+		//Connection conn=DBUtil.getConn();
+		//String numberSql=" SELECT FOUND_ROWS() number";
+		//SQL_CALC_FOUND_ROWS
+		String sql="select  distinct station_id,dev_id,station_event_type,record_datetime,station_event_trig ,tb_battinf.StationName,tb_battinf.StationName1,tb_battinf.StationName2,tb_battinf.StationName3 " +
+				" from db_alarm.tb_bts_station_event,db_battinf.tb_battinf " +
 				" where  tb_bts_station_event.dev_id=tb_battinf.FBSDeviceId " +
+				"  and tb_bts_station_event.station_id 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 dev_id=?  " +
-				" and  record_datetime>=?  and  record_datetime<=? " +
-				" order by station_id,station_event_type,record_datetime,station_event_trig asc ";
-		List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{bevent.getDev_id(),bevent.getRecord_datetime(),bevent.getRecord_datetime_end()}, new CallBack() {
+				" and  record_datetime>=?  and  record_datetime<=? ";
+		//鍩虹珯鐘舵��
+		String eventSqlT=" and station_event_type!=? ";
+		String eventSqlF=" and station_event_type=? ";
+		if(bevent.getStation_event_type()==0){
+			sql+=eventSqlT;
+		}else{
+			sql+=eventSqlF;
+		}
+		//鎺掑簭
+		String orderSql=" order by station_id,station_event_type,record_datetime,station_event_trig asc " ;
+		sql+=orderSql;
+	    //鍒嗛〉
+		//String limitSql=" limit ?,? ";
+		//sql+=limitSql;
+		//,(p.getPageCurr()-1)*p.getPageSize(),p.getPageSize()
+		//executeQueryLimit
+		List<Bts_station_event> list=DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{bevent.getNum(),bevent.getDev_id(),bevent.getRecord_datetime(),bevent.getRecord_datetime_end(),bevent.getStation_event_type()}, new CallBack() {
 			
 			public List getResults(ResultSet rs) {
 				List list=new ArrayList();
@@ -308,6 +338,8 @@
 						b.setStation_event_type(rs.getInt("station_event_type"));
 						b.setStation_event_trig(rs.getInt("station_event_trig"));
 						b.setStationName(rs.getString("stationName"));
+						Page p=new Page();
+						b.setPage(p);
 						list.add(b);
 					}
 				} catch (SQLException e) {
@@ -317,6 +349,12 @@
 				return list;
 			}
 		});
+		/*//鍘绘帀limit鏉′欢鍚庣殑鎬绘暟
+		int number=LimitNumberFactory.GetLimtitNumber(conn, numberSql);
+		//System.out.println("number: "+number);
+		if(list!=null&&list.size()>0){
+			list.get(list.size()-1).getPage().setPageAll(number);
+		}*/
 		return list;
 	}
 	public static void main(String[] args) throws ParseException {
@@ -340,12 +378,13 @@
 		
 		
 		BattInf binf = new BattInf();
-		binf.setNum(0);
+		binf.setNum(1002);
 	    binf.setStationName("");
 		binf.setStationName1("");
 		binf.setStationName2("");
 		binf.setStationName3("");
-		binf.setStationId("");
+		binf.setStationName5("");
+		binf.setStationId("42000524");
 		binf.setBattGroupNum(1);
 		binf.setBattInUseDate(ActionUtil.getSimpDate(date1));
 		binf.setBattInUseDate1(ActionUtil.getSimpDate(date2));
@@ -361,6 +400,18 @@
         for (Bts_station_event b : list) {
 			System.out.println(b.getNote()+" "+b.getDev_id()+" "+b.getStation_event_type_poff()+" "+b.getStation_event_type_xuhang()+" "+b.getStation_event_type_fadian()+" "+b.getStation_event_type_diaozhan()+" "+b.getStation_event_type_dooropen()+" "+b.getStation_event_type_tempup()+" "+b.getStation_event_type_templow()+" "+b.getStation_event_type_dampup()+" "+b.getStation_event_type_damplow()+" "+b.getStationName());
 		}
+        Bts_station_event b=new Bts_station_event();
+        b.setNum(1002);
+        b.setDev_id(910000534);
+        b.setRecord_datetime(ActionUtil.getSimpDate(date1));
+        b.setRecord_datetime_end(ActionUtil.getSimpDate(date2));
+        b.setStation_event_type(0);
+        Page page=new Page();
+        page.setPageCurr(1);
+        page.setPageSize(10);
+        b.setPage(page);
+        //List list=bimpl.serchByInfo(b);
+        //System.out.println(list.size());
 	}
 
 }

--
Gitblit v1.9.1