基于javaweb+jsp的人事员工管理系统(JavaWeb JSP MySQL Servlet SSM SpringBoot Bootstrap)
JavaWeb JavaBean JSP MVC MySQL Tomcat JavaScript Bootstrap
基础JSP+Servlet或JSP+SSM(Spring、SpringMVC、MyBatis)框架或JSP+SSM+Maven(pom.xml)框架或SpringBoot…均可修改
开发工具:eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
/**
* 增加部门
*
* @param response
* @param request
* @throws IOException
*/
@RequestMapping("deptAdd")
public void add(HttpServletResponse response, HttpServletRequest request) throws IOException {
Dept vo = new Dept();
//取出页面传进来的参数
vo.setDeptName(Util.decode(request, "deptName"));
vo.setDeptLoc(Util.decode(request, "deptLoc"));
vo.setDeptCount(Util.decode(request, "deptCount"));
vo.setDeptLeader(Util.decode(request, "deptLeader"));
vo.setDeptText(Util.decode(request, "deptText"));
//调用Service层的增加(insert)方法
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Controller
@RequestMapping
public class SalaryController {
@Autowired
private SalaryService salaryService;
/**
* 增加工资
*
* @param response
* @param request
* @throws IOException
*/
@RequestMapping("salaryAdd")
public void add(HttpServletResponse response, HttpServletRequest request) throws IOException {
Salary vo = new Salary();
//取出页面传进来的参数
SELECT COUNT(*) FROM `t_employee`
<where>
<if test="searchColumn != null and searchColumn != '' and keyword != null and keyword != ''">
${searchColumn} LIKE CONCAT('%',#{keyword},'%') AND
</if>
1=1
</where>
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.demo.dao.LeaveMapper">
<resultMap id="BaseResultMap" type="com.demo.vo.Leave" >
<result column="id" property="id" />
<result column="leave_no" property="leaveNo" />
<result column="leave_name" property="leaveName" />
<result column="leave_start" property="leaveStart" />
<result column="leave_end" property="leaveEnd" />
<result column="leave_days" property="leaveDays" />
<result column="leave_reason" property="leaveReason" />
<result column="leave_text" property="leaveText" />
</resultMap>
<sql id="Base_Column_List">
`id`,`leave_no`,`leave_name`,`leave_start`,`leave_end`,`leave_days`,`leave_reason`,`leave_text`
<if test ='deptLeader != null'>#{deptLeader},</if>
<if test ='deptText != null'>#{deptText}</if>
</trim>
</insert>
<!--批量删除-->
<delete id="doRemoveBatch" parameterType="java.util.Collection">
DELETE FROM `t_dept` WHERE `id` IN
<foreach collection="list" item="id" separator="," open="(" close=")">
#{id}
</foreach>
</delete>
<!--修改-->
#{id}
</foreach>
</delete>
<!--修改-->
<update id="doUpdate" parameterType="com.demo.vo.Leave">
UPDATE `t_leave`
<set>
<if test ='id != null'>`id` = #{id},</if>
<if test ='leaveNo != null'>`leave_no` = #{leaveNo},</if>
<if test ='leaveName != null'>`leave_name` = #{leaveName},</if>
<if test ='leaveStart != null'>`leave_start` = #{leaveStart},</if>
<if test ='leaveEnd != null'>`leave_end` = #{leaveEnd},</if>
<if test ='leaveDays != null'>`leave_days` = #{leaveDays},</if>
<if test ='leaveReason != null'>`leave_reason` = #{leaveReason},</if>
<if test ='leaveText != null'>`leave_text` = #{leaveText}</if>
</set>
<resultMap id="BaseResultMap" type="com.demo.vo.Employee" >
<result column="id" property="id" />
<result column="employee_name" property="employeeName" />
<result column="employee_sex" property="employeeSex" />
<result column="employee_phone" property="employeePhone" />
<result column="employee_dept" property="employeeDept" />
<result column="employee_job" property="employeeJob" />
<result column="employee_no" property="employeeNo" />
<result column="employee_age" property="employeeAge" />
<result column="employee_education" property="employeeEducation" />
<result column="employee_intime" property="employeeIntime" />
<result column="employee_text" property="employeeText" />
</resultMap>
<sql id="Base_Column_List">
`id`,`employee_name`,`employee_sex`,`employee_phone`,`employee_dept`,`employee_job`,`employee_no`,`employee_age`,`employee_education`,`employee_intime`,`employee_text`
</sql>
</select>
<!--列表-->
<select id="findAllSplit" parameterType="java.util.Map" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" /> FROM `t_employee`
<where>
<if test="searchColumn != null and searchColumn != '' and keyword != null and keyword != ''">
${searchColumn} LIKE CONCAT('%',#{keyword},'%') AND
</if>
1=1
</where>
ORDER BY id ASC
<if test="startIndex != null and pageSize != null">
LIMIT #{startIndex},#{pageSize};
</if>
</select>
<!--数量-->
<select id="getAllCount" parameterType="java.util.Map" resultType="Integer">
SELECT COUNT(*) FROM `t_employee`
}
package com.demo.controller;
import com.demo.util.Util;
import com.demo.service.EmployeeService;
import com.demo.vo.Employee;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.io.Serializable;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
vo.setLeaveNo(Util.decode(request, "leaveNo"));
vo.setLeaveName(Util.decode(request, "leaveName"));
vo.setLeaveStart(Util.decode(request, "leaveStart"));
vo.setLeaveEnd(Util.decode(request, "leaveEnd"));
vo.setLeaveDays(Util.decode(request, "leaveDays"));
vo.setLeaveReason(Util.decode(request, "leaveReason"));
vo.setLeaveText(Util.decode(request, "leaveText"));
leaveService.update(vo);
this.redirectList(request, response);
}
/**
* 获取请假的详细信息(详情页面与编辑页面要显示该请假的详情)并跳转回页面
*
* @param response
* @param request
* @throws IOException
*/
@RequestMapping({"leaveGet", "leaveEditPre"})
<title>用户编辑</title>
<%@ include file="include/head.jsp" %>
</head>
<body>
<div class="container-fluid">
<ul class="nav nav-tabs">
<li><a href="userList">用户列表</a></li>
<li class="active"><a href="#">编辑</a></li>
</ul>
<br/>
<form class="form-horizontal" role="form" action="userEdit" method="post" onsubmit="return check()">
<input type="hidden" class="form-control" id="id" name="id" value="${vo.id}"/>
<div class="form-group">
private String employeeEducation;//学历
private String employeeIntime;//入职时间
private String employeeText;//备注
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getEmployeeName() {
return employeeName;
}
public void setEmployeeName(String employeeName) {
this.employeeName = employeeName;
}
public String getEmployeeSex() {
return employeeSex;
}
运行环境
Java≥6、Tomcat≥7.0、MySQL≥5.5
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
技术框架
JavaWeb JavaBean JSP MVC MySQL Tomcat JavaScript Bootstrap
基础JSP+Servlet或JSP+SSM(Spring、SpringMVC、MyBatis)框架或JSP+SSM+Maven(pom.xml)框架或SpringBoot…均可修改
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
登录、注册、退出、用户模块、公告模块、部门模块、员工模块、请假模块、工资模块的增删改查管理