81041
2020-01-06 dc4e90ff7d720a78dba3aa72d868b89f69eafff7
Device_Manage/src/com/fgkj/dao/impl/Batt_rtstateImpl.java
@@ -82,10 +82,15 @@
      return list;
   }
    //测试数据——实时查询充放电统计
   public List serchDisOrChargrNew(){
      String sql=" select sum(if(batt_test_type=2,1,0)) as charge,sum(if(batt_test_type=3,1,0)) as discharge  from db_ram_db.tb_batt_rtstate where batt_test_type IN(2,3)  "
   public List serchDisOrChargrNew(Object obj){
      BattInf binf=(BattInf) obj;
      String sql=" select sum(if(batt_test_type=2,1,0)) as charge,sum(if(batt_test_type=3,1,0)) as discharge  "
            + "  from db_ram_db.tb_batt_rtstate,db_battinf.tb_battinf "
            + "  where db_alarm.tb_battalarm_data.battGroupId=db_battinf.tb_battinf.battGroupId  "
            + "  and batt_test_type IN(2,3)  "
            + "  and db_battinf.tb_battinf.FBSDeviceId=? "
            + "  GROUP BY batt_test_type  ";
      List list=DAOHelper.executeQuery(sql, DBUtil.getConn(),null, new CallBack() {
      List list=DAOHelper.executeQuery(sql, DBUtil.getConn(),new Object[]{binf.getFBSDeviceId()}, new CallBack() {
         
         public List getResults(ResultSet rs) {
            List list=new ArrayList();
@@ -119,7 +124,8 @@
            + " ,batt_state,batt_test_type,batt_test_starttime,batt_test_recordtime,batt_test_tlong,batt_test_cap,batt_real_cap,batt_rest_cap"
            + " ,FBSDeviceId,BattGroupName "
            + " from db_ram_db.tb_batt_rtstate,db_battinf.tb_battinf "
            + " where  db_ram_db.tb_batt_rtstate.battGroupId=db_battinf.tb_battinf.battGroupId ";
            + " where  db_ram_db.tb_batt_rtstate.battGroupId=db_battinf.tb_battinf.battGroupId "
            + " and db_battinf.tb_battinf.FBSDeviceId=?  ";
      //判断是充电还是放电
      String chargeSqlT="  and batt_state!=? ";
      String chargeSqlF="  and batt_state=? ";
@@ -131,7 +137,7 @@
      String endsql=" order by batt_test_starttime desc";
      sql+=endsql;
      //System.out.println(sql);
      List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{binf.getNum()}, new CallBack() {
      List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{binf.getFBSDeviceId(),binf.getNum()}, new CallBack() {
         
         @Override
         public List getResults(ResultSet rs) {
@@ -171,7 +177,7 @@
      Batt_rtstateImpl bimpl=new Batt_rtstateImpl();
      BattInf binf=new BattInf();
      binf.setNum(100);
      List<Integer> list=bimpl.serchDisOrChargrNew();
      List<Integer> list=bimpl.serchDisOrChargrNew(binf);
      for (Integer num : list) {
            System.out.println(num);
      }