├── .classpath ├── .project ├── .settings ├── .jsdtscope ├── org.eclipse.jdt.core.prefs ├── org.eclipse.wst.common.component ├── org.eclipse.wst.common.project.facet.core.xml ├── org.eclipse.wst.jsdt.ui.superType.container └── org.eclipse.wst.jsdt.ui.superType.name ├── README.md ├── WebContent ├── 24.jpg ├── 25.jpg ├── 26.jpg ├── 30.jpg ├── 31.jpg ├── META-INF │ └── MANIFEST.MF ├── WEB-INF │ ├── lib │ │ ├── jxl.jar │ │ └── sqljdbc4.jar │ └── web.xml ├── adminmenu.jsp ├── adminsearchinfo.jsp ├── apply.jsp ├── applysavesuccess.jsp ├── auditinfo.jsp ├── error.jsp ├── login.jsp ├── savesuccess.jsp ├── searchinfo.jsp ├── welcome_admin.jsp └── welcome_worker.jsp ├── build └── classes │ └── com │ ├── bean │ ├── Extraworkinfo.class │ ├── Statisticinfo.class │ └── Worker.class │ └── servlet │ ├── ApplyingServlet.class │ ├── LoginServlet.class │ ├── SearchServlet.class │ ├── adminSearchServlet.class │ ├── auditServlet.class │ └── changeAuditServlet.class ├── image └── back.jpg ├── readmeDisplay ├── 1.png ├── 2.png ├── 3.png ├── 4.png ├── 5.png ├── 6.png ├── 7.png └── 8.png └── src └── com ├── bean ├── Extraworkinfo.java ├── Statisticinfo.java └── Worker.java └── servlet ├── ApplyingServlet.java ├── LoginServlet.java ├── SearchServlet.java ├── adminSearchServlet.java ├── auditServlet.java └── changeAuditServlet.java /.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | WorkSystem 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.wst.jsdt.core.javascriptValidator 10 | 11 | 12 | 13 | 14 | org.eclipse.jdt.core.javabuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.wst.common.project.facet.core.builder 20 | 21 | 22 | 23 | 24 | org.eclipse.wst.validation.validationbuilder 25 | 26 | 27 | 28 | 29 | 30 | org.eclipse.jem.workbench.JavaEMFNature 31 | org.eclipse.wst.common.modulecore.ModuleCoreNature 32 | org.eclipse.wst.common.project.facet.core.nature 33 | org.eclipse.jdt.core.javanature 34 | org.eclipse.wst.jsdt.core.jsNature 35 | 36 | 37 | -------------------------------------------------------------------------------- /.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 4 | org.eclipse.jdt.core.compiler.compliance=1.7 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.source=1.7 8 | -------------------------------------------------------------------------------- /.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Database-Project 2 | > Author: Yuchao Gu 3 | 4 | > E-mail: 2015014178@buct.edu.cn 5 | 6 | > Date: 2017-12-27 7 | 8 | >Description: 北京化工大学15级数据库课程设计,我抽到的题目为员工加班管理,采用jsp前端页面展示,sevelet后台服务,实现的是B/S架构 9 | 10 | ## 功能概览 11 | 12 | ### 整体一览 13 | 14 | ![](./readmeDisplay/1.png) 15 | 16 | ### 员工部分 17 | 18 | 分为申请页,查询申请结果页 19 | 20 | ![](./readmeDisplay/2.png) 21 | 22 | ![](./readmeDisplay/3.png) 23 | 24 | ### 负责人部分 25 | 26 | 分为主页,审核页,查看历史页 27 | 28 | ![](./readmeDisplay/4.png) 29 | 30 | ![](./readmeDisplay/5.png) 31 | 32 | ![](./readmeDisplay/6.png) 33 | 34 | ### 生成excel月报表 35 | 36 | ![](./readmeDisplay/7.png) 37 | 38 | ![](./readmeDisplay/8.png) 39 | 40 | 41 | ## 环境 42 | 43 | * 系统支持:`windows` 44 | 45 | * 编程环境:`eclipse` 46 | -------------------------------------------------------------------------------- /WebContent/24.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guyuchao/Database-Project/79b5371044760476d948b13ead687eb4d21183ae/WebContent/24.jpg -------------------------------------------------------------------------------- /WebContent/25.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guyuchao/Database-Project/79b5371044760476d948b13ead687eb4d21183ae/WebContent/25.jpg -------------------------------------------------------------------------------- /WebContent/26.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guyuchao/Database-Project/79b5371044760476d948b13ead687eb4d21183ae/WebContent/26.jpg -------------------------------------------------------------------------------- /WebContent/30.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guyuchao/Database-Project/79b5371044760476d948b13ead687eb4d21183ae/WebContent/30.jpg -------------------------------------------------------------------------------- /WebContent/31.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guyuchao/Database-Project/79b5371044760476d948b13ead687eb4d21183ae/WebContent/31.jpg -------------------------------------------------------------------------------- /WebContent/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Class-Path: 3 | 4 | -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/jxl.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guyuchao/Database-Project/79b5371044760476d948b13ead687eb4d21183ae/WebContent/WEB-INF/lib/jxl.jar -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/sqljdbc4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guyuchao/Database-Project/79b5371044760476d948b13ead687eb4d21183ae/WebContent/WEB-INF/lib/sqljdbc4.jar -------------------------------------------------------------------------------- /WebContent/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | WorkSystem 4 | 5 | login.jsp 6 | 7 | 8 | LoginServlet 9 | com.servlet.LoginServlet 10 | 11 | 12 | LoginServlet 13 | /loginServlet 14 | 15 | 16 | ApplyingServlet 17 | com.servlet.ApplyingServlet 18 | 19 | 20 | ApplyingServlet 21 | /ApplyingServlet 22 | 23 | 24 | SearchServlet 25 | com.servlet.SearchServlet 26 | 27 | 28 | SearchServlet 29 | /SearchServlet 30 | 31 | 32 | adminSearchServlet 33 | com.servlet.adminSearchServlet 34 | 35 | 36 | adminSearchServlet 37 | /adminSearchServlet 38 | 39 | 40 | auditServlet 41 | com.servlet.auditServlet 42 | 43 | 44 | auditServlet 45 | /auditServlet 46 | 47 | 48 | changeAuditServlet 49 | com.servlet.changeAuditServlet 50 | 51 | 52 | changeAuditServlet 53 | /changeAuditServlet 54 | 55 | 56 | generateServlet 57 | com.servlet.generateServlet 58 | 59 | 60 | generateServlet 61 | /generateServlet 62 | 63 | -------------------------------------------------------------------------------- /WebContent/adminmenu.jsp: -------------------------------------------------------------------------------- 1 | 2 | <%@ page language="java" contentType="text/html; charset=utf-8" 3 | pageEncoding="utf-8"%> 4 | <% 5 | request.setAttribute("context", request.getContextPath()); 6 | %> 7 | 8 | 9 | 10 | 11 | 12 | 欢迎来到加班申请系统 13 | 106 | 107 | 108 | 109 |
110 |
111 |
112 |
审核申请信息
113 |
查看所有部门加班结果
114 |
生成加班信息统计表
115 | 116 | -------------------------------------------------------------------------------- /WebContent/adminsearchinfo.jsp: -------------------------------------------------------------------------------- 1 | 2 | <%@ page language="java" contentType="text/html; charset=utf-8" 3 | pageEncoding="utf-8"%> 4 | <%@ page import="com.bean.*" %> 5 | <%@ page import="java.util.ArrayList" %> 6 | 7 | 8 | 9 | 10 | 11 | 加班历史信息 12 | 122 | 123 | 124 |
审核申请信息
125 |
查看本部门加班结果
126 |
生成加班信息统计表
127 |
128 |

129 | 130 | <% ArrayList rs=(ArrayList)request.getAttribute("result"); %> 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | <% 141 | for(Extraworkinfo info:rs){ 142 | %> 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | <% 153 | } 154 | %> 155 |
员工名申请加班日期加班类型加班开始时间加班结束时间审核状态审核人员工号
<%=info.getName()%><%=info.getDate()%><%=info.getType()%><%=info.getTimeb()%><%=info.getTimee()%><%=info.getConfirmstatus()%><%=info.getPname()%>
156 |

157 |
158 | 159 | -------------------------------------------------------------------------------- /WebContent/apply.jsp: -------------------------------------------------------------------------------- 1 | 2 | <%@ page language="java" contentType="text/html; charset=utf-8" 3 | pageEncoding="utf-8"%> 4 | 5 | 6 | <% 7 | request.setAttribute("context", request.getContextPath()); 8 | %> 9 | 10 | 11 | 加班信息填写 12 | 139 | 140 | 141 | 142 |
143 | 申请加班 144 | 申请结果 145 | Welcome! 146 |
147 |
148 |

149 |
150 | 加班类型: 151 | 152 | 157 | 158 |
159 |

160 |
161 | 加班日期: 162 |


163 |
164 | 开始时间: 165 |


166 |
167 | 结束时间: 168 |
169 |

170 | 171 |
172 | 173 | 174 |
175 |
176 | 177 | -------------------------------------------------------------------------------- /WebContent/applysavesuccess.jsp: -------------------------------------------------------------------------------- 1 | 2 | <%@ page language="java" contentType="text/html; charset=utf-8" 3 | pageEncoding="utf-8"%> 4 | 5 | 6 | 7 | 8 | 9 | 欢迎进入员工加班管理系统 10 | 24 | 25 | 26 |

保存成功

27 |

3秒钟后系统会自动返回...

28 | <%response.setHeader("refresh","3;url=apply.jsp"); %> 29 | 30 | -------------------------------------------------------------------------------- /WebContent/auditinfo.jsp: -------------------------------------------------------------------------------- 1 | 2 | <%@ page language="java" contentType="text/html; charset=utf-8" 3 | pageEncoding="utf-8"%> 4 | <%@ page import="com.bean.*" %> 5 | <%@ page import="java.util.ArrayList" %> 6 | 7 | 8 | 9 | 10 | 11 | 加班历史信息 12 | 145 | 146 | 147 |
审核申请信息
148 |
查看本部门加班结果
149 |
生成加班信息统计表
150 |
151 | <% ArrayList rs=(ArrayList)request.getAttribute("result"); %> 152 |

153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | <% 166 | for(Integer i=0;i 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 183 | 184 | <% 185 | } 186 | %> 187 |
员工名申请加班日期加班类型加班开始时间加班结束时间审核状态审核人更改审核信息
<%=info.getName()%><%=info.getDate()%><%=info.getType()%><%=info.getTimeb()%><%=info.getTimee()%><%=info.getConfirmstatus()%><%=info.getPname()%> 180 | 181 | 182 |
188 |

189 | 190 | 191 | 192 | 193 | 194 | -------------------------------------------------------------------------------- /WebContent/error.jsp: -------------------------------------------------------------------------------- 1 | 2 | <%@ page language="java" contentType="text/html; charset=utf-8" 3 | pageEncoding="utf-8"%> 4 | 5 | 6 | 7 | 8 | 登陆失败 9 | 23 | 24 | 25 | 26 |

登录失败,<%=request.getAttribute("username") %>的用户名或者密码错误!

27 |

5秒钟后系统会自动跳转到登录页面...

28 | <%response.setHeader("refresh","5;url=login.jsp");%> 29 | 30 | -------------------------------------------------------------------------------- /WebContent/login.jsp: -------------------------------------------------------------------------------- 1 | 2 | <%@ page language="java" contentType="text/html; charset=utf-8" 3 | pageEncoding="utf-8"%> 4 | 5 | 6 | 7 | 8 | 加班管理首页 9 | 143 | 144 | 145 |
Author GYCWelcome!员工加班管理系统
146 |
147 |
148 |

149 |

Login

150 |

151 |
152 | 姓名: 153 | 154 |
155 |

156 |
157 | 密码: 158 | 159 |
160 |

161 | 162 |

163 | 164 |
165 |
166 | 167 | -------------------------------------------------------------------------------- /WebContent/savesuccess.jsp: -------------------------------------------------------------------------------- 1 | 2 | <%@ page language="java" contentType="text/html; charset=utf-8" 3 | pageEncoding="utf-8"%> 4 | 5 | 6 | <%@ page import="com.bean.*" %> 7 | <%@ page import="java.util.ArrayList" %> 8 | <%@ page import="java.sql.*" %> 9 | <%@ page import="java.io.*" %> 10 | <%@ page import="jxl.write.*" %> 11 | <%@ page import="jxl.*" %> 12 | 13 | <% 14 | request.setCharacterEncoding("utf-8"); 15 | try{ 16 | ArrayList info_list=new ArrayList(); 17 | 18 | String driverName="com.microsoft.sqlserver.jdbc.SQLServerDriver"; 19 | String dbURL="jdbc:sqlserver://localhost:1433;DatabaseName=WorkExtraDB"; 20 | String userName="sa"; 21 | String userPwd="guyuchao"; 22 | Connection dbConn=null; 23 | dbConn= DriverManager.getConnection(dbURL,userName,userPwd); 24 | PreparedStatement ps; 25 | String sql="select year(workdate) 年,month(workdate) 月,ext.wno 员工号,ext.wtype 加班类型,wk.wdepartno 部门号,sum(timet) 加班总时间 "+ 26 | "from extraworkinfo ext,worker wk "+ 27 | "where confirmstatus=1 and ext.wno=wk.wno "+ 28 | "group by year(workdate),month(workdate),ext.wno,ext.wtype,wk.wdepartno"; 29 | ps=dbConn.prepareStatement(sql); 30 | ResultSet rs=ps.executeQuery(); 31 | while(rs.next()){ 32 | Statisticinfo info=new Statisticinfo(); 33 | info.setYear(rs.getString("年")); 34 | info.setMonth(rs.getString("月")); 35 | info.setWno(rs.getString("员工号")); 36 | info.setWtype(rs.getString("加班类型")); 37 | info.setWdepartno(rs.getString("部门号")); 38 | info.setTotal_wtime(rs.getString("加班总时间")); 39 | info_list.add(info); 40 | } 41 | response.reset();//清空输出流 42 | OutputStream os = response.getOutputStream();//取得输出流 43 | String fileName = "加班信息统计表.xls"; 44 | fileName = java.net.URLEncoder.encode(fileName, "UTF-8"); 45 | response.setHeader("Content-Disposition", "attachment; filename*=UTF-8''" +fileName); 46 | response.setContentType("application/msexcel");//定义输出类型 47 | WritableWorkbook workbook; 48 | workbook = Workbook.createWorkbook(os); 49 | WritableSheet sheet = workbook.createSheet("First Sheet",0); 50 | Label year = new Label(0,0,"年"); 51 | sheet.addCell(year); 52 | Label month = new Label(1,0,"月"); 53 | sheet.addCell(month); 54 | Label wno = new Label(2,0,"员工号"); 55 | sheet.addCell(wno); 56 | Label wtype = new Label(3,0,"加班类型"); 57 | sheet.addCell(wtype); 58 | Label wdepartno = new Label(4,0,"部门号"); 59 | sheet.addCell(wdepartno); 60 | Label total = new Label(5,0,"加班总时间(小时)"); 61 | sheet.addCell(total); 62 | for(int i=0;i 93 | 94 | 95 | -------------------------------------------------------------------------------- /WebContent/searchinfo.jsp: -------------------------------------------------------------------------------- 1 | 2 | <%@ page language="java" contentType="text/html; charset=utf-8" 3 | pageEncoding="utf-8"%> 4 | <%@ page import="com.bean.*" %> 5 | <%@ page import="java.util.ArrayList" %> 6 | 7 | 8 | 9 | <% 10 | request.setAttribute("context", request.getContextPath()); 11 | %> 12 | 13 | 14 | <% 15 | request.setAttribute("context", request.getContextPath()); 16 | %> 17 | 加班历史信息 18 | 106 | 107 | 108 |
109 | 申请加班 110 | 申请结果 111 |
112 | 113 | <% ArrayList rs=(ArrayList)request.getAttribute("result"); %> 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | <% 124 | for(Extraworkinfo info:rs){ 125 | %> 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | <% 136 | } 137 | %> 138 |
员工名申请加班日期加班类型加班开始时间加班结束时间审核状态审核人
<%=info.getName()%><%=info.getDate()%><%=info.getType()%><%=info.getTimeb()%><%=info.getTimee()%><%=info.getConfirmstatus()%><%=info.getPname()%>
139 | 140 | -------------------------------------------------------------------------------- /WebContent/welcome_admin.jsp: -------------------------------------------------------------------------------- 1 | 2 | <%@ page language="java" contentType="text/html; charset=utf-8" 3 | pageEncoding="utf-8"%> 4 | 5 | 6 | 7 | 8 | 欢迎进入员工加班管理系统 9 | 10 | 24 | 25 | 26 | 27 |

登录成功,欢迎部门负责人<%=request.getAttribute("wname") %>来到员工加班管理系统!

28 |

3秒钟后系统会自动跳转到审核员工加班信息页面...

29 | <%response.setHeader("refresh","3;url=adminmenu.jsp"); %> 30 | 31 | -------------------------------------------------------------------------------- /WebContent/welcome_worker.jsp: -------------------------------------------------------------------------------- 1 | 2 | <%@ page language="java" contentType="text/html; charset=utf-8" 3 | pageEncoding="utf-8"%> 4 | 5 | 6 | 7 | 8 | 欢迎进入员工加班管理系统 9 | 23 | 24 | 25 |

登录成功,欢迎<%=request.getAttribute("wname") %>来到员工加班管理系统!

26 |

3秒钟后系统会自动跳转到申请加班信息页面...

27 | <%response.setHeader("refresh","3;url=apply.jsp"); %> 28 | 29 | -------------------------------------------------------------------------------- /build/classes/com/bean/Extraworkinfo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guyuchao/Database-Project/79b5371044760476d948b13ead687eb4d21183ae/build/classes/com/bean/Extraworkinfo.class -------------------------------------------------------------------------------- /build/classes/com/bean/Statisticinfo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guyuchao/Database-Project/79b5371044760476d948b13ead687eb4d21183ae/build/classes/com/bean/Statisticinfo.class -------------------------------------------------------------------------------- /build/classes/com/bean/Worker.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guyuchao/Database-Project/79b5371044760476d948b13ead687eb4d21183ae/build/classes/com/bean/Worker.class -------------------------------------------------------------------------------- /build/classes/com/servlet/ApplyingServlet.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guyuchao/Database-Project/79b5371044760476d948b13ead687eb4d21183ae/build/classes/com/servlet/ApplyingServlet.class -------------------------------------------------------------------------------- /build/classes/com/servlet/LoginServlet.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guyuchao/Database-Project/79b5371044760476d948b13ead687eb4d21183ae/build/classes/com/servlet/LoginServlet.class -------------------------------------------------------------------------------- /build/classes/com/servlet/SearchServlet.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guyuchao/Database-Project/79b5371044760476d948b13ead687eb4d21183ae/build/classes/com/servlet/SearchServlet.class -------------------------------------------------------------------------------- /build/classes/com/servlet/adminSearchServlet.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guyuchao/Database-Project/79b5371044760476d948b13ead687eb4d21183ae/build/classes/com/servlet/adminSearchServlet.class -------------------------------------------------------------------------------- /build/classes/com/servlet/auditServlet.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guyuchao/Database-Project/79b5371044760476d948b13ead687eb4d21183ae/build/classes/com/servlet/auditServlet.class -------------------------------------------------------------------------------- /build/classes/com/servlet/changeAuditServlet.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guyuchao/Database-Project/79b5371044760476d948b13ead687eb4d21183ae/build/classes/com/servlet/changeAuditServlet.class -------------------------------------------------------------------------------- /image/back.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guyuchao/Database-Project/79b5371044760476d948b13ead687eb4d21183ae/image/back.jpg -------------------------------------------------------------------------------- /readmeDisplay/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guyuchao/Database-Project/79b5371044760476d948b13ead687eb4d21183ae/readmeDisplay/1.png -------------------------------------------------------------------------------- /readmeDisplay/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guyuchao/Database-Project/79b5371044760476d948b13ead687eb4d21183ae/readmeDisplay/2.png -------------------------------------------------------------------------------- /readmeDisplay/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guyuchao/Database-Project/79b5371044760476d948b13ead687eb4d21183ae/readmeDisplay/3.png -------------------------------------------------------------------------------- /readmeDisplay/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guyuchao/Database-Project/79b5371044760476d948b13ead687eb4d21183ae/readmeDisplay/4.png -------------------------------------------------------------------------------- /readmeDisplay/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guyuchao/Database-Project/79b5371044760476d948b13ead687eb4d21183ae/readmeDisplay/5.png -------------------------------------------------------------------------------- /readmeDisplay/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guyuchao/Database-Project/79b5371044760476d948b13ead687eb4d21183ae/readmeDisplay/6.png -------------------------------------------------------------------------------- /readmeDisplay/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guyuchao/Database-Project/79b5371044760476d948b13ead687eb4d21183ae/readmeDisplay/7.png -------------------------------------------------------------------------------- /readmeDisplay/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guyuchao/Database-Project/79b5371044760476d948b13ead687eb4d21183ae/readmeDisplay/8.png -------------------------------------------------------------------------------- /src/com/bean/Extraworkinfo.java: -------------------------------------------------------------------------------- 1 | package com.bean; 2 | 3 | import java.util.Date; 4 | 5 | public class Extraworkinfo { 6 | public String toString(){ 7 | return this.date+" "+this.name+" "+this.type+" "+this.timeb+" "+this.timee+" "+this.confirmstatus+" "+this.pname; 8 | } 9 | private String date; 10 | private String name; 11 | private int type; 12 | private String timeb; 13 | private String timee; 14 | private String confirmstatus; 15 | private String pname; 16 | public String getDate() { 17 | return date; 18 | } 19 | public void setDate(String date) { 20 | this.date = date; 21 | } 22 | public String getName() { 23 | return name; 24 | } 25 | public int getType() { 26 | return type; 27 | } 28 | public void setType(int type) { 29 | this.type = type; 30 | } 31 | public void setName(String name) { 32 | this.name = name; 33 | } 34 | public String getTimeb() { 35 | return timeb; 36 | } 37 | public void setTimeb(String timeb) { 38 | this.timeb = timeb; 39 | } 40 | public String getTimee() { 41 | return timee; 42 | } 43 | public void setTimee(String timee) { 44 | this.timee = timee; 45 | } 46 | public String getConfirmstatus() { 47 | return confirmstatus; 48 | } 49 | public void setConfirmstatus(String confirmstatus) { 50 | this.confirmstatus = confirmstatus; 51 | } 52 | public String getPname() { 53 | return pname; 54 | } 55 | public void setPname(String pname) { 56 | this.pname = pname; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/com/bean/Statisticinfo.java: -------------------------------------------------------------------------------- 1 | package com.bean; 2 | 3 | public class Statisticinfo { 4 | 5 | private String year; 6 | private String month; 7 | private String wno; 8 | private String wtype; 9 | private String wdepartno; 10 | private String total_wtime; 11 | public String getYear() { 12 | return year; 13 | } 14 | public void setYear(String year) { 15 | this.year = year; 16 | } 17 | public String getMonth() { 18 | return month; 19 | } 20 | public void setMonth(String month) { 21 | this.month = month; 22 | } 23 | public String getWno() { 24 | return wno; 25 | } 26 | public void setWno(String wno) { 27 | this.wno = wno; 28 | } 29 | public String getWtype() { 30 | return wtype; 31 | } 32 | public void setWtype(String wtype) { 33 | this.wtype = wtype; 34 | } 35 | public String getWdepartno() { 36 | return wdepartno; 37 | } 38 | public void setWdepartno(String wdepartno) { 39 | this.wdepartno = wdepartno; 40 | } 41 | public String getTotal_wtime() { 42 | return total_wtime; 43 | } 44 | public void setTotal_wtime(String total_wtime) { 45 | this.total_wtime = total_wtime; 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/com/bean/Worker.java: -------------------------------------------------------------------------------- 1 | package com.bean; 2 | 3 | public class Worker { 4 | private int wno; 5 | private String wname; 6 | private int pwno; 7 | private int wderpartno; 8 | private String password; 9 | public int getWno() { 10 | return wno; 11 | } 12 | public void setWno(int wno) { 13 | this.wno = wno; 14 | } 15 | public String getWname() { 16 | return wname; 17 | } 18 | public void setWname(String wname) { 19 | this.wname = wname; 20 | } 21 | public int getPwno() { 22 | return pwno; 23 | } 24 | public void setPwno(int pwno) { 25 | this.pwno = pwno; 26 | } 27 | public int getWderpartno() { 28 | return wderpartno; 29 | } 30 | public void setWderpartno(int wderpartno) { 31 | this.wderpartno = wderpartno; 32 | } 33 | public String getPassword() { 34 | return password; 35 | } 36 | public void setPassword(String password) { 37 | this.password = password; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/servlet/ApplyingServlet.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guyuchao/Database-Project/79b5371044760476d948b13ead687eb4d21183ae/src/com/servlet/ApplyingServlet.java -------------------------------------------------------------------------------- /src/com/servlet/LoginServlet.java: -------------------------------------------------------------------------------- 1 | package com.servlet; 2 | import java.io.IOException; 3 | import java.io.UnsupportedEncodingException; 4 | import java.sql.Connection; 5 | import java.sql.DriverManager; 6 | import java.sql.PreparedStatement; 7 | import java.sql.ResultSet; 8 | import java.sql.SQLException; 9 | import java.sql.Statement; 10 | 11 | import javax.servlet.ServletException; 12 | import javax.servlet.http.HttpServlet; 13 | import javax.servlet.http.HttpServletRequest; 14 | import javax.servlet.http.HttpServletResponse; 15 | import javax.servlet.http.HttpSession; 16 | import javax.websocket.Session; 17 | 18 | 19 | public class LoginServlet extends HttpServlet{ 20 | 21 | protected void doPost(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException { 22 | doGet(request, response); 23 | } 24 | protected void doGet(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException{ 25 | request.setCharacterEncoding("utf-8"); 26 | String wname=request.getParameter("wname"); 27 | String password=request.getParameter("password"); 28 | request.setAttribute("wname", wname); 29 | 30 | String driverName="com.microsoft.sqlserver.jdbc.SQLServerDriver"; 31 | String dbURL="jdbc:sqlserver://localhost:1433;DatabaseName=WorkExtraDB"; 32 | String userName="sa"; 33 | String userPwd="guyuchao"; 34 | Connection dbConn=null; 35 | try { 36 | dbConn= DriverManager.getConnection(dbURL,userName,userPwd); 37 | String sql="select * from worker where wname= ? and password= ?"; 38 | PreparedStatement ps=dbConn.prepareStatement(sql); 39 | ps.setString(1, wname); 40 | ps.setString(2,password); 41 | ResultSet rs=ps.executeQuery(); 42 | if(rs.next()){ 43 | HttpSession session=request.getSession(); 44 | session.setAttribute("wno", rs.getInt("wno")); 45 | if(rs.getString("pwno") != null){ 46 | request.getRequestDispatcher("welcome_worker.jsp").forward(request, response); 47 | } 48 | else{ 49 | 50 | request.getRequestDispatcher("welcome_admin.jsp").forward(request, response); 51 | } 52 | } 53 | else{ 54 | request.getRequestDispatcher("error.jsp").forward(request, response); 55 | } 56 | ps.close(); 57 | dbConn.close(); 58 | } catch (SQLException e) { 59 | // TODO Auto-generated catch block 60 | e.printStackTrace(); 61 | } 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /src/com/servlet/SearchServlet.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guyuchao/Database-Project/79b5371044760476d948b13ead687eb4d21183ae/src/com/servlet/SearchServlet.java -------------------------------------------------------------------------------- /src/com/servlet/adminSearchServlet.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guyuchao/Database-Project/79b5371044760476d948b13ead687eb4d21183ae/src/com/servlet/adminSearchServlet.java -------------------------------------------------------------------------------- /src/com/servlet/auditServlet.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guyuchao/Database-Project/79b5371044760476d948b13ead687eb4d21183ae/src/com/servlet/auditServlet.java -------------------------------------------------------------------------------- /src/com/servlet/changeAuditServlet.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guyuchao/Database-Project/79b5371044760476d948b13ead687eb4d21183ae/src/com/servlet/changeAuditServlet.java --------------------------------------------------------------------------------