whycxzp
2023-12-07 4813529852850d9648679ab26394bf4878b2bf5a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
package com.whyc.service;
 
import com.whyc.pojo.db_ckpwrdev_alarm.CKPowerDevAlarm;
import com.whyc.pojo.db_ckpwrdev_alarm.CKPowerDevAlarmHistory;
import sun.plugin2.jvm.RemoteJVMLauncher;
 
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
 
public class SubTablePageInfoService {
 
    /*public int getCount(CKPowerDevAlarmHistory param){
        String sql="select  count(distinct alarm.num) as number from db_pwrdev_alarm."+param.getRecordYear()+" alarm,db_pwrdev_inf.tb_pwrdev_inf inf " +
                "  where alarm.PowerDeviceId = inf.PowerDeviceId ";
        if(param.getStationName1()!=null){
            sql+=" and stationName1 like '%"+param.getStationName1()+"%'";
        }
        if(param.getStationName2()!=null){
            sql+=" and stationName2 like '%"+param.getStationName2()+"%'";
        }
        if(param.getStationName5()!=null){
            sql+=" and stationName5 like '%"+param.getStationName5()+"%'";
        }
        if(param.getStationName3()!=null){
            sql+=" and stationName3 like '%"+param.getStationName3()+"%'";
        }
        if(param.getAlmStartTime()!=null){
            sql+=" and alarm.alm_start_time  >='"+ThreadLocalUtil.format(param.getAlmStartTime(),1)+"' ";
        }
        if(param.getAlmStartTime1()!=null){
            sql+=" and alarm.alm_start_time  <='"+ThreadLocalUtil.format(param.getAlmStartTime1(),1)+"' ";
        }
        if(param.getAlmSource()==0){
            sql+=" and alm_source!=100 ";
        }
        if(param.getAlmSource()!=0){
            sql+=" and alm_source="+param.getAlmSource()+" ";
        }
        if(param.getAlmTypes()!=null&&param.getAlmTypes().size()>0){
            sql+=" and alm_type in ( ";
            for (int i=0;i<param.getAlmTypes().size();i++) {
                sql+=param.getAlmTypes().get(i);
                if(i!=(param.getAlmTypes().size()-1)){
                    sql+=",";
                }
            }
            sql+=")";
        }
        sql+=" and StationId in ( select distinct inf.StationId from" +
                "            (select StationId from db_battinf.tb_battinf union select StationId from db_pwrdev_inf.tb_pwrdev_inf ) inf," +
                "            db_user.tb_user_battgroup_baojigroup_battgroup," +
                "            db_user.tb_user_battgroup_baojigroup_usr," +
                "            db_user.tb_user_inf" +
                "            where db_user.tb_user_battgroup_baojigroup_battgroup.StationId=inf.StationId" +
                "            and" +
                "            db_user.tb_user_battgroup_baojigroup_usr.baoji_group_id=db_user.tb_user_battgroup_baojigroup_battgroup.baoji_group_id" +
                "            and db_user.tb_user_inf.uid=db_user.tb_user_battgroup_baojigroup_usr.uid" +
                "            and db_user.tb_user_inf.uid="+param.getUsrId()+" )";
        List list = sqlExecuteService.executeQuery_call(sql, new CallBack() {
            @Override
            public List getResults(ResultSet rs) throws SQLException {
                LinkedList<Object> temp = new LinkedList<>();
                try {
                    while (rs.next())
                        temp.add(rs.getInt("number"));
                } catch (SQLException e) {
                    e.printStackTrace();
                }
                return temp;
            }
        });
        int num =0;
        if(list!=null){
            num= (int) list.get(0);
        }
        return num;
    }*/
 
    /*public List getList(Object object){
        if(object instanceof CKPowerDevAlarmHistory){
            CKPowerDevAlarmHistory param = (CKPowerDevAlarmHistory) object;
            String sql="SELECT * from db_ckpwrdev_alarm."+ param.getTableName() +" where "
                    "        AND groupUser.uId ="+uId+")";
            List list = sqlExecuteService.executeQuery_call(sql, new RemoteJVMLauncher.CallBack() {
                @Override
                public List getResults(ResultSet rs) throws SQLException {
                    List<PwrdevTimeOutAlarm> list=new ArrayList<>();
                    while (rs.next()){
                        PwrdevTimeOutAlarm ph=new PwrdevTimeOutAlarm();
                        ph.setNum(rs.getLong("num"));
                        ph.setPowerDeviceId(rs.getLong("PowerDeviceId"));
                        ph.setAlarmTypeid(rs.getInt("alarm_typeId"));
                        ph.setAlarmIndex(rs.getInt("alarm_index"));
                        ph.setTimeoutTag(rs.getInt("timeout_tag"));
                        ph.setReadDatetime(rs.getTimestamp("read_datetime"));
                        ph.setSystemDatetime(rs.getTimestamp("system_datetime"));
                        ph.setResumeDatetime(rs.getTimestamp("resume_datetime"));
                        ph.setAlarmName(rs.getString("alarm_name"));
                        ph.setStationName(rs.getString("StationName"));
                        list.add(ph);
                    }
                    return list;
                }
            });
            return list;
        }
    }*/
 
 
}