基于javaweb+mysql的ssm+maven人事crm管理系统(java+ssm+jsp+layui+jquery+mysql)

基于javaweb+mysql的ssm+maven人事crm管理系统(java+ssm+jsp+layui+jquery+mysql)

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

eclipse/idea/myeclipse/sts等均可配置运行

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

基于javaweb+mysql的SSM+Maven人事CRM管理系统(java+ssm+jsp+layui+jquery+mysql)

项目介绍

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 登录
/**
 * 类描述信息 下载中心处理类
 *
 * @ClassName DownloadDocController
 * @Description: TODO
 * @Viersion V1.0.1
 */

@Controller
@RequestMapping("/download")
public class DownloadDocController {

    @Autowired
    private IDownloadService downloadService;

    @RequestMapping("/downloadView")
    public String downView() {

        return "documentFile/fileDoc";
    }

    @RequestMapping("/uploadView")
    public String uploadView() {
        return "documentFile/uploadFile";
    }
}
package com.iarchie.crm_v1.ex;

/**
 * 类描述信息 统一异常处理器
 *
 * @ClassName ExceptionControllerAdvice
 * @Description: TODO
 * @Viersion V1.0.1
 */
    }

    //查询部门所有数据
    @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>() {
            {
            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;
    }
}
package com.iarchie.crm_v1.web.controller;

@Controller
@RequestMapping("/admin")
    //注入mapper
    @Autowired
    private IEmployeeService employeeService;

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

        return "employee/employee";
    }

    @RequestMapping("/empAddView")
    public String employeeAddView() {

        return "employee/employeeAdd";
    }

    //解析json
    private Employee jsonData(String data) {
        //解析前台传递的json数据
        JSONObject json = JSON.parseObject(data);
        if (json != null) {
            //{"name":"测试用户1","sex":"男","phone":"18349857548","email":"[email protected]",
            //"positionId":"2","eduschool":"专科","idcard":"382859958958946","deptId":"1","address":"广州"}
            String name = json.getString("name");
            String sex = json.getString("sex");
            String phone = json.getString("phone");
            String email = json.getString("email");
            String positionId = json.getString("positionId");
            String eduschool = json.getString("eduschool");
            String idcard = json.getString("idcard");
            String deptId = json.getString("deptId");
            String address = json.getString("address");
            Position p = new Position();
            p.setId(Long.parseLong(positionId));
            Department d = new Department();
            d.setId(Long.parseLong(deptId));
            Employee e = new Employee(name, sex, phone, email, p, eduschool,
                    idcard, d, address);
            return e;
        }

        return "documentFile/fileDoc";
    }

    @RequestMapping("/uploadView")
    public String uploadView() {
        return "documentFile/uploadFile";
    }
}
package com.iarchie.crm_v1.ex;

/**
 * 类描述信息 统一异常处理器
 *
 * @ClassName ExceptionControllerAdvice
 * @Description: TODO
 * @Viersion V1.0.1
 */
@ControllerAdvice
public class ExceptionControllerAdvice {
    @ExceptionHandler(Exception.class)
    @ResponseBody
    public String errorView(Exception ex) {

        return "出现异常了" + ex.getMessage();
    }
}
package com.iarchie.crm_v1.web.controller;

@Controller
public class WelcomeController {

    @RequestMapping("/hello")
    public String welcome(){

        return "common/welcome";
            //注销session
            getSession().invalidate();
        }
    }

    //共享给外部调用登入session
    public static User getCurrentUser() {
        return (User) getSession().getAttribute(USER_IN_SESSION);
    }
}
package com.iarchie.crm_v1.web.interceptor;

/**
 * 类描述信息 登入拦截器
 *
 * @ClassName CheckLoginInterceptor
 * @Description: TODO
 * @Viersion V1.0.1
 */
public class CheckLoginInterceptor extends HandlerInterceptorAdapter {

    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        //判断用户是否登入
        if (UserContext.getCurrentUser() == null) {
            response.sendRedirect("login.jsp");
            System.out.println("CheckLoginInterceptor.preHandle" + "----------------未登入------拦截请求--------------->");
            return false;
        }
        return true;
    }
}
package com.iarchie.crm_v1.web.controller;

        String imgCode1 = (String) session.getAttribute("imgCode");
        System.out.println("user = " + user);

        //校验账号密码
        if (user == null) {
            session.setAttribute("errorMsg", "账号密码错误!请检查!");
            session.setAttribute("loginname", loginname);
            // 服务器内部跳转到登录页面
            mv.setViewName("forward:/login.jsp");
            return mv;

            //检验验证码
        } else if (!(imgCode.equalsIgnoreCase(imgCode1))) {
            session.setAttribute("errorMsg", "验证码错误!请重新输入!");
            session.setAttribute("loginname", loginname);
            // 服务器内部跳转到登录页面
            mv.setViewName("forward:/login.jsp");
            return mv;
        } else if (user.getState() == 0) {
            session.setAttribute("errorMsg", user.getLoginname()+"用户被锁定!请联系管理员!");
            session.setAttribute("loginname", loginname);
            // 服务器内部跳转到登录页面
            mv.setViewName("forward:/login.jsp");
            return mv;
        }
        //存储用户登入信息
        UserContext.setUserInSession(user);
        // 客户端跳转到main页面
        mv.setViewName("redirect:/main");
        return mv;
    }

    @RequestMapping("/main")
    public String main() {
        return "main";
    }

    //注销处理
    @RequestMapping("/loginOut")
    public String invalidate(HttpSession session) {
        session.invalidate();
        return "redirect:login.jsp";
    }
}
package com.iarchie.crm_v1.web.controller;

    //登入处理
    @RequestMapping(value = "/login", method = {RequestMethod.POST, RequestMethod.GET})
    public ModelAndView login(@RequestParam("loginname") String loginname, @RequestParam("password") String password,
                              @RequestParam("imgCode") String imgCode, HttpSession session, ModelAndView mv) {
        User user = mapper.selectByLogin(loginname, password);
        //取出session中的验证码
        String imgCode1 = (String) session.getAttribute("imgCode");
        System.out.println("user = " + user);

        //校验账号密码
        if (user == null) {
            session.setAttribute("errorMsg", "账号密码错误!请检查!");
            session.setAttribute("loginname", loginname);
            // 服务器内部跳转到登录页面
            mv.setViewName("forward:/login.jsp");
            return mv;

            //检验验证码
        } else if (!(imgCode.equalsIgnoreCase(imgCode1))) {
            session.setAttribute("errorMsg", "验证码错误!请重新输入!");
            session.setAttribute("loginname", loginname);
            // 服务器内部跳转到登录页面
            mv.setViewName("forward:/login.jsp");
            return mv;
        } else if (user.getState() == 0) {
            session.setAttribute("errorMsg", user.getLoginname()+"用户被锁定!请联系管理员!");
            session.setAttribute("loginname", loginname);
            // 服务器内部跳转到登录页面
            mv.setViewName("forward:/login.jsp");
            return mv;
        }
        //存储用户登入信息
        UserContext.setUserInSession(user);
        // 客户端跳转到main页面
        mv.setViewName("redirect:/main");
        return mv;
    }

    @RequestMapping("/main")
    public String main() {
        return "main";
    }

    //注销处理
    @RequestMapping("/loginOut")
    @Autowired
    private IEmployeeService employeeService;

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

        return "employee/employee";
    }

    @RequestMapping("/empAddView")
    public String employeeAddView() {

        return "employee/employeeAdd";
    }

    //解析json
    private Employee jsonData(String data) {
        //解析前台传递的json数据
        JSONObject json = JSON.parseObject(data);
        if (json != null) {
            //{"name":"测试用户1","sex":"男","phone":"18349857548","email":"[email protected]",
            //"positionId":"2","eduschool":"专科","idcard":"382859958958946","deptId":"1","address":"广州"}
            String name = json.getString("name");
            String sex = json.getString("sex");
            String phone = json.getString("phone");
            String email = json.getString("email");
            String positionId = json.getString("positionId");
            String eduschool = json.getString("eduschool");
            String idcard = json.getString("idcard");
            String deptId = json.getString("deptId");
            String address = json.getString("address");
            Position p = new Position();
            p.setId(Long.parseLong(positionId));
            Department d = new Department();
            d.setId(Long.parseLong(deptId));
            Employee e = new Employee(name, sex, phone, email, p, eduschool,
                    idcard, d, address);
            return e;
        }
        return null;
    }

    //保存数据
    @RequestMapping(value = "/empSave", method = RequestMethod.POST)
    @ResponseBody
    public String employeeSave(@RequestBody JSONObject ob) {
        String data = ob.toJSONString();
        Employee employee = jsonData(data);
        if (employee != null) {
        }
        return "error";
    }

}
package com.iarchie.crm_v1.web.controller;

@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 @ResponseBody
    Map<String, Object> showUserList(@RequestParam("page") int page, @RequestParam("limit") int limit,
                                     String keyword1, String keyword2) {
        System.out.println("keyword1 = " + keyword1);
        System.out.println("keyword2 = " + keyword2);
        //查询结果集对象
        List<User> countData = userService.selectAll(keyword1, keyword2);
        //封装json数据
        Map<String, Object> resultMap = new HashMap<String, Object>();
        //分页
        if (page < 0) {
            page = 1;
            PageHelper.startPage(page, limit);
        }
        List<User> users = userService.selectAll(keyword1, keyword2);
        resultMap.put("code", 0);
        resultMap.put("msg", "");
        //结果总数
        resultMap.put("count", countData.size());
        //结果对象数据
        resultMap.put("data", users);
        return resultMap;
    }

    @RequestMapping("/delete")
    @ResponseBody
    public String delete(@RequestParam("id") Long id) {
        System.out.println("id = " + id);
        int index = userService.deleteByPrimaryKey(id);
        if (index > 0) {
            return "success";
        }
        //删除失败返回error
        return "error";
    }

    @RequestMapping("/update")
    @ResponseBody
    public String update(@RequestBody User user) {
        if (user != null) {
            int index = userService.updateByPrimaryKey(user);
            if (index > 0) {
                return "success";
            }
        }
        return "error";
    }

}
package com.iarchie.crm_v1.web.controller;

    @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>() {
            {
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";
    }

}
package com.iarchie.crm_v1.context;

/**
 * 类描述信息   存储用户登入的Session
 *
            session.setAttribute("loginname", loginname);
            // 服务器内部跳转到登录页面
            mv.setViewName("forward:/login.jsp");
            return mv;
        }
        //存储用户登入信息
        UserContext.setUserInSession(user);
        // 客户端跳转到main页面
        mv.setViewName("redirect:/main");
        return mv;
    }

    @RequestMapping("/main")
    public String main() {
        return "main";
    }

    //注销处理
    @RequestMapping("/loginOut")
    public String invalidate(HttpSession session) {
        session.invalidate();
        return "redirect:login.jsp";
    }
}
package com.iarchie.crm_v1.web.controller;

/**
 * 类描述信息 部门controller类
 *
 * @Viersion V1.0.1
 */
public class CheckLoginInterceptor extends HandlerInterceptorAdapter {

    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        //判断用户是否登入
        if (UserContext.getCurrentUser() == null) {
            response.sendRedirect("login.jsp");
            System.out.println("CheckLoginInterceptor.preHandle" + "----------------未登入------拦截请求--------------->");
            return false;
        }
        return true;
    }
}
package com.iarchie.crm_v1.web.controller;

/**
 * 类描述信息 下载中心处理类
 *
 * @ClassName DownloadDocController
 * @Description: TODO
 * @Viersion V1.0.1
 */

@Controller
@RequestMapping("/download")
public class DownloadDocController {

    @Autowired
    private IDownloadService downloadService;

    @RequestMapping("/downloadView")
    public String downView() {

        return "documentFile/fileDoc";
    }

    public String employeeView() {

        return "employee/employee";
    }

    @RequestMapping("/empAddView")
    public String employeeAddView() {

        return "employee/employeeAdd";
    }

    //解析json
    private Employee jsonData(String data) {
        //解析前台传递的json数据
        JSONObject json = JSON.parseObject(data);
        if (json != null) {
            //{"name":"测试用户1","sex":"男","phone":"18349857548","email":"[email protected]",
            //"positionId":"2","eduschool":"专科","idcard":"382859958958946","deptId":"1","address":"广州"}
            String name = json.getString("name");
            String sex = json.getString("sex");
            String phone = json.getString("phone");
            String email = json.getString("email");
            String positionId = json.getString("positionId");
            String eduschool = json.getString("eduschool");
            String idcard = json.getString("idcard");
            String deptId = json.getString("deptId");
            String address = json.getString("address");
            Position p = new Position();
            p.setId(Long.parseLong(positionId));
            Department d = new Department();
            d.setId(Long.parseLong(deptId));
            Employee e = new Employee(name, sex, phone, email, p, eduschool,
                    idcard, d, address);
            return e;
        }
        return null;
    }

    //保存数据
    @RequestMapping(value = "/empSave", method = RequestMethod.POST)
    @ResponseBody
    public String employeeSave(@RequestBody JSONObject ob) {
        String data = ob.toJSONString();
        Employee employee = jsonData(data);
        if (employee != null) {
            int insert = employeeService.insert(employee);
            if (insert != 0) {
                return "success";
            }
        }
        return "error";
    }

            p.setId(Long.parseLong(positionId));
            Department d = new Department();
            d.setId(Long.parseLong(deptId));
            Employee e = new Employee(name, sex, phone, email, p, eduschool,
                    idcard, d, address);
            return e;
        }
        return null;
    }

    //保存数据
    @RequestMapping(value = "/empSave", method = RequestMethod.POST)
    @ResponseBody
    public String employeeSave(@RequestBody JSONObject ob) {
        String data = ob.toJSONString();
        Employee employee = jsonData(data);
        if (employee != null) {
            int insert = employeeService.insert(employee);
            if (insert != 0) {
                return "success";
            }
        }
        return "error";
    }

    //更新
    @RequestMapping("/empUpdate")
    @ResponseBody
    public String update(@RequestBody JSONObject ob) {
        System.out.println("ob.toJSONString() = " + ob.toJSONString());
        String data = ob.toJSONString();
        Employee employee = jsonData(data);
        if (employee != null) {
            int index = employeeService.updateByPrimaryKey(employee);
            if (index != 0) {
                return "success";
            }
        }
        return "error";
    }

        return resultMap;
    }
}
package com.iarchie.crm_v1.web.controller;

@Controller
@RequestMapping("/admin")
public class UserController {

    @Autowired
    private IUserService userService;

    //加载列表界面
    @RequestMapping("/userView")
    public String showUser() {
        return "user/user";
    }

    //跳转add页面
    @RequestMapping("/addView")
    public String userAddView() {

        return "user/userAdd";
    }

    @RequestMapping(value = "/userAdd", method = RequestMethod.POST)
    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";
    }

}
package com.iarchie.crm_v1.context;

/**
 * 类描述信息   存储用户登入的Session
 *
 * @ClassName UserContext
 * @Description: TODO
 * @Viersion V1.0.1
 */
public class UserContext {

    public static final String USER_IN_SESSION = "user_in_session";

    //获取session对象
    private static HttpSession getSession() {

        return ((ServletRequestAttributes) (RequestContextHolder.getRequestAttributes())).getRequest().getSession();
    }

    //设置用户登入的Session
        /*根据背景画了一个矩形框
         */
        g.setColor(c);//为画布创建背景颜色
        g.fillRect(0, 0, 68, 22); //fillRect:填充指定的矩形

        char[] ch = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".toCharArray();//转化为字符型的数组
        Random r = new Random();
        int len = ch.length;
        int index; //index用于存放随机数字
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < 4; i++) {
            index = r.nextInt(len);//产生随机数字
            g.setColor(new Color(r.nextInt(88), r.nextInt(188), r.nextInt(255)));  //设置颜色
            g.drawString(ch[index] + "", (i * 15) + 3, 18);//画数字以及数字的位置
            sb.append(ch[index]);
        }
        request.getSession().setAttribute("imgCode", sb.toString()); //将数字保留在session中,便于后续的使用
        ImageIO.write(bi, "JPG", response.getOutputStream());
    }

    //登入处理
    @RequestMapping(value = "/login", method = {RequestMethod.POST, RequestMethod.GET})
    public ModelAndView login(@RequestParam("loginname") String loginname, @RequestParam("password") String password,
                              @RequestParam("imgCode") String imgCode, HttpSession session, ModelAndView mv) {
        User user = mapper.selectByLogin(loginname, password);
        //取出session中的验证码
        String imgCode1 = (String) session.getAttribute("imgCode");
        System.out.println("user = " + user);

        //校验账号密码
        if (user == null) {
            session.setAttribute("errorMsg", "账号密码错误!请检查!");
            session.setAttribute("loginname", loginname);
            // 服务器内部跳转到登录页面
            mv.setViewName("forward:/login.jsp");
            return mv;

            //检验验证码
        } else if (!(imgCode.equalsIgnoreCase(imgCode1))) {
            session.setAttribute("errorMsg", "验证码错误!请重新输入!");
            session.setAttribute("loginname", loginname);
        return true;
    }
}
package com.iarchie.crm_v1.web.controller;

/**
 * 类描述信息 下载中心处理类
 *
 * @ClassName DownloadDocController
 * @Description: TODO
 * @Viersion V1.0.1
 */

@Controller
@RequestMapping("/download")
public class DownloadDocController {

    @Autowired
    private IDownloadService downloadService;

    @RequestMapping("/downloadView")
    public String downView() {

        return "documentFile/fileDoc";
    }

    @RequestMapping("/uploadView")
    public String uploadView() {
        return "documentFile/uploadFile";
    }
}
package com.iarchie.crm_v1.ex;

        return "error";
    }

    @RequestMapping("/update")
    @ResponseBody
    public String update(@RequestBody User user) {
        if (user != null) {
            int index = userService.updateByPrimaryKey(user);
            if (index > 0) {
                return "success";
            }
        }
        return "error";
    }

}
package com.iarchie.crm_v1.web.controller;

@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);
            String email = json.getString("email");
            String positionId = json.getString("positionId");
            String eduschool = json.getString("eduschool");
            String idcard = json.getString("idcard");
            String deptId = json.getString("deptId");
            String address = json.getString("address");
            Position p = new Position();
            p.setId(Long.parseLong(positionId));
            Department d = new Department();
            d.setId(Long.parseLong(deptId));
            Employee e = new Employee(name, sex, phone, email, p, eduschool,
                    idcard, d, address);
            return e;
        }
        return null;
    }

    //保存数据
    @RequestMapping(value = "/empSave", method = RequestMethod.POST)
    @ResponseBody
    public String employeeSave(@RequestBody JSONObject ob) {
        String data = ob.toJSONString();
        Employee employee = jsonData(data);
        if (employee != null) {
            int insert = employeeService.insert(employee);
            if (insert != 0) {
                return "success";
            }
        }
        return "error";
    }

    //更新
    @RequestMapping("/empUpdate")
    @ResponseBody
    public String update(@RequestBody JSONObject ob) {
        System.out.println("ob.toJSONString() = " + ob.toJSONString());
        String data = ob.toJSONString();
        Employee employee = jsonData(data);
        if (employee != null) {
            int index = employeeService.updateByPrimaryKey(employee);
            if (index != 0) {
                return "success";
            }
        }
        return "error";
        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";
    }

}
package com.iarchie.crm_v1.context;

/**
 * 类描述信息   存储用户登入的Session
 *
 * @ClassName UserContext
 * @Description: TODO
 * @Viersion V1.0.1
 */
public class UserContext {

    public static final String USER_IN_SESSION = "user_in_session";

    //获取session对象
    private static HttpSession getSession() {

        return ((ServletRequestAttributes) (RequestContextHolder.getRequestAttributes())).getRequest().getSession();
    }

    //设置用户登入的Session
    public static void setUserInSession(User contextUser) {
        if (contextUser != null) {
            //保存session
            getSession().setAttribute(USER_IN_SESSION, contextUser);
@RequestMapping("/download")
public class DownloadDocController {

    @Autowired
    private IDownloadService downloadService;

    @RequestMapping("/downloadView")
    public String downView() {

        return "documentFile/fileDoc";
    }

    @RequestMapping("/uploadView")
    public String uploadView() {
        return "documentFile/uploadFile";
    }
}
package com.iarchie.crm_v1.ex;

/**
 * 类描述信息 统一异常处理器
 *
 * @ClassName ExceptionControllerAdvice
 * @Description: TODO
 * @Viersion V1.0.1
 */
@ControllerAdvice
public class ExceptionControllerAdvice {
    @ExceptionHandler(Exception.class)
    @ResponseBody
    public String errorView(Exception ex) {

        return "出现异常了" + ex.getMessage();
    @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);
        //查询结果集

基于javaweb+mysql的ssm+maven人事crm管理系统(java+ssm+jsp+layui+jquery+mysql)_第1张图片
基于javaweb+mysql的ssm+maven人事crm管理系统(java+ssm+jsp+layui+jquery+mysql)_第2张图片
基于javaweb+mysql的ssm+maven人事crm管理系统(java+ssm+jsp+layui+jquery+mysql)_第3张图片
基于javaweb+mysql的ssm+maven人事crm管理系统(java+ssm+jsp+layui+jquery+mysql)_第4张图片
基于javaweb+mysql的ssm+maven人事crm管理系统(java+ssm+jsp+layui+jquery+mysql)_第5张图片

基于javaweb+mysql的ssm+maven人事crm管理系统(java+ssm+jsp+layui+jquery+mysql)_第6张图片
基于javaweb+mysql的ssm+maven人事crm管理系统(java+ssm+jsp+layui+jquery+mysql)_第7张图片

你可能感兴趣的:(java,mysql,maven)