基于SSM的企业人事管理系统---javaWeb项目(非maven)

把我的第一篇奉献给毕设!!!

 

 

 

一、项目介绍

基于SSM框架实现企业人事管理系统

一、主要功能:实现部门信息、

                         员工信息、

                         员工工资、

                         出勤记录、

                         奖罚记录、

                         考核记录的 增删改查功能。

 

二、部分图片显示

基于SSM的企业人事管理系统---javaWeb项目(非maven)_第1张图片

基于SSM的企业人事管理系统---javaWeb项目(非maven)_第2张图片

基于SSM的企业人事管理系统---javaWeb项目(非maven)_第3张图片

基于SSM的企业人事管理系统---javaWeb项目(非maven)_第4张图片

基于SSM的企业人事管理系统---javaWeb项目(非maven)_第5张图片

基于SSM的企业人事管理系统---javaWeb项目(非maven)_第6张图片

 

 

二、应用技术

1、基础框架-  ssm(SpringMVC+Spring+MyBatis)
2、数据库-     SQLserver2008
3、前端-         jsp,bootstrap,jquery,css,js,Ajax前端校验
5、分页-         pagehelper
6、逆向工程-  MyBatis Generator

 

 

三、开发步骤

一、准备运行环境:

              eclipse;

              tomcat8.5

              jdk1.7

 

以下为个人观点,如有否定,是你的对~~~不杠~~~轻喷,中肯建议,必采纳~~~

 

二、搭建框架

1、打开eclipse,搭建框架。(

      1>还不会创建web项目的宝宝看这里https://blog.csdn.net/weixin_41697424/article/details/83686605?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522158676079719724843313530%2522%252C%2522scm%2522%253A%252220140713.130102334..%2522%257D&request_id=158676079719724843313530&biz_id=0&utm_source=distribute.pc_search_result.none-task-blog-soetl_SOETLBAIDU-2)

      2>不会在com中建空包的宝宝看这里https://blog.csdn.net/renjingzhaozhao/article/details/105490929

 

基于SSM的企业人事管理系统---javaWeb项目(非maven)_第7张图片

 

 

基于SSM的企业人事管理系统---javaWeb项目(非maven)_第8张图片

 

 

我个人对分层结构要求严谨,唉看到过一些项目分层,望过去,???  这tm是啥?,,真的脑壳疼。。。

扩展以下分层结构,摘自《spring+mybatis企业应用实战》

基于SSM的企业人事管理系统---javaWeb项目(非maven)_第9张图片

基于SSM的企业人事管理系统---javaWeb项目(非maven)_第10张图片

 


 

 

三、导入jar包

基于SSM的企业人事管理系统---javaWeb项目(非maven)_第11张图片

文章结尾,我会留下项目压缩包,里面有jar包。

 

 

四、写配置文件

我也是从网上抄来的,大家的也都差不多,添加一点自己项目的东西就行。

配置文件主要放在了config包中,其他位置,我不放会报错,原因我也不知道哦~~~学艺不精。。。等我懂了再来解决~~~

基于SSM的企业人事管理系统---javaWeb项目(非maven)_第12张图片

<1、配置applicationContext文件。




	
    
    
    
    
        
        
        
        
        
    

    
    
    
        
        
        
        
    

    
    
        
    
    
    
    
    
    
    
		
		
	
	
	
		
			
			
			
			
			
			
			
			
			
			
		
	
	
	
		
	
	
	
    


<2、配置dbconfig.properties文件。

如果使用其他数据库需要更改这里。我用的SQLserver

jdbc.driver=com.microsoft.sqlserver.jdbc.SQLServerDriver
jdbc.url=jdbc:sqlserver://localhost;DatabaseName=ERP
jdbc.username=sa
jdbc.password=123456

<3、配置log4j.properties文件。

# Global logging configuration
log4j.rootLogger=DEBUG,stdout
# Console output...
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] - %m%n

<4、springmvc.xml文件




	
	
	
	
	
	
  		
       
       
	   
	   
	
	
	
		
		
		
		
	
	
	
	
	
	

<5、SqlMapConfig.xml文件





	
		
			
		
	

<6、web.xml文件



  ERP
  
    index.html
    index.htm
    index.jsp
    default.html
    default.htm
    default.jsp
  

   
    
        contextConfigLocation
        
        classpath:applicationContext.xml
    
    
        org.springframework.web.context.ContextLoaderListener
    


  
  
    springMvc
    org.springframework.web.servlet.DispatcherServlet
    
    1
  
  
  
    springMvc
    /
  

  
  
        CharacterEncodingFilter
        org.springframework.web.filter.CharacterEncodingFilter
        
            encoding
            UTF-8
        
    
    
        CharacterEncodingFilter
        /*     
    
    
    
    	HiddenHttpMethodFilter
    	org.springframework.web.filter.HiddenHttpMethodFilter
    
    
   	
   		HiddenHttpMethodFilter
   		/*
   	
   	
   		HttpPutFormContentFilter
   		org.springframework.web.filter.HttpPutFormContentFilter
   	
   	
   		HttpPutFormContentFilter
   		/*
   	

 

五、编写数据库(应放在项目建立的第一步,经济基础决定上层建筑,数据库就是基础,地基不打牢还怎么盖楼)

但。。。数据库,,,,emmmmm。。。。答辩的前两天被我不小心删了。。。。有点惨,幸好有生成的脚本,,,凑合看一下吧~~~

USE [master]
GO
/****** Object:  Database [ERP]    Script Date: 05/28/2019 18:09:10 ******/
CREATE DATABASE [ERP] ON  PRIMARY 
( NAME = N'ERP', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\ERP.mdf' , SIZE = 2304KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
 LOG ON 
( NAME = N'ERP_log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\ERP_log.LDF' , SIZE = 576KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)
GO
ALTER DATABASE [ERP] SET COMPATIBILITY_LEVEL = 100
GO
IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
begin
EXEC [ERP].[dbo].[sp_fulltext_database] @action = 'enable'
end
GO
ALTER DATABASE [ERP] SET ANSI_NULL_DEFAULT OFF
GO
ALTER DATABASE [ERP] SET ANSI_NULLS OFF
GO
ALTER DATABASE [ERP] SET ANSI_PADDING OFF
GO
ALTER DATABASE [ERP] SET ANSI_WARNINGS OFF
GO
ALTER DATABASE [ERP] SET ARITHABORT OFF
GO
ALTER DATABASE [ERP] SET AUTO_CLOSE OFF
GO
ALTER DATABASE [ERP] SET AUTO_CREATE_STATISTICS ON
GO
ALTER DATABASE [ERP] SET AUTO_SHRINK OFF
GO
ALTER DATABASE [ERP] SET AUTO_UPDATE_STATISTICS ON
GO
ALTER DATABASE [ERP] SET CURSOR_CLOSE_ON_COMMIT OFF
GO
ALTER DATABASE [ERP] SET CURSOR_DEFAULT  GLOBAL
GO
ALTER DATABASE [ERP] SET CONCAT_NULL_YIELDS_NULL OFF
GO
ALTER DATABASE [ERP] SET NUMERIC_ROUNDABORT OFF
GO
ALTER DATABASE [ERP] SET QUOTED_IDENTIFIER OFF
GO
ALTER DATABASE [ERP] SET RECURSIVE_TRIGGERS OFF
GO
ALTER DATABASE [ERP] SET  ENABLE_BROKER
GO
ALTER DATABASE [ERP] SET AUTO_UPDATE_STATISTICS_ASYNC OFF
GO
ALTER DATABASE [ERP] SET DATE_CORRELATION_OPTIMIZATION OFF
GO
ALTER DATABASE [ERP] SET TRUSTWORTHY OFF
GO
ALTER DATABASE [ERP] SET ALLOW_SNAPSHOT_ISOLATION OFF
GO
ALTER DATABASE [ERP] SET PARAMETERIZATION SIMPLE
GO
ALTER DATABASE [ERP] SET READ_COMMITTED_SNAPSHOT OFF
GO
ALTER DATABASE [ERP] SET HONOR_BROKER_PRIORITY OFF
GO
ALTER DATABASE [ERP] SET  READ_WRITE
GO
ALTER DATABASE [ERP] SET RECOVERY FULL
GO
ALTER DATABASE [ERP] SET  MULTI_USER
GO
ALTER DATABASE [ERP] SET PAGE_VERIFY CHECKSUM
GO
ALTER DATABASE [ERP] SET DB_CHAINING OFF
GO
EXEC sys.sp_db_vardecimal_storage_format N'ERP', N'ON'
GO
USE [ERP]
GO
/****** Object:  Table [dbo].[Dept]    Script Date: 05/28/2019 18:09:12 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Dept](
	[dept_id] [int] IDENTITY(1,1) NOT NULL,
	[dept_name] [varchar](20) NOT NULL,
	[level] [varchar](20) NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[dept_id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Attendance]    Script Date: 05/28/2019 18:09:12 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Attendance](
	[attendance_id] [int] IDENTITY(1,1) NOT NULL,
	[day] [varchar](20) NOT NULL,
	[state] [varchar](20) NULL,
	[emp_id] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[attendance_id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Assecess]    Script Date: 05/28/2019 18:09:12 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Assecess](
	[asscess_id] [int] IDENTITY(1,1) NOT NULL,
	[result] [varchar](20) NOT NULL,
	[assecess_time] [varchar](20) NOT NULL,
	[emp_id] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[asscess_id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Users]    Script Date: 05/28/2019 18:09:12 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Users](
	[users_id] [varchar](20) NOT NULL,
	[password] [varchar](20) NOT NULL,
	[users_name] [varchar](20) NOT NULL,
	[createdate] [varchar](20) NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[users_id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Salary]    Script Date: 05/28/2019 18:09:12 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Salary](
	[salary_id] [int] IDENTITY(1,1) NOT NULL,
	[basic_salary] [int] NOT NULL,
	[overtime_pay] [int] NOT NULL,
	[reward] [int] NOT NULL,
	[allowance] [int] NOT NULL,
	[penalty] [int] NOT NULL,
	[real_salary] [int] NOT NULL,
	[month] [int] NOT NULL,
	[emp_id] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[salary_id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Rprecord]    Script Date: 05/28/2019 18:09:12 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Rprecord](
	[rprecord_id] [int] IDENTITY(1,1) NOT NULL,
	[rp_time] [varchar](20) NOT NULL,
	[rp_reason] [varchar](20) NOT NULL,
	[rp_method] [varchar](20) NOT NULL,
	[emp_id] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[rprecord_id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Employee]    Script Date: 05/28/2019 18:09:12 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Employee](
	[employee_id] [int] IDENTITY(1,1) NOT NULL,
	[employee_name] [varchar](20) NOT NULL,
	[employee_job] [varchar](20) NOT NULL,
	[employee_sex] [char](2) NOT NULL,
	[employee_age] [int] NOT NULL,
	[marital_status] [varchar](20) NOT NULL,
	[employee_education] [varchar](20) NOT NULL,
	[employee_Tel] [varchar](20) NOT NULL,
	[employee_mail] [varchar](20) NOT NULL,
	[employee_Add] [varchar](20) NOT NULL,
	[work_time] [varchar](20) NOT NULL,
	[employee_Dept] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[employee_id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Check [CK__Attendanc__state__45F365D3]    Script Date: 05/28/2019 18:09:12 ******/
ALTER TABLE [dbo].[Attendance]  WITH CHECK ADD CHECK  (([state]='出勤' OR [state]='迟到' OR [state]='早退' OR [state]='旷工' OR [state]='请假'))
GO
/****** Object:  ForeignKey [FK__Employee__employ__5EBF139D]    Script Date: 05/28/2019 18:09:12 ******/
ALTER TABLE [dbo].[Employee]  WITH CHECK ADD FOREIGN KEY([employee_Dept])
REFERENCES [dbo].[Dept] ([dept_id])
GO

 

ERP数据库中的表:

Users 超级管理员表:用于存放超级管理员信息。

Dept 部门信息表:用于存放所有部门信息。

Employee 用户信息表:用于存放所有员工信息。

Attendance出勤记录表:用于存放所有员工出勤记录;

Salary工资表:用于存放员工工资的记录。

Assecess 考核评价表:用于存放所有员工的绩效考核。

Rprecord 奖罚记录表:用于存放所有员工的奖罚记录信息。

 

 

 

 

六、写mapper和pojo层内容

方法1:项目小的话,可以自己写,网上也有很多自己写的可以去找一找。

方法2:利用MyBatis逆向生成,自动生成pojo层的类,mapper层的xml文件和java类。

             逆向生成有两种方法,可参考https://blog.csdn.net/myblogzz/article/details/80381214,

我用的是命令行形式,其中generatorConfig.xml文件如下

  
  
  

      
      
          
              
   
              
          
 
          
          
          
              
          
   
          
		    
              
			
              
          
   
          
              
          
     
          
              
          
     
        

 

之后将src文件中的com包中的类复制到eclipse中相应包中

基于SSM的企业人事管理系统---javaWeb项目(非maven)_第13张图片

基于SSM的企业人事管理系统---javaWeb项目(非maven)_第14张图片

基于SSM的企业人事管理系统---javaWeb项目(非maven)_第15张图片

 

七、测试mapper层

mappertest.java 

package com.test;



import java.util.Date;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import com.mapper.DeptMapper;
import com.mapper.EmployeeMapper;
import com.mapper.UsersMapper;
import com.pojo.Dept;
import com.pojo.Employee;
import com.pojo.Users;


/**
 * 测试dao层工作
 * @author 赵任静   
 *
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={"classpath:applicationContext.xml"})


public class Mappertest {
	@Autowired
	DeptMapper deptMapper;
	
	@Autowired
	EmployeeMapper employeeMapper;
	
	
	@Test
	public void testRCUD(){
		System.out.println(deptMapper);
//		new Dept();
//		deptMapper.insertSelective(new Dept("1002","FD","2"));
		
//		Users userInfo = usersMapper.selectByPrimaryKey("root");
//		System.out.println(userInfo);
		
//		new Employee();
//		employeeMapper.insertSelective(new Employee(null,"Rose","PM","F",30,"Yes","PhD","13523478906","[email protected]","天津市和平区","2018-08-12",2));
		employeeMapper.deleteByPrimaryKey(10);
		
		
		}
	
}

 

八、编写分页器及测试

Mvctest.java 

package com.test;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.MvcResult;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;

import com.github.pagehelper.PageInfo;
import com.pojo.Employee;
import java.util.List;

@RunWith(SpringJUnit4ClassRunner.class)
@WebAppConfiguration
@ContextConfiguration(locations={"classpath:applicationContext.xml","classpath:springmvc.xml"})
public class MvcTest {

	//传入SpringMVC的ioc
	@Autowired
	WebApplicationContext context;
	//虚拟mvc请求,获取到处理结果
	MockMvc mockMvc;
	
	@Before
	public void initMockMvc() {
		mockMvc =MockMvcBuilders.webAppContextSetup(context).build();

	}
	@Test
	public void testPage()throws Exception{
		//模拟请求拿到返回值
		MvcResult result=mockMvc.perform(MockMvcRequestBuilders.get("/emps").param("pn","1")).andReturn();
		//请求成功后,请求域中会有PageInfo进行验证
		MockHttpServletRequest request=result.getRequest();
		PageInfo pi=(PageInfo)request.getAttribute("pageInfo");
		System.out.println("当前页码"+pi.getPageNum());
		System.out.println("总页码"+pi.getPages());
		System.out.println("总记录数"+pi.getTotal());
		System.out.println("在页面需要连续显示的页码");
		int[] nums=pi.getNavigatepageNums();
		for (int i : nums){
			System.out.print(" "+i);
		}
		//获取员工数据
		List list=pi.getList();
		for (Employee employee : list){
			System.out.println("ID"+employee.getEmployeeId()+"==>Name:"+employee.getEmployeeName());
		}
		
	}
}

 

九、编写service层

package com.service;

import com.pojo.Employee;
import com.pojo.EmployeeExample;
import com.pojo.Rprecord;
import com.pojo.RprecordExample;
import com.mapper.AssecessMapper;
import com.mapper.AttendanceMapper;
import com.mapper.DeptMapper;
import com.mapper.EmployeeMapper;
import com.mapper.RprecordMapper;
import com.mapper.SalaryMapper;
import com.pojo.Users;
import com.mapper.UsersMapper;
import com.pojo.Assecess;
import com.pojo.AssecessExample;
import com.pojo.Attendance;
import com.pojo.AttendanceExample;
import com.pojo.Dept;
import com.pojo.DeptExample;
import com.pojo.Salary;
import com.pojo.SalaryExample;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Description: 人事管理《service层》接口 
* 网站:疯狂Java * @author 赵任静 [email protected] * @version V1.0 */ @Service public class ERPService { @Autowired EmployeeMapper employeeMapper; @Autowired UsersMapper usersMapper; @Autowired DeptMapper deptMapper; @Autowired SalaryMapper salaryMapper; @Autowired AssecessMapper assecessMapper; @Autowired RprecordMapper rprecordMapper; @Autowired AttendanceMapper attendanceMapper; /***************** 《超级管理员》 服务接口实现 *************************************/ /** * 用户登录判断--login * * @see { ERPService } */ public Users checkLogin(String usersId, String password) { // 根据用户名实例化用户对象 Users users = usersMapper.selectByPrimaryKey(usersId); if (users != null && users.getPassword().equals(password)) { return users; } return null; } public boolean Login(String usersId, String password){ Users users=usersMapper.selectByPrimaryKey(usersId); if (users != null && users.getPassword().equals(password)) { return true; } return false; } /***************** 《员工》 服务接口实现 *************************************/ /** * 用于Employee查询--分页显示 * * @return * @see { ERPService } */ public List findEmployee() { // return employeeMapper.selectByExample(null); return employeeMapper.selectByExampleWithDept(null); } /** * 用于Employee添加 * * @return * @see { ERPService } */ public void saveEmp(Employee employee) { employeeMapper.insertSelective(employee); } /** * 用于Employee添加--判断《用户名》是否已存在 * * @return * @see { ERPService } */ public boolean checkUser(String employeeName) { // TODO Auto-generated method stub EmployeeExample example = new EmployeeExample(); com.pojo.EmployeeExample.Criteria criteria = example.createCriteria(); criteria.andEmployeeNameEqualTo(employeeName); long count = employeeMapper.countByExample(example); return count == 0; } /** * 用于(其他四表)添加--判断《员工ID》是否已存在 * * @return * @see { ERPService } */ public boolean checkUserId(Integer employeeId) { // TODO Auto-generated method stub EmployeeExample example = new EmployeeExample(); com.pojo.EmployeeExample.Criteria criteria = example.createCriteria(); criteria.andEmployeeIdEqualTo(employeeId); long count = employeeMapper.countByExample(example); return count == 0; } /** * 用于员工更新 * * @return * @see { ERPService } */ public void updateEmp(Employee employee) { // TODO Auto-generated method stub employeeMapper.updateByPrimaryKeySelective(employee); } /** * 用于员工更新--按Id查找数据 * * @return * @see { ERPService } */ public Employee getEmp(Integer employeeId) { // TODO Auto-generated method stub Employee employee = employeeMapper.selectByPrimaryKey(employeeId); return employee; } /** * 用于员工单个删除 * * @see { ERPService } */ public void deleteEmp(Integer employeeId) { // TODO Auto-generated method stub employeeMapper.deleteByPrimaryKey(employeeId); } /** * 用于批量删除 * * @see { ERPService } */ public void deleteBatch(List ids) { // TODO Auto-generated method stub EmployeeExample example = new EmployeeExample(); com.pojo.EmployeeExample.Criteria criteria = example.createCriteria(); // delete from XXX where employee_id in (1,2,3) criteria.andEmployeeIdIn(ids); employeeMapper.deleteByExample(example); } /***************** 《部门》 服务接口实现 *************************************/ /** * 用于查询dept中的所有信息 * * @see { ERPService } */ public List findAllDept() { return deptMapper.selectByExample(null); } /** * 用于dept添加 * * @return * @see { ERPService } */ public void saveDept(Dept dept) { // TODO Auto-generated method stub deptMapper.insertSelective(dept); } /** * 用于dept更新 * * @return * @see { ERPService } */ public void updateDept(Dept dept) { // TODO Auto-generated method stub deptMapper.updateByPrimaryKeySelective(dept); } /** * 用于dept更新--按员工Id查询数据 * * @return * @see { ERPService } */ public Dept getDept(Integer deptId) { // TODO Auto-generated method stub Dept dept = deptMapper.selectByPrimaryKey(deptId); return dept; } /** * 用于dept删除 * * @return * @see { ERPService } */ public void deletedept(Integer deptId) { // TODO Auto-generated method stub deptMapper.deleteByPrimaryKey(deptId); } public void deleteBatchdept(List ids) { // TODO Auto-generated method stub DeptExample example = new DeptExample(); com.pojo.DeptExample.Criteria criteria = example.createCriteria(); // delete from XXX where employee_id in (1,2,3) criteria.andDeptIdIn(ids); deptMapper.deleteByExample(example); } /***************** 《工资》 服务接口实现 *************************************/ /** * 用于Salary查询--分页显示 * * @return * @see { ERPService } */ public List findSalary() { // TODO Auto-generated method stub return salaryMapper.selectByExampleWithEmp(null); } /** * 用于Salary添加 * * @return * @see { ERPService } */ public void saveSalary(Salary salary) { // TODO Auto-generated method stub salaryMapper.insertSelective(salary); } /** * 用于Salary更新 * * @return * @see { ERPService } */ public void updateSalary(Salary salary) { // TODO Auto-generated method stub salaryMapper.updateByPrimaryKeySelective(salary); } /** * 用于Salary更新---按Id查找数据 * * @return * @see { ERPService } */ public Salary getSalary(Integer salaryId) { // TODO Auto-generated method stub Salary salary = salaryMapper.selectByPrimaryKey(salaryId); return salary; } /** * 用于Salary大哥删除 * * @return * @see { ERPService } */ public void deleteSalary(Integer salaryId) { // TODO Auto-generated method stub salaryMapper.deleteByPrimaryKey(salaryId); } /** * 用于Salary批量删除 * * @return * @see { ERPService } */ public void deleteBatchsalary(List ids) { // TODO Auto-generated method stub SalaryExample example = new SalaryExample(); com.pojo.SalaryExample.Criteria criteria = example.createCriteria(); // delete from XXX where employee_id in (1,2,3) criteria.andSalaryIdIn(ids); salaryMapper.deleteByExample(example); } /***************** 《评估》 服务接口实现 *************************************/ /** * 用于Assecess查询--分页显示 * * @return * @see { ERPService } */ public List findAssecess() { // TODO Auto-generated method stub return assecessMapper.selectByExampleWithEmp(null); } /** * 用于Assecess添加 * * @return * @see { ERPService } */ public void saveAssecess(Assecess assecess) { // TODO Auto-generated method stub assecessMapper.insertSelective(assecess); } /** * 用于Assecess更新 * * @return * @see { ERPService } */ public void updateAssecess(Assecess assecess) { // TODO Auto-generated method stub assecessMapper.updateByPrimaryKeySelective(assecess); } /** * 用于Assecess更新--按Id查找数据 * * @return * @see { ERPService } */ public Assecess getAssecess(Integer asscessId) { // TODO Auto-generated method stub Assecess assecess = assecessMapper.selectByPrimaryKey(asscessId); return assecess; } /** * 用于Assecess单个删除 * * @return * @see { ERPService } */ public void deleteAssecess(Integer asscessId) { // TODO Auto-generated method stub assecessMapper.deleteByPrimaryKey(asscessId); } /** * 用于Assecess批量删除 * * @return * @see { ERPService } */ public void deleteBatchAssecess(List ids) { // TODO Auto-generated method stub AssecessExample example = new AssecessExample(); com.pojo.AssecessExample.Criteria criteria = example.createCriteria(); // delete from XXX where employee_id in (1,2,3) criteria.andAsscessIdIn(ids); assecessMapper.deleteByExample(example); } /***************** 《出勤》 服务接口实现 *************************************/ /** * 用于Attendance查询--分页显示 * * @return * @see { ERPService } */ public List findAttendance() { // TODO Auto-generated method stub return attendanceMapper.selectByExampleWithEmp(null); } /** * 用于Attendance添加 * * @return * @see { ERPService } */ public void saveAttendance(Attendance attendance) { // TODO Auto-generated method stub attendanceMapper.insertSelective(attendance); } /** * 用于Attendance更新 * * @return * @see { ERPService } */ public void updateAttendance(Attendance attendance) { // TODO Auto-generated method stub attendanceMapper.updateByPrimaryKeySelective(attendance); } /** * 用于Attendance更新--按Id查找数据 * * @return * @see { ERPService } */ public Attendance getAttendance(Integer attendanceId) { // TODO Auto-generated method stub Attendance attendance = attendanceMapper.selectByPrimaryKey(attendanceId); return attendance; } /** * 用于Attendance单个删除 * * @return * @see { ERPService } */ public void deleteAttendance(Integer attendanceId) { // TODO Auto-generated method stub attendanceMapper.deleteByPrimaryKey(attendanceId); } /** * 用于Attendance批量删除 * * @return * @see { ERPService } */ public void deleteBatchAttendance(List ids) { // TODO Auto-generated method stub AttendanceExample example = new AttendanceExample(); com.pojo.AttendanceExample.Criteria criteria = example.createCriteria(); // delete from XXX where employee_id in (1,2,3) criteria.andAttendanceIdIn(ids); attendanceMapper.deleteByExample(example); } /***************** 《奖罚》 服务接口实现 *************************************/ /** * 用于Rprecord查询--分页显示 * * @return * @see { ERPService } */ public List findRprecord() { // TODO Auto-generated method stub return rprecordMapper.selectByExampleWithEmp(null); } /** * 用于Assecess添加 * * @return * @see { ERPService } */ public void saveRprecord(Rprecord rprecord) { // TODO Auto-generated method stub rprecordMapper.insertSelective(rprecord); } /** * 用于Rprecord更新 * * @return * @see { ERPService } */ public void updateRprecord(Rprecord rprecord) { // TODO Auto-generated method stub rprecordMapper.updateByPrimaryKeySelective(rprecord); } /** * 用于Rprecord更新--按Id查找数据 * * @return * @see { ERPService } */ public Rprecord getRprecord(Integer rprecordId) { // TODO Auto-generated method stub Rprecord rprecord = rprecordMapper.selectByPrimaryKey(rprecordId); return rprecord; } /** * 用于Rprecord单个删除 * * @return * @see { ERPService } */ public void deleteRprecord(Integer rprecordId) { // TODO Auto-generated method stub rprecordMapper.deleteByPrimaryKey(rprecordId); } /** * 用于Rprecord批量删除 * * @return * @see { ERPService } */ public void deleteBatchRprecord(List ids) { // TODO Auto-generated method stub RprecordExample example = new RprecordExample(); com.pojo.RprecordExample.Criteria criteria = example.createCriteria(); // delete from XXX where employee_id in (1,2,3) criteria.andRprecordIdIn(ids); rprecordMapper.deleteByExample(example); } }

 

 

十、编写controller层

controller层建立UsersController.java

package com.controller;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import com.pojo.Users;
import com.service.ERPService;

/**   
 * @Description: 人事管理《UsersController》层
 * 
网站:疯狂Java * @author 赵任静 [email protected] * @version V1.0 */ @Controller public class UsersController { @Autowired ERPService erpService; /** * 处理/login请求 */ @RequestMapping("/megement") public String login(){ return "head"; } @RequestMapping(value="Login") public String login(String usersId,String password,Model model) throws Exception { Users users=erpService.checkLogin(usersId, password); if(users!=null){ model.addAttribute(users); return "Main"; } return "Fail"; } }

 

十一、实现登录界面

index.jsp为运行初始界面,直接跳转到views层的Login.jsp 界面

index.jsp 界面如下:

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>




ERP系统
	
	
    
    
    
    



	
	
	    



 

 

两个Login.jsp内容一样,WEB—INF里的受保护,不能随意进行JSP之间的跳转,controller层制约;

                                       WebContent中用于jsp之间跳转。

基于SSM的企业人事管理系统---javaWeb项目(非maven)_第16张图片

 

Login.jsp界面:动态的界面。是一个画布canvas上定位了一个div

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>







    
    
    
    
   
<%
	pageContext.setAttribute("APP_PATH", request.getContextPath());
%>

用户登录


    <%-- 
ERP系统
--%>

 

Fail.jsp跳转失败,3秒自动转回登录界面

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>







Insert title here


	  	

登录名或密码错误,请重新输入!

 

跳转成功进入Main.jsp界面-----------上方导航条+轮播图+版权

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>




		
		
		
		<%
			pageContext.setAttribute("APP_PATH", request.getContextPath());
		%>
		主界面
		
		
		
		
		
	

	
	<%--  --%>
	
		
		
		

XXX公司

来源: 东强工作室

Copyright©2005-2019 XXX公司 版权所有

 

 

有时间继续完善。。。

把链接先放上

 

链接:https://pan.baidu.com/s/1vNpC6HD5IIyP_UjHNSMv0A 
提取码:lqv5 
复制这段内容后打开百度网盘手机App,操作更方便哦

 

点赞  会鼓励作者发布 更多作品 哦~~~

 

 

----------------------------------------------------------------我是调皮的分割线--------------------------------------------------------------------------------

毕设临近,我这增加了很多访问量啊~~~我当时写毕设的时候~~完全自学的SSM~~熬到头秃,晚上12点之前没睡过觉~~~那段SB日子很辛苦但很有收获,所以还是推荐大家自己写毕设,别去买~~~~当时从CSDN上获得了很多帮助~~所以把自己的劳动成果无条件共享CSDN,希望能帮到一些人~~~程序仅供学习,禁止以盈利为目的交易买卖!~~

你可能感兴趣的:(SSM框架,jsp,ajax,SSM,基于java的企业人事管理系统,Ajax技术,分页显示)