当前位置: 首页 > news >正文

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

相关文章:

  • OP-TEE driver(三):OP-TEE驱动中的数据结构体
  • 人工智能轨道交通行业周刊-第15期(2022.9.19-9.25)
  • python process模块的使用简介
  • 回调函数等作业
  • 不要再盯着大厂了,这16家中小厂我建议你也试试
  • Linux-常见命令(一)
  • 什么是C语言?
  • 封装——C++
  • 【Java高级】框架底层基础:Java的反射机制剖析
  • verilog移位寄存器实现序列检测
  • 前端性能优化方法与实战02 性能瓶颈点:从 URL 输入到页面加载整过程分析
  • 34.0、C语言——C语言预处理(2) - 预编译(预处理)详解(2)
  • ES优化实战 - 小操作节省百分之三十以上的磁盘空间
  • [Go WebSocket] 多房间的聊天室(五)用多个小锁代替大锁,提高效率
  • 我在windows环境下的YOLOV3环境搭建过程
  • 《深入 React 技术栈》
  • crontab执行失败的多种原因
  • JavaScript 是如何工作的:WebRTC 和对等网络的机制!
  • JavaScript学习总结——原型
  • miniui datagrid 的客户端分页解决方案 - CS结合
  • MySQL主从复制读写分离及奇怪的问题
  • node和express搭建代理服务器(源码)
  • RxJS: 简单入门
  • SpiderData 2019年2月25日 DApp数据排行榜
  • Spring Cloud(3) - 服务治理: Spring Cloud Eureka
  • 今年的LC3大会没了?
  • 猫头鹰的深夜翻译:Java 2D Graphics, 简单的仿射变换
  • 面试题:给你个id,去拿到name,多叉树遍历
  • 如何设计一个比特币钱包服务
  • 手机端车牌号码键盘的vue组件
  • 算法-图和图算法
  • 突破自己的技术思维
  • 我的面试准备过程--容器(更新中)
  • MPAndroidChart 教程:Y轴 YAxis
  • #define 用法
  • (04)odoo视图操作
  • (1)安装hadoop之虚拟机准备(配置IP与主机名)
  • (4)事件处理——(6)给.ready()回调函数传递一个参数(Passing an argument to the .ready() callback)...
  • (env: Windows,mp,1.06.2308310; lib: 3.2.4) uniapp微信小程序
  • (译) 函数式 JS #1:简介
  • (原创)攻击方式学习之(4) - 拒绝服务(DOS/DDOS/DRDOS)
  • (转)C#调用WebService 基础
  • (轉貼) VS2005 快捷键 (初級) (.NET) (Visual Studio)
  • .NET CLR Hosting 简介
  • .Net core 6.0 升8.0
  • .NET 编写一个可以异步等待循环中任何一个部分的 Awaiter
  • .netcore 如何获取系统中所有session_如何把百度推广中获取的线索(基木鱼,电话,百度商桥等)同步到企业微信或者企业CRM等企业营销系统中...
  • [ 云计算 | Azure 实践 ] 在 Azure 门户中创建 VM 虚拟机并进行验证
  • [AIGC] Redis基础命令集详细介绍
  • [Android]Android开发入门之HelloWorld
  • [BUG]Datax写入数据到psql报不能序列化特殊字符
  • [BZOJ4337][BJOI2015]树的同构(树的最小表示法)
  • [C#]C# OpenVINO部署yolov8图像分类模型
  • [echarts] y轴不显示0
  • [ERROR]-Error: failure: repodata/filelists.xml.gz from addons: [Errno 256] No more mirrors to try.