博主主页:猫头鹰源码
博主简介:Java领域优质创作者、博客专家、公司架构师、全网粉丝5万+、专注Java技术领域和毕业设计项目实战
主要内容:毕业设计(Javaweb项目|小程序等)、简历模板、学习资料、面试题库、技术咨询
项目介绍:
本系统原创项目,采用springboot框架,数据层采用mybatis,数据库使用mysql,适合选题:工资、工资管理等。
项目功能:
本系统是一个管理系统,主要分为两个角色,分别为管理员、员工,不同角色的功能如下:
登录注册:管理员和员工分别有不同的登录注册页面
个人信息:员工登录后,可以在个人信息管理中修改自己的信息。
员工管理:管理员可以进入新增员工,也可以修改或者删除员工信息,员工注册后也会将信息写入员工表中。
部门管理:这是管理员维护部门的界面,管理员可以增删改查部门信息。
工资管理:管理员登录后,可以下发每个人的工资信息,员工登录后进入工资管理,可以查看自己的工资情况。
请假管理:管理员进行查看审批,员工可以申请请假
考勤打卡:管理员查看考勤情况,员工可以进行考勤
统计管理:主要对每个员工的工资进行统计,以及对部门人数统计。
管理员管理:主要是管理员维护管理员的页面。
系统包含技术:
技术:springboot,mybatis,前端框架h-ui
开发工具:eclipse,idea都可运行
数据库:mysql 5.7
JDK版本:jdk1.8
部分截图说明:
下面是登录页面
管理员首页
管理员对员工进行维护
管理员工资管理
管理员请假审批
管理员考勤打卡
管理员查看部门人数统计
管理员个人工资查看
员工登录
员工查看工资
员工考勤打卡
员工请假申请
部分代码:
员工操作
@Autowired(required=false)
private DepartmentService departmentService;
/*
* @description: 跳转到首页
* @param request
* @param model
* @return: java.lang.String
* @author: mty
* @time: 2020/02/03 23:08
*/
@RequestMapping("/employIndex")
public String employIndex(HttpServletRequest request,Model model) throws Exception{
HttpSession session = request.getSession();
if(session.getAttribute("name") == null || session.getAttribute("password") == null){
session.setAttribute("msg", "对不起,请登录!");
return "common/adminLogin";
}
String name = session.getAttribute("name").toString();
String password = session.getAttribute("password").toString();
List<Employ> employList = employService.queryByAll();
int total = employList.size();
model.addAttribute("employList", employList);
model.addAttribute("total", total);
model.addAttribute("name", name);
model.addAttribute("password", password);
return "employ/index";
}
/*
* @description: 员工进入跳转到首页
* @param request
* @param model
* @return: java.lang.String
* @author: mty
* @time: 2020/02/03 23:08
*/
@RequestMapping("/employIndex1")
public String employIndex1(HttpServletRequest request,Model model) throws Exception{
HttpSession session = request.getSession();
if(session.getAttribute("name") == null || session.getAttribute("password") == null){
session.setAttribute("msg", "对不起,请登录!");
return "common/adminLogin";
}
String name = session.getAttribute("name").toString();
String password = session.getAttribute("password").toString();
Employ ee = employService.queryByOne(name,password);
List<Employ> employList = new ArrayList<Employ>();
employList.add(ee);
int total = employList.size();
model.addAttribute("employList", employList);
model.addAttribute("total", total);
model.addAttribute("name", name);
model.addAttribute("password", password);
return "employ/index1";
}
/*
* @description:进入修改
* @param id
* @param model
* @return: org.springframework.web.servlet.ModelAndView
* @author: mty
* @time: 2020/02/03 23:10
*/
@RequestMapping("/employEdit/{id}")
public ModelAndView employEdit(@PathVariable("id") String id,Model model) throws Exception{
ModelAndView mv = new ModelAndView();
Employ employ = employService.queryById(id);
List<Department> departmentList = departmentService.queryByAll();
model.addAttribute("employ", employ);
model.addAttribute("departmentList", departmentList);
mv.setViewName("employ/edit");
return mv;
}
/*
* @description:确认修改
* @param employ
* @param model
* @param request
* @return: java.lang.String
* @author: mty
* @time: 2020/02/03 23:11
*/
@RequestMapping("/employEditSubmit")
public String employEditSubmit(Employ employ,Model model,HttpServletRequest request) throws Exception{
try{
Department d = departmentService.queryById(employ.getDepartmentid());
employ.setDepartment(d.getName());
employService.update(employ);
request.setAttribute("msg", "修改成功!");
return "employ/edit";
}catch (Exception e){
request.setAttribute("msg", "修改失败!");
return "employ/edit";
}
}
/*
* @description:进入添加
* @param model
* @param request
* @return: java.lang.String
* @author: mty
* @time: 2020/02/03 23:11
*/
@RequestMapping("/employAdd")
public String employAdd(Model model,HttpServletRequest request) throws Exception{
List<Department> departmentList = departmentService.queryByAll();
model.addAttribute("departmentList", departmentList);
return "employ/add";
}
/*
* @description:确认增加
* @param employ
* @param model
* @param request
* @return: java.lang.String
* @author: mty
* @time: 2020/02/03 23:12
*/
@RequestMapping("/employAddSub")
public String employAddSub(Employ employ,Model model,HttpServletRequest request) throws Exception{
try{
HttpSession session = request.getSession();
if(session.getAttribute("name") == null || session.getAttribute("id") == null){
session.setAttribute("msg", "对不起,请登录!");
return "common/adminLogin";
}
Department d = departmentService.queryById(employ.getDepartmentid());
employ.setDepartment(d.getName());
employService.addSelect(employ);
request.setAttribute("msg", "添加成功!");
return "employ/add";
}catch (Exception e){
request.setAttribute("msg", "添加失败!");
return "employ/add";
}
}
/*
* @description:根据ID删除
* @param id
* @param reuqest
* @param model
* @return: org.springframework.web.servlet.ModelAndView
* @author: mty
* @time: 2020/02/03 23:12
*/
@RequestMapping("/employDel/{id}")
public ModelAndView employDel(@PathVariable("id") String id,HttpServletRequest reuqest, Model model) throws Exception{
ModelAndView mv = new ModelAndView();
employService.deleteById(id);
mv.setViewName("employ/index");
return mv;
}
/*
* @description:统计每个部门人数
* @author: mty
* @time: 2020/02/03 23:12
*/
@RequestMapping("/employStatic")
public ModelAndView employStatic(Model model) throws Exception{
ModelAndView mv = new ModelAndView();
List<Employ> list = employService.queryStatic();
List<Department> de = departmentService.queryByAll();
for(int i=0;i<de.size();i++){
boolean flag = true;
for(int j = 0;j<list.size();j++){
if(de.get(i).getId().equals(list.get(j).getDepartmentid())){
flag = false;
}
}
if(flag){
Employ employs = new Employ();
employs.setDepartment(de.get(i).getName());
employs.setDepartmentid(de.get(i).getId());
employs.setCount(0);
list.add(employs);
}
}
List<Integer> data = new ArrayList<Integer>();
List<String> str = new ArrayList<String>();
for(int i = 0;i<list.size();i++){
data.add(list.get(i).getCount());
str.add(list.get(i).getDepartment());
}
model.addAttribute("data", data);
model.addAttribute("str", str);
model.addAttribute("size", list.size());
mv.setViewName("static/index");
return mv;
}
员工登录
/*
* @description:员工登录校验
* @param name
* @param password
* @param type
* @param request
* @return: org.springframework.web.servlet.ModelAndView
* @author: mty
* @time: 2020/02/03 11:22
*/
@RequestMapping("/employSubmit")
public ModelAndView studentSubmit(String name, String password,HttpServletRequest request) throws Exception{
HttpSession session = request.getSession();
ModelAndView modelAndView = new ModelAndView();
Employ list = employService.queryByOne(name,password);
if(list == null) {
request.setAttribute("msg", "对不起,用户不存在,请重试!");
modelAndView.setViewName("common/login");
return modelAndView;
}else {
Employ employ = list;
List<Employ> elist = employService.queryByAll();
for(int i=0;i<elist.size();i++){
if( !(employ.getName().equals(elist.get(i).getName()) && employ.getPassword().equals(elist.get(i).getPassword()))){
if(employ.getNo().equals(elist.get(i).getNo())){
request.setAttribute("msg", "对不起,工号重复,请重试!");
modelAndView.setViewName("common/login");
return modelAndView;
}
}
}
session.setAttribute("name", name);
session.setAttribute("id", employ.getId());
session.setAttribute("no", employ.getNo());
session.setAttribute("password", password);
session.setAttribute("department", employ.getDepartment());
session.setAttribute("image", employ.getImage());
modelAndView.setViewName("index1");
return modelAndView;
}
}
以上就是部分功能展示,从整体上来看,本系统功能是十分完整的,界面设计简洁大方,交互友好,数据库设计也很合理,规模适中,代码工整,清晰,适合学习使用。
好了,今天就到这儿吧,小伙伴们点赞、收藏、评论,一键三连走起呀,下期见~~