• 大小: 56.87MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-07-18
  • 语言: 数据库
  • 标签: OA  ssm框架  mysql  

资源简介

一个简单的人事管理系统。主要功能包括对职位、用户、部门的增删查改,文件的上传与下载。
开发工具 Eclipse
技术运用 程序框架:ssm框架
运行环境 Windows10
数 据 库 Mysql 8.0
相关组件 Navicat 12 、tomcat7.0

资源截图

代码片段和文件信息

package com.dzx.controller;

import java.io.File;
import java.io.IOException;
import java.util.List;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.dzx.domain.Dept;
import com.dzx.service.DeptService;
import com.dzx.util.HrmConstants;
import com.dzx.util.HrmDownloadUtil;

@Controller
public class DeptController {
@Autowired
private DeptService deptService;

// 打印
@RequestMapping(“/deptPrint“)
public String deptPrint(HttpServletRequest request) {
// 获取所有的部门
List allDept = deptService.selectAllDept(new Dept());
request.setAttribute(HrmConstants.ALL_DEPT allDept);
return “dept/deptPrint“;
}

// 文件导出
@RequestMapping(“/deptImportExcel“)
public ResponseEntity importExcel(HttpServletRequest request) throws IOException {
// 下载文件路径文件对象user所有字段值
String servletPath = request.getServletContext().getRealPath(“/uploadFile“);
String path = servletPath + File.separator + HrmConstants.DEPT_TABLENAME + “.xls“;
String[] thtitle = { “部门编号“ “部门名称“ “部门描述“ “部门总人数““创建日期“ };
// 获取所有的部门
List allDept = deptService.selectAllDept(new Dept());
// 调用导出Excel方法
deptService.importExcel(thtitle allDept HrmConstants.DEPT_TABLENAME path);

// 文件下载
return HrmDownloadUtil.download(path HrmConstants.DEPT_TABLENAME+ “.xls“);
}

// 查询职位
@RequestMapping(“/selectDept“)
public ModelAndView selectDept(@RequestParam(value = “caption“ required = false) List caption Dept dept
HttpServletRequest request) {
List deptList = deptService.selectDept(dept);
// 保存到request作用域
ModelAndView modelAndView = new ModelAndView();
modelAndView.addobject(HrmConstants.DEPT_LIST deptList);
// 保存到application 中
List contextdeptList = deptService.selectAllDept(new Dept());
ServletContext sContext = request.getServletContext();
sContext.setAttribute(HrmConstants.CONTEXT_DEPTlIST contextdeptList);
modelAndView.setViewName(“dept/deptList“);
return modelAndView;
}

// 添加职位
@RequestMapping(“/addDept“)
public String addDept(Dept dept HttpServletRequest request) {
if (deptService.addDept(dept) > 0) {
request.setAttribute(“type“ “yes“);
} else {
request.setAttribute(“type“ “no“);
}
return “forward:/deptAdd“;
}

// 判断职位名称是否重复
@RequestMapping(“/isRedeptName“)
@ResponseBody
public Dept isRedeptName(@RequestBody Dept dept) {
if (deptService.findDeptName(dept).size() > 0) {
// 设置为false代表职位名称重复
Dept hasDept = new Dept();
hasDept.setName(dept.getName());
hasDept.setIsSuccess

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        665  2019-07-13 14:30  TestMyOA\.classpath

     文件        908  2019-07-13 14:30  TestMyOA\.project

     文件        567  2019-07-13 14:30  TestMyOA\.settings\.jsdtscope

     文件        612  2019-07-13 14:30  TestMyOA\.settings\org.eclipse.core.resources.prefs

     文件        364  2019-07-13 14:30  TestMyOA\.settings\org.eclipse.jdt.core.prefs

     文件        553  2019-07-13 14:30  TestMyOA\.settings\org.eclipse.wst.common.component

     文件        305  2019-07-13 14:30  TestMyOA\.settings\org.eclipse.wst.common.project.facet.core.xml

     文件         49  2019-07-13 14:30  TestMyOA\.settings\org.eclipse.wst.jsdt.ui.superType.container

     文件          6  2019-07-13 14:30  TestMyOA\.settings\org.eclipse.wst.jsdt.ui.superType.name

     文件       6622  2019-07-13 14:30  TestMyOA\build\classes\com\dzx\controller\DeptController.class

     文件       7252  2019-07-13 14:30  TestMyOA\build\classes\com\dzx\controller\EmployController.class

     文件       6393  2019-07-13 14:30  TestMyOA\build\classes\com\dzx\controller\JobController.class

     文件       5960  2019-07-13 14:30  TestMyOA\build\classes\com\dzx\controller\MyDocController.class

     文件       3129  2019-07-13 14:30  TestMyOA\build\classes\com\dzx\controller\MyLoginController.class

     文件       4451  2019-07-13 14:30  TestMyOA\build\classes\com\dzx\controller\MyUserController.class

     文件        488  2019-07-13 14:30  TestMyOA\build\classes\com\dzx\dao\DeptDao.class

     文件        383  2019-07-13 14:30  TestMyOA\build\classes\com\dzx\dao\DocDao.class

     文件        514  2019-07-13 14:30  TestMyOA\build\classes\com\dzx\dao\EmployDao.class

     文件        473  2019-07-13 14:30  TestMyOA\build\classes\com\dzx\dao\JobDao.class

     文件        523  2019-07-13 14:30  TestMyOA\build\classes\com\dzx\dao\UserDao.class

     文件       2575  2019-07-13 14:30  TestMyOA\build\classes\com\dzx\domain\Dept.class

     文件       2983  2019-07-13 14:30  TestMyOA\build\classes\com\dzx\domain\Doc.class

     文件       7689  2019-07-13 14:30  TestMyOA\build\classes\com\dzx\domain\Employ.class

     文件       2563  2019-07-13 14:30  TestMyOA\build\classes\com\dzx\domain\Job.class

     文件       1754  2019-07-13 14:30  TestMyOA\build\classes\com\dzx\domain\PageModel.class

     文件       3642  2019-07-13 14:30  TestMyOA\build\classes\com\dzx\domain\User.class

     文件        736  2019-07-13 14:30  TestMyOA\build\classes\com\dzx\service\DeptService.class

     文件        630  2019-07-13 14:30  TestMyOA\build\classes\com\dzx\service\DocService.class

     文件        828  2019-07-13 14:30  TestMyOA\build\classes\com\dzx\service\EmployService.class

     文件       6476  2019-07-13 14:30  TestMyOA\build\classes\com\dzx\service\impl\DeptServiceImpl.class

............此处省略219个文件信息

评论

共有 条评论