⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 employeeinfoadmin.java

📁 基于J2EE的网络物流系统 用户操作: 1. 录入出库商品信息 2. 查询出库单信息 3. 录入入库商品信息 4. 查询入库单信息 5. 查询商品位置信息 6. 查询商品信息 7. 查
💻 JAVA
字号:
package com.logistic.taglib;

import java.sql.ResultSet;
import java.sql.Statement;
import java.util.Vector;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.TagSupport;
import com.logistic.data.DataConnect;
import com.logistic.business.EmployeeManager;
import com.logistic.model.EmployeeInfo;
import java.sql.SQLException;

public class EmployeeinfoAdmin extends TagSupport {
	
	private static final long serialVersionUID = 7766184319541532546L;
	
	DataConnect dc=new DataConnect();
	Statement stat=null;
	ResultSet rs=null;
	String departmentname;
	String diplomaname;
	String jobsname;

	
	public int doEndTag()throws JspException{
	
	JspWriter out=pageContext.getOut();
	
	HttpServletRequest request=(HttpServletRequest)pageContext.getRequest();
	
	String str=(String) request.getQueryString();
	int page;
	
	if(str==null||str.equals("=")){
		page=1;
	}else{
		String[] aa=str.split("=");//根据“=”来划分参数值
		page=Integer.parseInt(aa[1]);
	}

	try{
		
		String strsql="select * from employeeinfotable order by Id ASC";
		int count=dc.selectdata(strsql);
		int totalpages=0;
    	if(count%5==0){
    		totalpages=count/5;
    		}else{
    		totalpages=count/5+1;
    		}
    	
    	int currentpage=1;
    	if(page==-4){
    		currentpage=totalpages;
    	   }else if(page==-3){
    		      if(currentpage==totalpages){
    		    	currentpage=totalpages; 
    		        }else{
    		         currentpage=currentpage+1;
    		        }
    	   }else if(page==-2){
    		   if(currentpage==1){
    		      currentpage=1;
    		   }else{
    			   currentpage=currentpage-1; 
    		   }
    	   }else{
    		   currentpage=1;
    	   }

	
  	  EmployeeManager em=new EmployeeManager();
	  Vector items=em.EmployeeSearch(strsql, page);
	  
	  //输出职员信息列表表格头
	  out.println("<table width=\"980\" border=\"1\" align=\"center\" cellpadding=\"1\" cellspacing=\"0\" bordercolor=\"#666699\">");
	  out.println("<tr>");
	  out.println("<td width=\"980\" align=\"center\" class=\"style14\">职员信息管理</td>");
	  out.println("</tr>");
	  out.println("</table>");
	  
	  //输出职员信息属性表头
	  out.println("<table width=\"980\" border=\"1\" align=\"center\" cellpadding=\"1\" cellspacing=\"0\" bordercolor=\"#666699\">");
	  out.println("<tr bgcolor=\"#FF9999\" class=\"code\">");
	  out.println("<td width=\"30\" align=\"center\">编号</td>");
	  out.println("<td width=\"40\" align=\"center\">姓名</td>");
	  out.println("<td width=\"25\" align=\"center\">性别</td>");
	  out.println("<td width=\"24\" align=\"center\">年龄</td>");
	  out.println("<td width=\"95\" align=\"center\">身份证号</td>");
	  out.println("<td width=\"65\" align=\"center\">出生日期</td>");
	  out.println("<td width=\"40\" align=\"center\">学历</td>");
	  out.println("<td width=\"62\" align=\"center\">加入日期</td>");
	  out.println("<td width=\"160\" align=\"center\">地址</td>");
	  out.println("<td width=\"77\" align=\"center\">固定电话</td>");
	  out.println("<td width=\"66\" align=\"center\">移动电话</td>");
	  out.println("<td width=\"50\" align=\"center\">部门</td>");
	  out.println("<td width=\"50\" align=\"center\">职务</td>");
	  out.println("<td colspan=\"2\" align=\"center\">操作</td>");
	  out.println("</tr>");
	  
	  int span=5,j=0;//span标识每页显示5条信息,j是一个计数器
	  String path=request.getContextPath();
	  
	  for(int i=0;i<items.size();i++){
		  
		  EmployeeInfo eibean=(EmployeeInfo)items.elementAt(i);
		  //得到部门名称
		  try{
			  
			  String sqldepname="select *from departmentinfotable where DepartmentId="+eibean.getDepartmentId();
			  stat=dc.getStmtread();
			  rs=stat.executeQuery(sqldepname);
			  while(rs.next()){
				  departmentname=rs.getString("DepartmentName");
			  }
			  
		  }catch(SQLException ex){ex.printStackTrace();}finally{dc.close();}
			  
		//得到职务名称
	     try{
	    	
	    	 String sqljobid="select *from jobsinfotable where JobsId="+eibean.getJobsId();
	    	 stat=dc.getStmtread();
	    	 rs=stat.executeQuery(sqljobid);
	    	 while(rs.next()){
				  jobsname=rs.getString("JobsName");
			  }
	    	
	     }catch(SQLException ex){ex.printStackTrace();}finally{dc.close();}
	     
	     //得到学历
	     try{
		     int id=Integer.valueOf(eibean.getEmployeeDiploma());
	    	 String sqldiploma="select *from diplomainfotable where ID="+id;
	    	 stat=dc.getStmtread();
	    	 rs=stat.executeQuery(sqldiploma);
	    	 while(rs.next()){
				  diplomaname=rs.getString("DiplomaName");
			  }
	    	
	     }catch(SQLException ex){ex.printStackTrace();}finally{dc.close();}
	    
	    out.println("<tr align=\"center\">");
	    out.println("<td height=\"20\">"+eibean.getEmployeeId()+"</td>");
	    out.println("<td>"+eibean.getEmployeeName()+"</td>");
	    out.println("<td>"+eibean.getEmployeeSex()+"</td>");
	    out.println("<td>"+eibean.getEmployeeAge()+"</td>");
	    out.println("<td>"+eibean.getEmployeeIdenCard()+"</td>");
	    out.println("<td>"+eibean.getEmployeeBirthDate()+"</td>");
	    out.println("<td>"+diplomaname+"</td>");
	    out.println("<td>"+eibean.getEmployeeJoinDate()+"</td>");
	    out.println("<td>"+eibean.getEmployeeAdd()+"</td>");
	    out.println("<td>"+eibean.getEmployeePhone()+"</td>");
	    out.println("<td>"+eibean.getEmployeeMobile()+"</td>");
	    out.println("<td>"+departmentname+"</td>");
	    out.println("<td>"+jobsname+"</td>");
	    out.println("<td width=\"35\"><a href=\""+path+"/viewpage/datamodify/employeemanagemodify.jsp?eid="+eibean.getEmployeeId()+"\"><img src=\""+path+"/image/edit.gif\" border=\"0\"></a></td>");
	    out.println("<td width=\"35\"><a href=\"employeeinfolist.jsp?employeeid="+eibean.getEmployeeId()+"\" onClick=\"{if(confirm('此操作将删除当前记录!删除后将不能恢复,您确定执行的操作吗?')){return true;}return false;}\"><img src=\""+path+"/image/delete.gif\" border=\"0\"></a></td>");
	    
	    j++;
	    if(j==span)break;	    
	  }
	  
	  out.println("<tr align=\"center\">");
	  out.println("<td height=\"25\" colspan=\"3\" align=\"left\">页次:"+currentpage+"/"+totalpages+"页&nbsp;每页10条信息"+count+"</td>");
	  out.println("<td colspan=\"14\" valign=\"middle\"><a href=\"employeeinfolist.jsp?arg1=-1\"><img src=\""+path+"/image/begin.jpg\" width=\"63\"s height=\"18\"border=\"0\"></a>&nbsp;&nbsp;" +
	  		     "<a href=\"employeeinfolist.jsp?arg2=-2\"><img src=\""+path+"/image/1-prev.gif\" border=\"0\"></a>&nbsp;&nbsp;<a href=\"employeeinfolist.jsp?arg3=-3\"><img src=\""+path+"/image/1-next.gif\" border=\"0\"></a>&nbsp;&nbsp;" +
	  		     "<a href=\"employeeinfolist.jsp?arg4=-4\"><img src=\""+path+"/image/end.jpg\" width=\"63\"s height=\"18\" border=\"0\"></a></td>");
	  
    	
	}catch(Exception ex){
		ex.printStackTrace();
	  }finally{dc.close();}
	  
	  return SKIP_BODY;
  }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -