zsh_root
2024-01-02 7b595546af704983dbafcd0d385c8768ddacefc2
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
package tbDataModel_Dell;
import java.util.Iterator;
import java.util.List;
import java.util.Vector;
import DataBase.DatabaseManagement;
import Method.GetNowTime;
import home.Open_soft_dialog;
import tbDataModel.Tb_tongbuanchor;
@SuppressWarnings("rawtypes")
public class Dell_TongbuAnchor {
    static Vector<Tb_tongbuanchor> rootanchor_vector=new Vector<Tb_tongbuanchor>();//»ùÕ¾µÄ¼¯ºÏ
    static {
        Open_soft_dialog.addara("¼ÓÔØtb_tongbuanchor");
        Iterator iterator = DatabaseManagement.table_base("tb_tongbuanchor","ASC","anchorid").iterator();        
        while (iterator.hasNext()) {//µü´úÆ÷´æÔÚÔªËØ
            List info = (List) iterator.next();//½«µü´úÆ÷ÀïÃæµÄÔªËØ¸øµ½info¼¯ºÏ
            Tb_tongbuanchor rootanchor=new Tb_tongbuanchor();
            rootanchor.setAnchorid((String)info.get(0));
            String rootancid=(String)info.get(1);
            if(rootancid==null) {
                rootancid="";
            }
            rootanchor.setRootanchorid(rootancid);
            rootanchor.setType((String)info.get(2));
            String states=(String)info.get(3);
            if(states==null) {
                states="0";
            }
            rootanchor.setState(states);
            rootanchor.setAddtime((String)info.get(4));
            rootanchor_vector.add(rootanchor); 
        }
    }
    
    public static Vector<Tb_tongbuanchor> getRootanchor_vector() {
        return rootanchor_vector;
    }
    
    /**ͨ¹ý»ùÕ¾IDÕÒµ½Í¬²½»ùÕ¾¶ÔÏó*/
    public static Tb_tongbuanchor get_tb_rootanchor(String anchorid) {
        Tb_tongbuanchor rootanchor=null;
        int size=rootanchor_vector.size();
        if( size!=0) {
            for(int i=0;i<size ;i++) {
                String anchorid1=rootanchor_vector.get(i).getAnchorid();
                if(anchorid1.equals(anchorid)) {
                    rootanchor=rootanchor_vector.get(i);
                    break;
                }
            }
 
        }
        return rootanchor;
    }
    
    /**ÐÞ¸Äͬ²½»ùÕ¾ÐÅÏ¢*/
    public static void alert_rootanchor(String anchorid,String rootanchorid,String type,String state) {
        if(get_tb_rootanchor( anchorid) !=null) {
            get_tb_rootanchor(anchorid).setAddtime(GetNowTime.now2());
            get_tb_rootanchor(anchorid).setRootanchorid(rootanchorid);
            get_tb_rootanchor(anchorid).setState(state);
            get_tb_rootanchor(anchorid).setType(type);            
        }
    }
    
    /**ÐÞ¸Äͬ²½»ùÕ¾µÄͬ²½×´Ì¬*/
    public static void alert_rootanchor(String anchorid,String state) {
        if(get_tb_rootanchor( anchorid) !=null) {
            get_tb_rootanchor(anchorid).setAddtime(GetNowTime.now2());
            get_tb_rootanchor(anchorid).setState(state);
        }
    }
    
    
    
    /**ɾ³ýij¸öͬ²½»ùÕ¾¶ÔÏó*/
    public static void delete_rootanchor(String anchorid) {
        if(get_tb_rootanchor( anchorid) !=null) {
            rootanchor_vector.remove(get_tb_rootanchor( anchorid) );
            String deleteSql="DELETE FROM tb_tongbuanchor WHERE anchorid='"+anchorid+"'";
            DatabaseManagement.update(deleteSql) ;
        }
    }
    
    /**ɾ³ýËùÓÐͬ²½»ùÕ¾¶ÔÏó*/
    public static void delete_all_rootanchor() {
        if(rootanchor_vector.size() !=0) {
            rootanchor_vector.removeAllElements();
            String deleteSql="TRUNCATE TABLE tb_tongbuanchor";    
            DatabaseManagement.update(deleteSql) ;
        }
    }
    
    /**ÐÂÔöÒ»¸öͬ²½»ùÕ¾¶ÔÏó*/
    public static void add_one_rootanchor(String anchorid,String rootanchorid,String type,String state) {
        if(get_tb_rootanchor(anchorid)!=null) {
            return;
        }
        Tb_tongbuanchor rootanchor=new Tb_tongbuanchor();
        rootanchor.setAnchorid(anchorid);
        rootanchor.setRootanchorid(rootanchorid);
        rootanchor.setState(state);
        rootanchor.setType(type);
        rootanchor.setAddtime(GetNowTime.now());
        rootanchor_vector.add(rootanchor);
        
        String[]  ziduan= { "anchorid","rootanchorid","type","state","addtime"};
        String[] zhi= {anchorid,rootanchorid,type,state,GetNowTime.now()};
        DatabaseManagement.insertfast("tb_tongbuanchor", ziduan, zhi);
        
    }
    
 
}