Java项目:SSM CRM人事管理系统

项目介绍

CRM人事管理系统,主要功能有:

用户管理:用户查询、添加用户、编辑、删除; 职位管理:职位查询、添加职位、删除; 部门管理:部门查询、添加部门、删除; 员工管理:员工查询、添加员工、编辑、删除; 公告管理:公告查询、添加公告、删除; 下载中心:文档查询、上传文档;

系统设置:退出系统;

由于本程序规模不大,可供课程设计,毕业设计学习演示之用

环境需要

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.是否Maven项目: 是;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目

6.数据库:MySql 5.7版本;

技术栈

1. 后端:Spring SpringMVC MyBatis

2. 前端:JSP+Layui+jQuery

使用说明

1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 将项目中db.properties配置文件中的数据库配置改为自己的配置 3. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,配置tomcat,然后运行;

4. 运行项目,输入localhost:8080/xxx 登录

相关代码

部门管理控制器

@Controller
@RequestMapping("/department")
public class DepartmentController {

    //注入业务
    @Autowired
    private IDepartmentService departmentService;

    @RequestMapping("/deptView")
    public String employeeView() {

        return "department/department";
    }

    //跳转添加页面
    @RequestMapping("/deptAddView")
    public String departmentAddView() {

        return "department/departmentAdd";
    }

    //查询部门所有数据
    @RequestMapping("/deptOption")
    @ResponseBody
    public List<Department> jsonDeptOption(String keyword) {
        List<Department> list = departmentService.selectAll(keyword);
        return list;
    }

    //部门添加
    @RequestMapping(value = "/deptAdd", method = RequestMethod.POST)
    @ResponseBody
    public String departmentAdd(@RequestBody Department dept) {
        int insert = departmentService.insert(dept);
        if (insert < 0) {
            return "error";
        }
        return "success";
    }

    //部门删除
    @RequestMapping(value = "/deptDelete", method = RequestMethod.GET)
    @ResponseBody
    public String delete(@RequestParam("id") Long id) {
        if (id != null) {
            int index;
            index = departmentService.deleteByPrimaryKey(id);
            if (index == 0 || index == -1) {
                return "error";
            }
        }
        return "success";
    }

    @RequestMapping(value = "/deptList", method = RequestMethod.GET)
    public @ResponseBody
    Map<String, Object> deptList(@RequestParam int page, @RequestParam int limit,
                                 String keyword) {
        System.out.println("keyword = " + keyword);
        //查询结果总数
        List<Department> countDept = departmentService.selectAll(keyword);
        //分页
        if (page < 0) {
            page = 1;
        }
        PageHelper.startPage(page, limit);
        List<Department> listDept = departmentService.selectAll(keyword);
        //封装json数据
        Map<String, Object> resultMap = new HashMap<String, Object>() {
            {
                put("code", 0);
                put("msg", "");
                put("count", countDept.size());
                put("data", listDept);
            }
        };
        return resultMap;
    }
}
经验分享 程序员 微信小程序 职场和发展