📄 pedu.java
字号:
package thizlinux.linuxhr;import java.sql.*;import java.text.*;import java.util.*;public class pedu { private String uid=""; private String id=""; private String sdate=""; private String edate=""; private String school=""; private String major=""; private String degree=""; private String description=""; private String sql; private boolean status=true; private Vector idl=new Vector(); private Vector sdatel=new Vector(); private Vector edatel=new Vector(); private Vector schooll=new Vector(); private Vector degreel=new Vector(); private Vector majorl=new Vector(); public Iterator getIdl(){ return idl.iterator(); } public Iterator getSdatel(){ return sdatel.iterator(); } public Iterator getEdatel(){ return edatel.iterator(); } public Iterator getSchooll(){ return schooll.iterator(); } public Iterator getDegreel(){ return degreel.iterator(); } public Iterator getMajorl(){ return majorl.iterator(); } public void setUid(String value){ this.uid=value; } public String getUid(){ return this.uid; } public void setId(String value){ this.id=value; } public String getId(){ return this.id; } public void setSdate(String value){ this.sdate=value; } public String getSdate(){ return this.sdate; } public void setEdate(String value){ this.edate=value; } public String getEdate(){ return this.edate; } public void setSchool(String value){ this.school=value; } public String getSchool(){ return this.school; } public void setMajor(String value){ this.major=value; } public String getMajor(){ return this.major; } public void setDegree(String value){ this.degree=value; } public String getDegree(){ return this.degree; } public void setDescription(String value){ this.description=value; } public String getDescription(){ return this.description; } public void refresh(){ DBconnect dbconn =new DBconnect(); idl.clear(); sdatel.clear(); edatel.clear(); schooll.clear(); degreel.clear(); majorl.clear(); ResultSet rs=null; try{ sql="select id,sdate,edate,school,degree,major from tbl_pedu where uid='"+this.uid+"'"; rs=dbconn.executeQuery(sql); while(rs.next()){ idl.add(pub.datachange(rs.getString("id"))); sdatel.add(pub.datachange(rs.getString("sdate"))); edatel.add(pub.datachange(rs.getString("edate"))); schooll.add(pub.datachange(rs.getString("school"))); degreel.add(pub.datachange(rs.getString("degree"))); majorl.add(pub.datachange(rs.getString("major"))); } sql="select sdate,edate,school,major,degree,description "+ "from tbl_pedu where id='"+this.id+"' and uid='" +this.uid+"'"; rs=dbconn.executeQuery(sql); if(rs.next()){ this.sdate=pub.datachange(rs.getString("sdate")); this.edate=pub.datachange(rs.getString("edate")); this.school=pub.datachange(rs.getString("school")); this.major=pub.datachange(rs.getString("major")); this.degree=pub.datachange(rs.getString("degree")); this.description=pub.datachange(rs.getString("description")); } else{ reset(); } }catch(Exception e){ System.out.println(e+",sql="+sql); status=false; }finally{ try{ if(rs!=null)rs.close(); if(dbconn!=null)dbconn.close(); }catch(Exception e){ System.out.println(e); } } } public boolean update(){ status=true; if(sdate==null||sdate.equalsIgnoreCase("")) { return false; } DBconnect dbconn =new DBconnect(); try{ sql = "delete from tbl_pedu where uid='" + this.uid + "' and id='"+this.id+"'"; dbconn.executeUpdate(sql); sql="insert into tbl_pedu(id,uid,sdate,edate,school,major,degree,description) "+ "values('',"+ "'"+this.uid+"',"+ "'"+this.sdate+"',"+ "'"+this.edate+"',"+ "'"+this.school+"',"+ "'"+this.major+"',"+ "'"+this.degree+"',"+ "'"+this.description+"')"; dbconn.executeUpdate(sql); reset(); }catch(Exception e){ System.out.println(e+",sql="+sql); status=false; }finally{ try{ if(dbconn!=null)dbconn.close(); }catch(Exception e){ System.out.println(e); } } return status; } public boolean remove(){ status=true; DBconnect dbconn =new DBconnect(); try{ sql = "delete from tbl_pedu where uid='" + this.uid + "' and id='"+this.id+"'"; dbconn.executeUpdate(sql); this.id=""; }catch(Exception e){ System.out.println(e+",sql="+sql); status=false; }finally{ try{ if(dbconn!=null)dbconn.close(); }catch(Exception e){ System.out.println(e); } } return status; } public void reset(){ this.sdate=""; this.edate=""; this.school=""; this.major=""; this.degree=""; this.description=""; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -