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

本文介绍了一个基于Spring、MyBatis的Java项目,涵盖部门和公告管理功能,包括用户查询、添加、删除操作,以及数据分页和CRUD操作。通过该项目学习数据库管理、前端展示和SpringMVC应用。
摘要由CSDN通过智能技术生成

作者主页:夜未央5788

 简介:Java领域优质创作者、Java项目、学习资料、技术互助

文末获取源码

项目介绍

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;
    }
}

公告管理控制器

@Controller
@RequestMapping("/notice")
public class NoticeController {

    @Autowired
    private IDocTestService docTestService;

    @RequestMapping("/noticeView")
    public String noticeView(Model model, Integer pageIndex) {
        int pageSize = 5;//每页显示的记录数
        if (pageIndex == null)
            pageIndex = 1;//第一次访问页面默认页面为第一页
        PageHelper.startPage(pageIndex, pageSize);
        List<DocTest> docTests = docTestService.selectAll();
        //得到分页的结果对象
        PageInfo<DocTest> personPageInfo = new PageInfo<>(docTests);
        //得到分页中的person条目对象
        List<DocTest> pageList = personPageInfo.getList();
        model.addAttribute("docList", pageList);
        model.addAttribute("page", personPageInfo);
        return "notice/notice";
    }


    @RequestMapping("/addView")
    public String updateOrAddView() {
        return "notice/noticeAddOrUpdate";
    }

}

位置管理控制器

@Controller
@RequestMapping("/position")
public class PositionController {


    //注入业务层
    @Autowired
    private IPositionService positionService;

    @RequestMapping("/positionView")
    public String showPosition() {

        return "position/position";
    }

    //删除
    @RequestMapping(value = "/positionDelete", method = RequestMethod.GET)
    @ResponseBody
    public String delete(@RequestParam("id") Long id) {
        System.out.println("id = " + id);
        int index = positionService.deleteByPrimaryKey(id);
        if (index > 0) {
            return "success";
        }
        return "error";
    }

    //添加
    @RequestMapping(value = "/positionAdd", method = RequestMethod.POST)
    @ResponseBody
    public String positionAdd(@RequestBody Position position) {
        int insert = positionService.insert(position);
        if (insert > 0) {
            return "success";
        }
        return "error";
    }

    @RequestMapping("/positionOption")
    @ResponseBody
    public List<Position> positionOption(String keyword) {
        List<Position> positions = positionService.selectAll(keyword);
        return positions;
    }

    @RequestMapping(value = "/addView")
    public String positionAddView() {

        return "position/positionAdd";
    }

    @RequestMapping(value = "/positionList",method = RequestMethod.GET)
    public @ResponseBody
    Map<String, Object> positionList(@RequestParam("page") int page, @RequestParam("limit") int limit,
                                     String keyword) {
        System.out.println("keyword = " + keyword);
        //查询结果集
        List<Position> countPos = positionService.selectAll(keyword);
        //处理分页
        if (page < 0) {
            page = 1;
        }
        PageHelper.startPage(page, limit);
        List<Position> resultData = positionService.selectAll(keyword);
        //封装列表数据
        Map<String, Object> resultMap = new HashMap<String, Object>() {
            {
                put("code", 0);
                put("msg", "");
                put("count", countPos.size());
                put("data", resultData);
            }
        };
        return resultMap;
    }


}

如果也想学习本系统,下面领取。关注并回复:056ssm 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

夜未央5788

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值