基于javaweb+mysql的ssm+maven简单院校教师工资管理系统(java+ssm+bootstrap+jsp+mysql)
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb+mysql的SSM+Maven简单院校教师工资管理系统(java+ssm+bootstrap+jsp+mysql)
项目介绍
院系管理员角色包含以下功能: 院系管理员首页,修改本院教师的工资信息,添加教师和教师薪资等功能。
管理员角色包含以下功能: 管理员首页,修改管理员信息,添加管理员,查找管理员,登陆页面等功能。 教师角色包含以下功能: 查看个人薪资等功能。
环境需要
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.数据库:MySql 5.7版本; 6.是否Maven项目:是;
技术栈
- 后端:Spring+SpringMVC+Mybatis 2. 前端:JSP+CSS+JavaScript+jquery+bootstrap
使用说明
- 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven; 若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中db.properties配置文件中的数据库配置改为自己的配置; 4. 运行项目,输入localhost:8080/ssm_hhxy_system 登录
@ResponseBody
public Msg updateTeacher(Teacher teacher) {
boolean result = teacherService.updateOne(teacher);
if (result) {
return Msg.success();
}else {
return Msg.fail();
}
}
//addTeacher
@RequestMapping(value="/addTeacher")
@ResponseBody
public Msg addTeacher(@RequestBody Teacher teacher) {
teacher = teacherService.addOne(teacher);
return Msg.success().add("newteacher", teacher);
}
//delteacherById
@RequestMapping(value="/delTeacherById/{ids}", method=RequestMethod.DELETE)
@ResponseBody
public Msg delteacherById(@PathVariable("ids")String ids) {
int result = teacherService.delTeacherById(Integer.parseInt(ids));
if (result > 0) {
return Msg.success();
}
return Msg.fail();
}
}
@Controller
public class DepartmentController {
}
if (result > 0) {
return Msg.success();
}
return Msg.fail();
}
}
@Controller
public class UserController {
@Autowired
ManagerService managerService;
@Autowired
TeacherService teacherService;
@Autowired
SuperService superService;
@RequestMapping(value = "/check", method = RequestMethod.POST)
public String check(User user, Model model, HttpSession session) {
Integer u = user.getU();
System.out.println("userid = " + user.getUserId());
//1代表超级管理员,2代表院系管理员,3代表教师
if (u == 1) {
SuperManager m = superService.login(user);
if (m == null) {
model.addAttribute("msg", "账号或密码错误");
return "login";
} else {
session.setAttribute("USER", m);
return "super";
}
}
if (u == 2) {
Manager m = managerService.login(user);
/**
* 查询管理员分页查询
* @return
*/
// @RequestMapping(value="/managers")
public String getManager(@RequestParam(value="pn", defaultValue="1")Integer pn, Model model) {
PageHelper.startPage(pn, 5);
List managers = managerService.getAll();
PageInfo pageInfo = new PageInfo(managers, 3);
model.addAttribute("pageInfo", pageInfo);
return "list_m";
}
@RequestMapping(value="/managers")
@ResponseBody
public Msg getManagerWithJson(@RequestParam(value="pn", defaultValue="1")Integer pn) {
PageHelper.startPage(pn, 5);
List managers = managerService.getAll();
PageInfo pageInfo = new PageInfo(managers, 3);
return Msg.success().add("pageInfo", pageInfo);
}
@RequestMapping(value="/searchM")
@ResponseBody
public Msg selectManagers(@RequestBody Manager m) {
System.out.println(m.getPn());
if (m.getPn() == null) {
m.setPn(1);
}
PageHelper.startPage(m.getPn(), 5);
List<Manager> managers = managerService.selectManagers(m);
PageInfo pageInfo = new PageInfo(managers, 3);
if (managers == null) {
return Msg.success().add("pageInfo", "isNull");
}
return Msg.success().add("pageInfo", pageInfo);
}
@RequestMapping(value="/addManager")
@ResponseBody
public Msg addManager(@RequestBody Manager manager) {
manager = managerService.addOne(manager);
return Msg.success().add("newManager", manager);
}
@RequestMapping(value="/updateManager/{id}", method=RequestMethod.PUT)
@RequestMapping("/teachers")
@ResponseBody
public Msg getTeachers(@RequestParam(value="pn", defaultValue="1")Integer pn) {
PageHelper.startPage(pn, 5);
List teachers = teacherService.getAll();
PageInfo pageInfo = new PageInfo(teachers, 3);
return Msg.success().add("pageInfo", pageInfo);
}
@RequestMapping(value="/updateTeacher/{id}", method=RequestMethod.PUT)
@ResponseBody
public Msg updateTeacher(Teacher teacher) {
boolean result = teacherService.updateOne(teacher);
if (result) {
return Msg.success();
}else {
return Msg.fail();
}
}
//addTeacher
@RequestMapping(value="/addTeacher")
@ResponseBody
public Msg addTeacher(@RequestBody Teacher teacher) {
teacher = teacherService.addOne(teacher);
return Msg.success().add("newteacher", teacher);
}
//delteacherById
@RequestMapping(value="/delTeacherById/{ids}", method=RequestMethod.DELETE)
@ResponseBody
public Msg delteacherById(@PathVariable("ids")String ids) {
int result = teacherService.delTeacherById(Integer.parseInt(ids));
if (result > 0) {
return Msg.success();
}
return Msg.fail();
}
}
public Msg delManagerById(@PathVariable("ids")String ids) {
int result = 0;
if (ids.contains("-")) {
result = managerService.delBatch(ids);
}else {
result = managerService.delManagerById(Integer.parseInt(ids));
}
if (result > 0) {
return Msg.success();
}
return Msg.fail();
}
}
@Controller
public class UserController {
@Autowired
ManagerService managerService;
@Autowired
TeacherService teacherService;
@Autowired
SuperService superService;
@RequestMapping(value = "/check", method = RequestMethod.POST)
public String check(User user, Model model, HttpSession session) {
Integer u = user.getU();
System.out.println("userid = " + user.getUserId());
@Controller
public class ManagerController {
@Autowired
ManagerService managerService;
/**
* 查询管理员分页查询
* @return
*/
// @RequestMapping(value="/managers")
public String getManager(@RequestParam(value="pn", defaultValue="1")Integer pn, Model model) {
PageHelper.startPage(pn, 5);
List managers = managerService.getAll();
PageInfo pageInfo = new PageInfo(managers, 3);
model.addAttribute("pageInfo", pageInfo);
return "list_m";
}
@RequestMapping(value="/managers")
@ResponseBody
public Msg getManagerWithJson(@RequestParam(value="pn", defaultValue="1")Integer pn) {
PageHelper.startPage(pn, 5);
List managers = managerService.getAll();
PageInfo pageInfo = new PageInfo(managers, 3);
return Msg.success().add("pageInfo", pageInfo);
}
@RequestMapping(value="/searchM")
@ResponseBody
public Msg selectManagers(@RequestBody Manager m) {
System.out.println(m.getPn());
if (m.getPn() == null) {
m.setPn(1);
}
PageHelper.startPage(m.getPn(), 5);
List<Manager> managers = managerService.selectManagers(m);
if (m == null) {
model.addAttribute("msg", "账号或密码错误");
return "login";
} else {
session.setAttribute("USER", m);
return "teacher";
}
}
model.addAttribute("msg", "账号或密码错误");
return "login";
}
@RequestMapping("/toRegister")
public String toRegister() {
return "register";
}
@RequestMapping("/register")
public String register(Teacher teacher, Model model, HttpSession session) {
System.out.println("controller " + teacher.getTeacherEmail());
Boolean flag = teacherService.insert(teacher);
if (flag) {
return "login";
} else {
model.addAttribute("msg", "注册失败");
return "register";
}
}
@RequestMapping("/toLogin")
public String toLogin() {
return "login";
}
}
}
@RequestMapping(value="/searchM")
@ResponseBody
public Msg selectManagers(@RequestBody Manager m) {
System.out.println(m.getPn());
if (m.getPn() == null) {
m.setPn(1);
}
PageHelper.startPage(m.getPn(), 5);
List<Manager> managers = managerService.selectManagers(m);
PageInfo pageInfo = new PageInfo(managers, 3);
if (managers == null) {
return Msg.success().add("pageInfo", "isNull");
}
return Msg.success().add("pageInfo", pageInfo);
}
@RequestMapping(value="/addManager")
@ResponseBody
public Msg addManager(@RequestBody Manager manager) {
manager = managerService.addOne(manager);
return Msg.success().add("newManager", manager);
}
@RequestMapping(value="/updateManager/{id}", method=RequestMethod.PUT)
@ResponseBody
public Msg updateManager(Manager manager) {
boolean result = managerService.updateOne(manager);
if (result) {
return Msg.success();
}else {
return Msg.fail();
}
}
/**
* 1-1-1 批量删除
* 1 删除一条记录
* @param ids
* @return
*/
@RequestMapping(value="/delManagerById/{ids}", method=RequestMethod.DELETE)
@ResponseBody
public Msg delManagerById(@PathVariable("ids")String ids) {
int result = 0;
if (ids.contains("-")) {
result = managerService.delBatch(ids);
@RequestMapping("/toRegister")
public String toRegister() {
return "register";
}
@RequestMapping("/register")
public String register(Teacher teacher, Model model, HttpSession session) {
System.out.println("controller " + teacher.getTeacherEmail());
Boolean flag = teacherService.insert(teacher);
if (flag) {
return "login";
} else {
model.addAttribute("msg", "注册失败");
return "register";
}
}
@RequestMapping("/toLogin")
public String toLogin() {
return "login";
}
}
}
@Controller
public class TeacherController {
@Autowired
TeacherService teacherService;
@RequestMapping("/teachers")
@ResponseBody
public Msg getTeachers(@RequestParam(value="pn", defaultValue="1")Integer pn) {
PageHelper.startPage(pn, 5);
List teachers = teacherService.getAll();
PageInfo pageInfo = new PageInfo(teachers, 3);
return Msg.success().add("pageInfo", pageInfo);
}
@RequestMapping(value="/updateTeacher/{id}", method=RequestMethod.PUT)
@ResponseBody
public Msg updateTeacher(Teacher teacher) {
boolean result = teacherService.updateOne(teacher);
if (result) {
return Msg.success();
}else {
return Msg.fail();
}
}
//addTeacher
@RequestMapping(value="/addTeacher")
@ResponseBody
public Msg addTeacher(@RequestBody Teacher teacher) {
@Controller
public class TeacherController {
@Autowired
TeacherService teacherService;
@RequestMapping("/teachers")
@ResponseBody
public Msg getTeachers(@RequestParam(value="pn", defaultValue="1")Integer pn) {
PageHelper.startPage(pn, 5);
List teachers = teacherService.getAll();
PageInfo pageInfo = new PageInfo(teachers, 3);
return Msg.success().add("pageInfo", pageInfo);
}
@RequestMapping(value="/updateTeacher/{id}", method=RequestMethod.PUT)
@ResponseBody
public Msg updateTeacher(Teacher teacher) {
boolean result = teacherService.updateOne(teacher);
if (result) {
return Msg.success();
}else {
return Msg.fail();
}
}
//addTeacher
@RequestMapping(value="/addTeacher")
@ResponseBody
public Msg addTeacher(@RequestBody Teacher teacher) {
teacher = teacherService.addOne(teacher);
return Msg.success().add("newteacher", teacher);
}
//delteacherById
@RequestMapping(value="/delTeacherById/{ids}", method=RequestMethod.DELETE)
@ResponseBody
public Msg delteacherById(@PathVariable("ids")String ids) {
int result = teacherService.delTeacherById(Integer.parseInt(ids));
if (result > 0) {
return Msg.success();
}
return Msg.fail();
}
}
}
model.addAttribute("msg", "账号或密码错误");
return "login";
}
@RequestMapping("/toRegister")
public String toRegister() {
return "register";
}
@RequestMapping("/register")
public String register(Teacher teacher, Model model, HttpSession session) {
System.out.println("controller " + teacher.getTeacherEmail());
Boolean flag = teacherService.insert(teacher);
if (flag) {
return "login";
} else {
model.addAttribute("msg", "注册失败");
return "register";
}
}
@RequestMapping("/toLogin")
public String toLogin() {
return "login";
}
}
@Controller
public class TeacherController {
@Autowired
TeacherService teacherService;
@RequestMapping("/teachers")
@ResponseBody
public Msg getTeachers(@RequestParam(value="pn", defaultValue="1")Integer pn) {
PageHelper.startPage(pn, 5);
List teachers = teacherService.getAll();
PageInfo pageInfo = new PageInfo(teachers, 3);
return Msg.success().add("pageInfo", pageInfo);
}
@RequestMapping(value="/updateTeacher/{id}", method=RequestMethod.PUT)
@ResponseBody
public Msg updateTeacher(Teacher teacher) {
boolean result = teacherService.updateOne(teacher);
if (result) {
return Msg.success();
}else {
return Msg.fail();
}
}
//addTeacher
@RequestMapping(value="/addTeacher")
@ResponseBody
public Msg addTeacher(@RequestBody Teacher teacher) {
public Msg getTeachers(@RequestParam(value="pn", defaultValue="1")Integer pn) {
PageHelper.startPage(pn, 5);
List teachers = teacherService.getAll();
PageInfo pageInfo = new PageInfo(teachers, 3);
return Msg.success().add("pageInfo", pageInfo);
}
@RequestMapping(value="/updateTeacher/{id}", method=RequestMethod.PUT)
@ResponseBody
public Msg updateTeacher(Teacher teacher) {
boolean result = teacherService.updateOne(teacher);
if (result) {
return Msg.success();
}else {
return Msg.fail();
}
}
//addTeacher
@RequestMapping(value="/addTeacher")
@ResponseBody
public Msg addTeacher(@RequestBody Teacher teacher) {
teacher = teacherService.addOne(teacher);
return Msg.success().add("newteacher", teacher);
}
//delteacherById
@RequestMapping(value="/delTeacherById/{ids}", method=RequestMethod.DELETE)
@ResponseBody
public Msg delteacherById(@PathVariable("ids")String ids) {
int result = teacherService.delTeacherById(Integer.parseInt(ids));
if (result > 0) {
return Msg.success();
}
return Msg.fail();
}
}
@Controller
public class ManagerController {
@Autowired
ManagerService managerService;
/**
* 查询管理员分页查询
* @return
*/
// @RequestMapping(value="/managers")
public String getManager(@RequestParam(value="pn", defaultValue="1")Integer pn, Model model) {
PageHelper.startPage(pn, 5);
List managers = managerService.getAll();
PageInfo pageInfo = new PageInfo(managers, 3);
model.addAttribute("pageInfo", pageInfo);
return "list_m";
}
@RequestMapping(value="/managers")
@ResponseBody
public Msg getManagerWithJson(@RequestParam(value="pn", defaultValue="1")Integer pn) {
PageHelper.startPage(pn, 5);
List managers = managerService.getAll();
PageInfo pageInfo = new PageInfo(managers, 3);
return Msg.success().add("pageInfo", pageInfo);
}
@RequestMapping(value="/searchM")
@ResponseBody
public Msg selectManagers(@RequestBody Manager m) {
return "super";
}
}
if (u == 2) {
Manager m = managerService.login(user);
if (m == null) {
model.addAttribute("msg", "账号或密码错误");
return "login";
} else {
session.setAttribute("USER", m);
return "manager";
}
}
if (u == 3) {
Teacher m = teacherService.login(user);
if (m == null) {
model.addAttribute("msg", "账号或密码错误");
return "login";
} else {
session.setAttribute("USER", m);
return "teacher";
}
}
model.addAttribute("msg", "账号或密码错误");
return "login";
}
@RequestMapping("/toRegister")
public String toRegister() {
return "register";
}
@RequestMapping("/register")
public String register(Teacher teacher, Model model, HttpSession session) {
System.out.println("controller " + teacher.getTeacherEmail());
Boolean flag = teacherService.insert(teacher);
if (flag) {
return "login";
} else {
model.addAttribute("msg", "注册失败");
return "register";
}
}
@RequestMapping("/toLogin")
public String toLogin() {
return "login";
@RequestMapping(value="/delManagerById/{ids}", method=RequestMethod.DELETE)
@ResponseBody
public Msg delManagerById(@PathVariable("ids")String ids) {
int result = 0;
if (ids.contains("-")) {
result = managerService.delBatch(ids);
}else {
result = managerService.delManagerById(Integer.parseInt(ids));
}
if (result > 0) {
return Msg.success();
}
return Msg.fail();
}
}
@Controller
public class UserController {
@Autowired
ManagerService managerService;
@Autowired
TeacherService teacherService;
@Autowired
SuperService superService;
@RequestMapping(value = "/check", method = RequestMethod.POST)
public String check(User user, Model model, HttpSession session) {