Java项目:JSP员工出差请假考勤管理系统
作者主页:夜未央5788
简介:Java领域优质创作者、Java项目、学习资料、技术互助
文末获取源码
项目介绍
本项目为后台管理系统;
管理员角色包含以下功能:
登录,首页,考勤记录增删改查,假期申请记录增删改查,出差申请记录增删改查,加班申请记录增删改查,调休申请,考勤查询,查看考勤详情,员工管理增删改查等功能。
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可
4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
5.数据库:MySql 5.7版本;
6.是否Maven项目:否;
技术栈
HTML+JSP+CSS+JavaScript+LayUI+Servlet+Mysql
使用说明
1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;
若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;
3. 将项目中c3p0-config.xml与utils/C3P0Utils.java配置文件中的数据库配置改为自己的配置;
4. 运行项目,输入http://localhost:8080/kaoqin 登录
管理员账号/密码:admin/123456
运行截图
相关代码
TiaoxiushenqingList
package cn.itheima.web;
import java.io.IOException;
import java.sql.SQLException;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import cn.itheima.domain.PageBean;
import cn.itheima.domain.Tiaoxiushenqing;
import cn.itheima.service.TiaoxiushenqingService;
/**
* Servlet implementation class TiaoxiushenqingList
*/
public class TiaoxiushenqingList extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public TiaoxiushenqingList() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
TiaoxiushenqingService service = new TiaoxiushenqingService();
String currentPageStr =request.getParameter("currentPage");
if(currentPageStr==null) currentPageStr="1";
int currentPage = Integer.parseInt(currentPageStr);
int currentCount=4;
Long count = null;
PageBean<Tiaoxiushenqing> pageBean = null;
List<Tiaoxiushenqing> tiaoxiushenqingList = null;
try {
pageBean = service.findPageBean(currentPage,currentCount);
tiaoxiushenqingList = service.findAllTiaoxiushenqing();
count = service.Count();
request.setAttribute("pageBean", pageBean);
request.setAttribute("tiaoxiushenqingList", tiaoxiushenqingList);
request.setAttribute("count", count);
request.getRequestDispatcher("view/views/kaoqin/tiaoxiushenqing.jsp").forward(request, response);
}catch (SQLException e) {
e.printStackTrace();
}
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}
}
TiaoxiushenqingEdit
package cn.itheima.web;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import cn.itheima.domain.Tiaoxiushenqing;
import cn.itheima.service.TiaoxiushenqingService;
/**
* Servlet implementation class TiaoxiushenqingEdit
*/
public class TiaoxiushenqingEdit extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public TiaoxiushenqingEdit() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String id = request.getParameter("id");
String staff_name = request.getParameter("staff_name");
String shenqingshijian = request.getParameter("shenqingshijian");
String begin = request.getParameter("begin");
String end = request.getParameter("end");
String tiaoxiushichang = request.getParameter("tiaoxiushichang");
String tiaoxiuyuanyin = request.getParameter("tiaoxiuyuanyin");
Tiaoxiushenqing t = new Tiaoxiushenqing();
t.setBegin(begin);
t.setEnd(end);
t.setId(Integer.parseInt(id));
t.setShenqingshijian(shenqingshijian);
t.setStaff_name(staff_name);
t.setTiaoxiushichang(tiaoxiushichang);
t.setTiaoxiuyuanyin(tiaoxiuyuanyin);
TiaoxiushenqingService service = new TiaoxiushenqingService();
try {
service.update(t);
Thread.sleep(3000);
response.sendRedirect(request.getContextPath() + "/TiaoxiushenqingList");
}catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}
}
TiaoxiushenqingAdd
package cn.itheima.web;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import cn.itheima.domain.Tiaoxiushenqing;
import cn.itheima.service.TiaoxiushenqingService;
/**
* Servlet implementation class TiaoxiushenqingAdd
*/
public class TiaoxiushenqingAdd extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public TiaoxiushenqingAdd() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String staff_name = request.getParameter("staff_name");
String shenqingshijian = request.getParameter("shenqingshijian");
String begin = request.getParameter("begin");
String end = request.getParameter("end");
String tiaoxiushichang = request.getParameter("tiaoxiushichang");
String tiaoxiuyuanyin = request.getParameter("tiaoxiuyuanyin");
Tiaoxiushenqing t = new Tiaoxiushenqing();
t.setBegin(begin);
t.setEnd(end);
t.setShenqingshijian(shenqingshijian);
t.setStaff_name(staff_name);
t.setTiaoxiushichang(tiaoxiushichang);
t.setTiaoxiuyuanyin(tiaoxiuyuanyin);
TiaoxiushenqingService service = new TiaoxiushenqingService();
try {
service.add(t);
Thread.sleep(3000);
response.sendRedirect(request.getContextPath() + "/TiaoxiushenqingList");
}catch (Exception e) {
// TODO: handle exception
}
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}
}
StaffList
package cn.itheima.web;
import java.io.IOException;
import java.sql.SQLException;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import cn.itheima.domain.PageBean;
import cn.itheima.domain.Staff;
import cn.itheima.service.StaffService;
/**
* Servlet implementation class StaffList
*/
public class StaffList extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public StaffList() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
StaffService service = new StaffService();
String currentPageStr =request.getParameter("currentPage");
if(currentPageStr==null) currentPageStr="1";
int currentPage = Integer.parseInt(currentPageStr);
int currentCount=4;
Long count = null;
PageBean<Staff> pageBean = null;
List<Staff> staffList = null;
try {
pageBean = service.findPageBean(currentPage,currentCount);
staffList = service.findAllStaff();
count = service.Count();
request.setAttribute("pageBean", pageBean);
request.setAttribute("shujuzidianList", staffList);
request.setAttribute("count", count);
request.getRequestDispatcher("view/views/user/user/staff.jsp").forward(request, response);
}catch (SQLException e) {
e.printStackTrace();
}
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}
}
ShujuzidianAdd
package cn.itheima.web;
import java.io.IOException;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import cn.itheima.domain.Shujuzidian;
import cn.itheima.service.ShujuzidianService;
/**
* Servlet implementation class ShujuzidianAdd
*/
public class ShujuzidianAdd extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public ShujuzidianAdd() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
request.setCharacterEncoding("UTF-8");
String name = request.getParameter("name");
String value = request.getParameter("value");
ShujuzidianService service = new ShujuzidianService();
try {
service.add(name,value);
} catch (SQLException e) {
e.printStackTrace();
}
try {
Thread.sleep(3000);
response.sendRedirect(request.getContextPath() + "/ShujuzidianList");
} catch (Exception e) {
}
//response.sendRedirect(request.getContextPath() + "/ShujuzidianList");
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}
}
KaoqinjiluAdd
package cn.itheima.web;
import java.io.IOException;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import cn.itheima.domain.Kaoqinjilu;
import cn.itheima.service.KaoqinjiluService;
import cn.itheima.service.StaffService;
/**
* Servlet implementation class KaoqinjiluAdd
*/
public class KaoqinjiluAdd extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public KaoqinjiluAdd() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
String kaoqinshijian = request.getParameter("kaoqinshijian");
String leibie = request.getParameter("leibie");
String staff_name = request.getParameter("staff_name");
String kaoqinshiduan = request.getParameter("kaoqinshiduan");
String shuoming = request.getParameter("shuoming");
String jiluren = request.getParameter("jiluren");
Kaoqinjilu k = new Kaoqinjilu();
k.setKaoqinshijian(kaoqinshijian);
k.setLeibie(leibie);
k.setStaff_name(staff_name);
k.setKaoqinshiduan(kaoqinshiduan);
k.setShuoming(shuoming);
k.setJiluren(jiluren);
KaoqinjiluService service = new KaoqinjiluService();
try {
service.add(k);
Thread.sleep(3000);
response.sendRedirect(request.getContextPath() + "/KaoqinjiluList");
}catch (Exception e) {
// TODO: handle exception
}
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}
}
如果也想学习本系统,下面领取。关注并回复:082jsp