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);
|
|
}
|
|
|
}
|