项目介绍
ssm人事管理系统。主要功能有:
用户管理:用户查询、添加用户;
部门管理:部门查询、添加部门;
职位管理:职位查询、添加职位;
员工管理:员工查询、添加员工;
公告管理:公告查询、添加公告;
下载中心:文档查询、上传文档;
环境需要
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
- 前端:ligerUI+jquery+metronic+jsp
使用说明
- 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
- 将项目中db.properties配置文件中的数据库配置改为自己的配置
- 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;
若为maven项目,导入成功后请执行maven clean;maven install命令,配置tomcat,然后运行; - 运行项目,输入localhost:8080/ 登录
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
rainservice.update_UserInfo(user);
session.setAttribute(Constants.USER_SESSION, user);
mv.setViewName("redirect:/user/myupdate");
return mv;
}
}
员工管理控制层:
@Controller
public class EmployeeController {
@Autowired
@Qualifier("RainService")
private RainService rainservice;
// 如果在目录下输入为空,则跳转到指定链接
@RequestMapping(value="/employee/")
@RequestMapping(value="/dept/add",method=RequestMethod.POST)
public ModelAndView add(ModelAndView mv,@ModelAttribute Dept dept ,Integer id){
System.out.println(id);
// System.out.println(dept.getId());
if(id!=null){
rainservice.update_Info(dept);
System.out.println(dept.getId());
}else{
rainservice.addDept(dept);
}
// System.out.println(dept.getName());
mv.setViewName("redirect:/dept/list");
return mv;
}
@RequestMapping(value="/dept/delete",method=RequestMethod.GET)
public void delete(Integer id){
}
@RequestMapping(value="/dept/add",method=RequestMethod.POST)
public ModelAndView add(ModelAndView mv,@ModelAttribute Dept dept ,Integer id){
System.out.println(id);
// System.out.println(dept.getId());
if(id!=null){
rainservice.update_Info(dept);
System.out.println(dept.getId());
}else{
rainservice.addDept(dept);
}
// System.out.println(dept.getName());
mv.setViewName("redirect:/dept/list");
return mv;
}
@RequestMapping(value="/dept/delete",method=RequestMethod.GET)
public void delete(Integer id){
System.out.println(id);
if(id!=null){
rainservice.delete_Info(id);
}
}
}
用户管理控制层:
@Controller
public class UserController {
}
}
// 管理员自己修改密码时跳转的页面
@RequestMapping(value="/user/myupdate",method=RequestMethod.GET)
public String update(Model model,HttpSession session){
User user = (User) session.getAttribute(Constants.USER_SESSION);
model.addAttribute("job",user);
return "/user/myupdate";
}
@RequestMapping(value="/user/myupdate",method=RequestMethod.POST)
public ModelAndView update(ModelAndView mv,Model model,HttpSession session,User notice){
User user = (User) session.getAttribute(Constants.USER_SESSION);
// 如果是自己修改自己的密码,则更新session
user.setLoginname(notice.getLoginname());
// System.out.println(id);
if(id!=null){
Dept dept = rainservice.get_Info(id);
model.addAttribute("dept",dept);
// System.out.println(dept.getName());
}
return "/dept/add";
}
@RequestMapping(value="/dept/add",method=RequestMethod.POST)
public ModelAndView add(ModelAndView mv,@ModelAttribute Dept dept ,Integer id){
System.out.println(id);
// System.out.println(dept.getId());
if(id!=null){
rainservice.update_Info(dept);
System.out.println(dept.getId());
}else{
rainservice.addDept(dept);
}
// System.out.println(dept.getName());
mv.setViewName("redirect:/dept/list");
return mv;
}
@RequestMapping(value="/dept/delete",method=RequestMethod.GET)
public void delete(Integer id){
System.out.println(id);
// 将用户保存到HttpSession当中
System.out.println("HttpSession");
session.setAttribute(Constants.USER_SESSION, user);
session.setAttribute("tip", "1");
// 客户端跳转到main页面
mv.setViewName("redirect:/index");
}else{
// 设置登录失败提示信息
System.out.println("设置登录失败提示信息");
mv.addObject("message", "登录名或密码错误!请重新输入");
// 服务器内部跳转到登录页面
mv.setViewName("forward:/loginForm");
}
}else {
Employee user = rainservice.login2(loginname, password);
// return formName;
String blank = "/dept/list";
return blank;
}
@RequestMapping(value="/dept/list",method=RequestMethod.GET)
public String index(Model model,String content){
// System.out.println("4234");
List<Dept> dept_list = rainservice.findAllDept();
if (content!=null){
dept_list = rainservice.findAllDept(content);
}
model.addAttribute("list",dept_list);
// for(Dept attribute : dept_list) {
// System.out.println(attribute.getName());
// }
return "dept/list";
}
@RequestMapping(value="/dept/add",method=RequestMethod.GET)
@RequestMapping(value="/dept/{formName}")
public String index2(@PathVariable String formName){
// return formName;
String blank = "/dept/list";
return blank;
}
@RequestMapping(value="/dept/list",method=RequestMethod.GET)
public String index(Model model,String content){
// System.out.println("4234");
List<Dept> dept_list = rainservice.findAllDept();
if (content!=null){
dept_list = rainservice.findAllDept(content);
}
model.addAttribute("list",dept_list);
// for(Dept attribute : dept_list) {
// System.out.println(attribute.getName());
// }
public String add(Model model,Integer id){
if(id!=null){
Employee employee = rainservice.get_EmployeeInfo(id);
model.addAttribute("job",employee);
}
List<Dept> dept_list = rainservice.findAllDept();
List<Job> job_list = rainservice.findAllJob();
model.addAttribute("job_list", job_list);
model.addAttribute("dept_list",dept_list);
return "/employee/add";
}
@RequestMapping(value="/employee/add",method=RequestMethod.POST)
public ModelAndView add(ModelAndView mv,@ModelAttribute Employee job ,Integer id){
// System.out.println(id);
if(id!=null){
rainservice.update_EmployeeInfo(job);
}else{
// 设置登录失败提示信息
System.out.println("设置登录失败提示信息");
mv.addObject("message", "登录名或密码错误!请重新输入");
// 服务器内部跳转到登录页面
mv.setViewName("forward:/loginForm");
}
}
return mv;
}
// 如果在目录下输入任何不存在的参数,则跳转到list
@RequestMapping(value="/user/{formName}")
public String index2(@PathVariable String formName){
String blank = "/user/list";
return blank;
}
@RequestMapping(value="/user/list",method=RequestMethod.GET)
public String index(Model model,String content){
List<User> job_list = rainservice.get_UserList();
if (content!=null){
job_list = rainservice.get_UserLikeList(content);
}
model.addAttribute("list",job_list);
return "user/list";
}
@RequestMapping(value="/user/add",method=RequestMethod.GET)
public String add(Model model,Integer id){
model.addAttribute("dept",dept);
// System.out.println(dept.getName());
}
return "/dept/add";
}
@RequestMapping(value="/dept/add",method=RequestMethod.POST)
public ModelAndView add(ModelAndView mv,@ModelAttribute Dept dept ,Integer id){
System.out.println(id);
// System.out.println(dept.getId());
if(id!=null){
rainservice.update_Info(dept);
System.out.println(dept.getId());
}else{
rainservice.addDept(dept);
}
// System.out.println(dept.getName());
mv.setViewName("redirect:/dept/list");
return mv;
}
@RequestMapping(value="/dept/delete",method=RequestMethod.GET)
public void delete(Integer id){
System.out.println(id);
if(id!=null){
rainservice.delete_Info(id);
}