基于javaweb的企业绩效工资管理系统(java+ssm+html+layui+bootstrap+mysql)
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb+mysql的企业绩效管理系统(java+SSM+Maven+HTML+LayUI+bootstrap+mysql)
项目介绍
本项目包含管理员与普通员工两种角色, 管理员角色包含以下功能: 管理员登录,员工管理,部门管理,岗位管理,职称管理,工龄奖金管理,工资项管理,考勤管理,工资查询等功能。 员工角色包含以下功能: 员工登录,个人信息管理,考勤管理,工资详情等功能。
环境需要
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项目:是;
技术栈
- 后端:Spring+SpringMVC+Mybatis 2. 前端:HTML+CSS+JavaScript+LayUI+jquery+bootstrap
使用说明
- 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven; 若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中dbconfig.properties配置文件中的数据库配置改为自己的配置; 4. 运行项目,输入localhost:8080/ssm_esms 登录 注:tomcat中需配置路径为/ssm_esms,否则会有异常 管理员账号/密码:admin/admin 用户账号/密码:18080833/123456
员工管理控制层:
@RestController
@RequestMapping(“/employee”)
@CrossOrigin
@Slf4j
public class EmployeeController {
@Autowired
private EmployeeService employeeService;
@Autowired
private DepartmentService departmentService;
@Autowired
private JobService jobService;
@Autowired
private EduLevelMapper eduLevelMapper;
@Autowired
private EmployeeMapper employeeMapper;
/**
- 搜索接口
*/
@GetMapping(“/search”)
public Result search(@RequestParam(name = “name”, required = false,defaultValue = “”) String name,
@RequestParam(name = “current”, required = false, defaultValue = “1”) Integer current,
@RequestParam(name = “size”, required = false, defaultValue = “10”) Integer size) {
return employeeService.list(current, size, name);
/**
-
分页查询接口
-
@param current
-
@param size
-
@return
*/
@GetMapping(“/list”)
public Result list(@RequestParam(name = “current”, required = false, defaultValue = “1”) Integer current,
@RequestParam(name = “size”, required = false, defaultValue = “10”) Integer size) {
return employeeService.list(current, size, null);
/**
-
根据id获取员工具体信息
-
@param id
-
@return
*/
@GetMapping(“/getUserById”)
public EmployeeDTO getUserAllInfoById(@RequestParam(name = “id”) Integer id) {
return employeeService.getUserById(id);
/**
-
根据员工获取信息
-
@param id
-
@return
*/
@GetMapping(“/getEmployeeById”)
public Employee getUserById(@RequestParam(name = “id”) Integer id) {
return employeeMapper.selectById(id);
/**
-
增加员工接口
-
@param employee
-
@return
*/
@PostMapping(“/add”)
public Map<String, Object> addUser(@RequestBody Employee employee) {
log.info(employee.toString());
return employeeService.add(employee);
/**
-
更新用户
-
@param employee
-
@return
*/
@PostMapping(“/update”)
public Map<String, Object> updateUser(@RequestBody Employee employee) {
log.info(employee.toString());
return employeeService.update(employee);
/**
-
删除用户
-
@param id
-
@return
*/
@GetMapping(“/delete”)
public Result deleteEmployeeById(@RequestParam(name = “id”) Integer id) {
return employeeService.deleteEmployeeById(id);
/**
-
辞退员工
-
@param id
-
@return
*/
@GetMapping(“/dismiss”)
public Map<String, Object> dismissEmployeeById(@RequestParam(name = “id”) Integer id) {
return employeeService.dismissEmployeeById(id);
/**
-
得到所以工作,部门,学历信息
-
@return
*/
@GetMapping(“/otherInfo”)
public Result getAllOtherInfo() {
Map<String, Object> info = new HashMap<>();
info.put(“departments”, departmentService.selectAll());
info.put(“jobs”, jobService.selectAll());
info.put(“eduLevels”, eduLevelMapper.selectList(null));
return Result.success(info);
@GetMapping(“/map”)
public Result getMap() {
return employeeService.getMap();
登录管理业务处理层:
@Service
public class AuthServiceImpl implements AuthService {
@Autowired
private EmployeeMapper employeeMapper;
@Override
public Result login(String email, String password) {
//先用邮箱查询是否有这个员工
LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(Employee::getEmail, email);
// queryWrapper.eq(Employee::getPassword, password);
Employee employee = employeeMapper.selectOne(queryWrapper);
//判断员工是否存在
if (employee == null) {
return Result.failure(ResponseCode.USER_NOT_FOUND);
} else {
//判断密码是否正确
if (!employee.getPassword().equals(password)) {
return Result.failure(ResponseCode.PASSWORD_ERROR);
// 生成token
String token = UUID.randomUUID().toString();
LoginDTO loginDTO = new LoginDTO();
if (employee.getAuthority() == 1) {
loginDTO.setSuper(true);
} else {
loginDTO.setSuper(false);
loginDTO.setToken(token);
loginDTO.setUserId(employee.getId());
return Result.success(loginDTO);
部门管理控制层:
@Service
public class DepartmentServiceImpl implements DepartmentService {
@Autowired
private DepartmentMapper departmentMapper;
@Autowired
private DeptManagerMapper deptManagerMapper;
@Autowired
private EmployeeMapper employeeMapper;
@Override
public List selectAll() {
List departmentDTOS = departmentMapper.selectAll();
for (DepartmentDTO departmentDTO : departmentDTOS) {
LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(DeptManager::getDeptId, departmentDTO.getId());
DeptManager deptManager = deptManagerMapper.selectOne(queryWrapper);
// fixes bug #空指针异常, 如果部门没有经理, 会抛出空指针异常
if (deptManager != null) {
EmployeeDTO manager = employeeMapper.getUserById(deptManager.getEmpId());
departmentDTO.setManager(manager);
return departmentDTOS;
@Override
public Map<String, Object> add(Map<String, Object> map) {
//先查询是否有部门
String name = (String) map.get(“name”);
Integer managerId = Integer.parseInt((String) map.get(“managerId”));
LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>();
wrapper.eq(Department::getName, name);
Integer count = departmentMapper.selectCount(wrapper);
if (count != 0) {
map.put(“code”, 511);
map.put(“message”, “部门存在”);
return map;
//查询经理是否存在
LambdaQueryWrapper wrapper1 = new LambdaQueryWrapper<>();
wrapper1.eq(Employee::getId, managerId);
Integer count1 = employeeMapper.selectCount(wrapper1);
if (count1 == 0) {
map.put(“code”, 404);
map.put(“message”, “用户不存在”);
return map;
//定义返回结果
Map<String, Object> resultMap = new HashMap<>();
Department department = new Department();
department.setIntro((String) map.get(“descriiption”));
department.setName((String) map.get(“name”));
//插入部门
int i = departmentMapper.insert(department);
//部门经理表
DeptManager deptManager = new DeptManager();
deptManager.setDeptId(department.getId());
deptManager.setEmpId(managerId);
int insert = deptManagerMapper.insert(deptManager);
if (i !=0 ) {
map.put(“code”, 200);
map.put(“message”, “添加成功”);
return map;
} else {
map.put(“code”, 500);
map.put(“message”, “添加失败”);
return map;