81041
2018-12-03 e6127f8fc2e32360366315e02668ed06483c31e6
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
114
115
package com.fgkj.dao.impl;
 
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
 
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.App_bts_comm_task;
import com.fgkj.dto.BattInf;
import com.fgkj.dto.Page;
import com.mysql.fabric.xmlrpc.base.Array;
 
public class App_bts_comm_taskImpl implements BaseDAO,CallBack{
 
    public List getResults(ResultSet rs) {
        // TODO Auto-generated method stub
        return null;
    }
 
    public boolean add(Object obj) {
        // TODO Auto-generated method stub
        return false;
    }
 
    public boolean update(Object obj) {
        // TODO Auto-generated method stub
        return false;
    }
 
    public boolean del(Object obj) {
        // TODO Auto-generated method stub
        return false;
    }
 
    public List searchAll() {
        // TODO Auto-generated method stub
        return null;
    }
    //根据省市区机房名称查询(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 " +
                "  ,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 (" +
                "  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() {
            
            public List getResults(ResultSet rs) {
                List list=new ArrayList();
                try {
                    while(rs.next()){
                        App_bts_comm_task atask=new App_bts_comm_task();
                        atask.setDev_id(rs.getInt("dev_id"));
                        atask.setThread_id(rs.getInt("thread_id"));
                        atask.setBattgroup_cnt(rs.getInt("battgroup_cnt"));
                        atask.setBattgroup_id1(rs.getInt("battgroup_id1"));
                        atask.setBattgroup_index1(rs.getInt("battgroup_index1"));
                        atask.setBattgroup_id2(rs.getInt("battgroup_id2"));
                        atask.setBattgroup_index2(rs.getInt("battgroup_index2"));
                        atask.setBattgroup_id3(rs.getInt("battgroup_id3"));
                        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.setDev_comm_runtime(rs.getTimestamp("dev_comm_runtime"));
                        atask.setBreak_type(rs.getInt("break_type"));
                        atask.setStationId(rs.getString("stationId"));
                        atask.setStationName(rs.getString("stationName"));
                        atask.setStationName1(rs.getString("stationName1"));
                        atask.setStationName2(rs.getString("stationName2"));
                        atask.setStationName3(rs.getString("stationName3"));
                        atask.setStationName5(rs.getString("stationName5"));
                        list.add(atask);
                    }
                    
                } catch (SQLException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
                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).setNum(number);
        }
        return list;
    }
 
    public List serchByInfo(Object obj) {
        // TODO Auto-generated method stub
        return null;
    }
 
}