综合管理平台数据库数据模拟程序
Administrator
2021-03-25 3c531709c279453b02c4b087466d79fa3491ee74
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
package com.thread;
 
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
 
import com.mode.Device_Inf;
import com.sql.MysqlConnPool;
import com.sql.Sql_Mysql;
 
public class Manage_Simul_SQL {
 
    /**
     *     ¼ÓÔØËùÓеÄÉ豸
     * @param gB_MysqlConnPool
     * @param devices
     */
    public static void queryAllDevice(MysqlConnPool pool, List<Device_Inf> devices) {
        devices = new ArrayList<Device_Inf>();
        String sql_str = " SELECT * FROM "+ Sql_Mysql.Tb_Device_Inf_Table;
        Sql_Mysql sql = new Sql_Mysql(pool.getConn());
        ResultSet res = null;
        try {
            res = sql.sqlMysqlQuery(sql_str);
            while(res.next()) {
                Device_Inf dev = new Device_Inf();
                dev.setDevice_id(res.getInt("device_id"));
                dev.setDevice_ip(res.getString("device_ip"));
                dev.setDevice_name(res.getString("device_name"));
                dev.setMaint_cycle(res.getInt("maint_cycle"));
                dev.setSystem_id(res.getInt("system_id"));
                dev.setSystem_name(res.getString("system_name"));
                dev.setUse_starttime(res.getDate("use_starttime"));
                dev.setUser_id(res.getInt("user_id"));
                devices.add(dev);
            }
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if(null != res) {
                try {
                    res.close();
                } catch (SQLException e) {
                    e.printStackTrace();
                }
            }
            sql.close_con();
        }
    }
    
}