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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
package PbuliClass;
import java.awt.Image;
import java.util.Iterator;
import java.util.List;
import java.util.Vector;
import javax.swing.ImageIcon;
import DataBase.DatabaseManagement;
import home.Open_soft_dialog;
import tbDataModel.TbDepartment;
@SuppressWarnings("rawtypes")
 
public class BuMens {
    static Vector<TbDepartment> bumens;    
    static{
        bumens=new Vector<>();    
        Open_soft_dialog.addara("¼ÓÔØtb_department");
        Iterator iterator = DatabaseManagement.get_alldate_indatabase("tb_department").iterator();
        while (iterator.hasNext()) {//µü´úÆ÷´æÔÚÔªËØ
            List info = (List) iterator.next();//½«µü´úÆ÷ÀïÃæµÄÔªËØ¸øµ½info¼¯ºÏ
            TbDepartment bumen=new TbDepartment();
            bumen.setDepartmentName((String)info.get(1));
            bumen.setIconadress((String)info.get(3));
            bumens.add(bumen);
        }
    }
 
 
    /**·µ»ØËùÓв¿ÃŶÔÏóµÄ¼¯ºÏ*/
    public static Vector<TbDepartment>  getBumens(){
        return bumens;
    }
 
    /**»ñÈ¡ËùÓв¿ÃÅÃû³Æ¼¯ºÏ*/
    public  static String[] getBumenNames() {
        String[] bumenNames = null;
        if(getBumens().size() !=0) {
            int i=0;
            bumenNames=new String[getBumens().size()];
            Iterator<TbDepartment> it=getBumens().iterator();
            while (it.hasNext()) {//µü´úÆ÷´æÔÚÔªËØ    
                TbDepartment bumen = it.next();//½«µü´úÆ÷ÀïÃæµÄÔªËØ¸øµ½info¼¯ºÏ
                bumenNames[i]=bumen.getDepartmentName();
                i++;
            }
        }
        if (bumenNames==null){
            ShowMessage.zidingyi_24("ÇëÏÈÔÚ²¿ÃŹÜÀí½çÃæÌí¼Ó²¿ÃÅ¡£¡£¡£");
        }
        return bumenNames;
    }
 
    /**»ñÈ¡ËùÓв¿ÃÅÃû³Æ¼¯ºÏ*/
    public  static String[] getBumenNames2() {
        int size=getBumens().size();
        String[] bumenNames = new String[size+1];
        bumenNames[0]="Ñ¡Ôñ²¿ÃÅ";
        for(int i=0;i<size;i++) {
            TbDepartment bumen=getBumens().get(i);
            bumenNames[i+1]=bumen.getDepartmentName();
        }            
        return bumenNames;
    }
 
    /**»ñÈ¡²¿ÃÅÃû³Æ¶ÔÓ¦µÄͼ±ê*/
    public  static String geticonadress(String bumenName) {
        String icon_adress="image/targeticon/default.png";
        if(getBumens().size() !=0) {
            Iterator<TbDepartment> it=getBumens().iterator();
            while (it.hasNext()) {//µü´úÆ÷´æÔÚÔªËØ    
                TbDepartment bumen = it.next();//½«µü´úÆ÷ÀïÃæµÄÔªËØ¸øµ½info¼¯ºÏ
                String buname=bumen.getDepartmentName();
                String icon_adress1=bumen.getIconadress();
                if(buname.equals(bumenName)) {
                    icon_adress=icon_adress1;                    
                }
            }
        }
        return icon_adress;
    }
 
    /**»ñȡij¸ö²¿ÃŶÔÏó¶ÔӦͼ±ê*/
    public static Image geticoimage(String bumenName) {    
        Image image=null;
        String icon_adress="image/targeticon/default.png";
        if(getBumens().size() !=0) {
            Iterator<TbDepartment> it=getBumens().iterator();
            while (it.hasNext()) {//µü´úÆ÷´æÔÚÔªËØ    
                TbDepartment bumen = it.next();//½«µü´úÆ÷ÀïÃæµÄÔªËØ¸øµ½info¼¯ºÏ
                String buname=bumen.getDepartmentName();
                String icon_adress1=bumen.getIconadress();
                if(buname.equals(bumenName)) {
                    icon_adress=icon_adress1;
                    break;
                }
            }
        }
        image=new ImageIcon(icon_adress).getImage();
        return image;
    }
 
    /**»ñȡij¸ö²¿ÃŶÔÏó*/
    public  static TbDepartment get_bumen(String bumenname) {
        TbDepartment bumen=null;
        if(getBumens().size() !=0) {
            Iterator<TbDepartment> it=getBumens().iterator();
            while (it.hasNext()) {//µü´úÆ÷´æÔÚÔªËØ    
                TbDepartment bumen1 = it.next();//½«µü´úÆ÷ÀïÃæµÄÔªËØ¸øµ½info¼¯ºÏ
                String buname=bumen.getDepartmentName();
                if(buname.equals(bumenname)) {
                    bumen=bumen1;                    
                }
            }
        }
        return bumen;        
    }
 
 
 
    /**¸Ä±ä²¿ÃŵÄͼ±êÈç¹û²¿ÃŲ»´æÔÚÔòÌí¼ÓÒ»¸ö²¿ÃÅ*/
    public  static void set_bumen_icon(String bumenname,String adress) {
        if(get_bumen(bumenname) !=null) {
            get_bumen(bumenname).setIconadress(adress);    
        }else {
            TbDepartment newbumen=new TbDepartment();
            newbumen.setDepartmentName(bumenname);
            newbumen.setIconadress(adress);
            getBumens().add(newbumen);
        }    
    }
}