——————————DescriptionStart——————————
运行环境 Java≥8、MySQL≥5.7、Tomcat≥8
开发工具 eclipse/idea/myeclipse/sts等均可配置运行
适用 课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb的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版本;
技术栈
后端:Spring SpringMVC MyBatis 2. 前端:JSP+Layui+jQuery
使用说明
使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 将项目中db.properties配置文件中的数据库配置改为自己的配置 3. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,配置tomcat,然后运行; 4. 运行项目,输入localhost:8080/xxx 登录
——————————CodeStart——————————
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 @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 @RequestMapping("/department") public class DepartmentController { @Autowired private IDepartmentService departmentService; @RequestMapping("/deptView") public String employeeView () {
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 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;@Controller @RequestMapping("/download") public class DownloadDocController { @Autowired private IDownloadService downloadService;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 * @ClassName UserContext * @Description : TODO * @Viersion V1.0 .1 */ public class UserContext { public static final String USER_IN_SESSION = "user_in_session" ; private static HttpSession getSession () { return ((ServletRequestAttributes) (RequestContextHolder.getRequestAttributes())).getRequest().getSession(); } public static void setUserInSession (User contextUser) { if (contextUser != null ) { getSession().setAttribute(USER_IN_SESSION, contextUser); } else { getSession().invalidate(); } } public static User getCurrentUser () { return (User) getSession().getAttribute(USER_IN_SESSION); } } package com.iarchie.crm_v1.web.interceptor;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 return "redirect:login.jsp" ; } } package com.iarchie.crm_v1.web.controller;@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) {
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 @Controller public class LoginController { @Autowired private UserMapper mapper; @RequestMapping("/imageCode") public void imgCode (HttpServletRequest request, HttpServletResponse response) throws IOException { BufferedImage bi = new BufferedImage(68 , 22 , BufferedImage.TYPE_INT_RGB); Graphics g = bi.getGraphics(); Color c = new Color(200 , 150 , 255 ); g.setColor(c); g.fillRect(0 , 0 , 68 , 22 ); char [] ch = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" .toCharArray(); Random r = new Random(); int len = ch.length; int 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()); 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); String imgCode1 = (String) session.getAttribute("imgCode" ); System.out.println("user = " + user); if (user == null ) { session.setAttribute("errorMsg" , "账号密码错误!请检查!" ); session.setAttribute("loginname" , loginname);
——————————PayStart——————————
项目链接: https://javayms.github.io?id=141422302105200fv https://javayms.pages.dev?id=141422302105200fv