基于javaweb+mysql的ssm宿舍管理系统(java+jsp+ssm+javabean+mysql+tomcat)
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
登录、退出、宿舍、教师、班级、学生、卫生、访客、管理员等模块的增删改查管理
技术框架
JavaBean MVC JSP SSM(Spring SpringMVC MyBatis) MySQL CSS JavaScript Bootstrap JSP jQuery LayUI
基于javaweb+mysql的SSM宿舍管理系统(java+jsp+ssm+javabean+mysql+tomcat)
@RequestMapping(value = "/findStudent")
public String findStudent(String s_name, Integer s_studentid,Integer s_classid, String s_classname,
Integer pageIndex, Integer pageSize, Model model) {
PageInfo<Student> pi = studentService.findPageInfo(s_name,s_studentid,s_classid,
s_classname,pageIndex,pageSize);
model.addAttribute("pi",pi);
model.addAttribute("s_name",s_name);
return "student_list";
}
/**
* 导出Excel
*/
@RequestMapping(value = "/exportstudentlist", method = RequestMethod.POST)
@ResponseBody
public List<Student> exportStudent(){
List<Student> studentList = studentService.getAll();
return studentList;
}
/**
* 删除学生信息
*/
@RequestMapping( "/deleteStudent")
@ResponseBody
public String deleteStudent(Integer s_id) {
int s = studentService.deleteStudent(s_id);
return "student_list";
}
/**
* 添加学生信息
*/
@RequestMapping(value = "/addStudent" ,method = RequestMethod.POST)
@ResponseBody
public String addStudent(@RequestBody Student student) {
int s = studentService.addStudent(student);
return "student_list";
}
/**
* 修改学生信息
*/
@RequestMapping(value = "/updateStudent" ,method = RequestMethod.POST )
public String updateStudent( Student student) {
int s = studentService.updateStudent(student);
return "redirect:/findStudent";
}
return "dormrepair_list";
}
/**
* 删除宿舍信息
*/
@RequestMapping( "/deleteDormRepair")
@ResponseBody
public String deleteDormRepair(Integer r_id) {
int d = dormRepairService.deleteDormRepair(r_id);
return "dormrepair_list";
}
/**
* 修改学生信息
*/
@RequestMapping( "/updateDormRepair")
public String updateDormRepair( DormRepair dormrepair) {
int d = dormRepairService.updateDormRepair(dormrepair);
return "redirect:/findDormRepair";
}
@RequestMapping( "/findDormRepairById")
public String findDormRepairById(Integer r_id, HttpSession session) {
DormRepair d= dormRepairService.findDormRepairById(r_id);
session.setAttribute("d",d);
return "dormrepair_edit";
}
}
// }
}
/**
* @program: dormitorySystem
* @description: 维修登记
**/
@Controller
public class DormRepairController {
// 依赖注入
@Autowired
private DormRepairService dormRepairService;
/**
* 分页查询
* pageIndex 当前页码
* pageSize 显示条数
*/
@RequestMapping(value = "/findDormRepair")
public String findDormRepair(Integer d_id,String d_dormbuilding,
Integer pageIndex, Integer pageSize, Model model) {
PageInfo<DormRepair> di = dormRepairService.findPageInfo(d_id,d_dormbuilding,
pageIndex,pageSize);
model.addAttribute("di",di);
return "dormrepair_list";
}
/**
* 导出Excel
*/
pageIndex,pageSize);
model.addAttribute("pi",pi);
model.addAttribute("v_name",v_name);
return "visitor_list";
}
/**
* 导出Excel
*/
@RequestMapping(value = "/exportvisitorlist", method = RequestMethod.POST)
@ResponseBody
public List<Visitor> exportVisitor(){
List<Visitor> visitorList = visitorService.getAll();
return visitorList;
}
/**
* 添加学生信息
*/
@RequestMapping(value = "/addVisitor" ,method = RequestMethod.POST)
@ResponseBody
public String addStudent(@RequestBody Visitor visitor) {
int v = visitorService.addVisitor(visitor);
return "visitor_list";
}
}
/**
* 登录拦截器
*/
public class Loginlnterceptor implements HandlerInterceptor {
/**
* 用户控制器类
*/
@Controller
public class DormitoryController {
// 依赖注入
@Autowired
private DormitoryService dormitoryService;
/**
* 分页查询
* pageIndex 当前页码
* pageSize 显示条数
*/
@RequestMapping(value = "/findDormitory")
public String findDormitory(String a_name,Integer s_dormitoryid,String d_dormbuilding,
Integer pageIndex, Integer pageSize, Model model) {
PageInfo<Dormitory> di = dormitoryService.findPageInfo(a_name,s_dormitoryid,
d_dormbuilding,pageIndex,pageSize);
model.addAttribute("di",di);
return "dormitory_list";
}
/**
* 导出Excel
*/
@RequestMapping(value = "/exportdormitorylist", method = RequestMethod.POST)
@ResponseBody
public List<Dormitory> exportDormitory(){
List<Dormitory> dormitoryList = dormitoryService.getAll();
return dormitoryList;
}
/**
* 添加宿舍信息
*/
* @description: 学生卫生控制器
**/
@Controller
public class StudentCleanController {
//依赖注入
@Autowired
private StudentCleanService studentCleanService;
/**
* 分页查询
* pageIndex 当前页码
* pageSize 显示条数
*/
@RequestMapping(value = "/findStudentClean")
public String findDormClean(Integer s_studentid, String s_name, Integer s_dormitoryid, Integer pageIndex, Integer pageSize, Model model) {
PageInfo<StudentClean> di = studentCleanService.findPageInfo(s_studentid,s_name,s_dormitoryid,pageIndex,pageSize);
model.addAttribute("di",di);
return "studentclean_list";
}
/**
* 导出Excel
*/
@RequestMapping(value = "/exportstudentcleanlist", method = RequestMethod.POST)
@ResponseBody
public List<StudentClean> exportStudentclean(){
List<StudentClean> studentCleanList = studentCleanService.getAll();
return studentCleanList;
}
/**
* 添加宿舍卫生信息
*/
@RequestMapping(value = "/addStudentClean" ,method = RequestMethod.POST)
@ResponseBody
public String addDormClean( @RequestBody StudentClean studentclean) {
int d = studentCleanService.addStudentClean(studentclean);
return "studentclean_list";
}
/**
* 删除宿舍卫生信息
*/
@RequestMapping( "/deleteStudentClean")
@ResponseBody
public String deleteDormClean(Integer g_id) {
int d = studentCleanService.deleteStudentClean(g_id);
* 修改学生信息
*/
@RequestMapping( "/updateDormitory")
public String updateDormitory( Dormitory dormitory) {
int d = dormitoryService.updateDormitory(dormitory);
return "redirect:/findDormitory";
}
@RequestMapping( "/findDormitoryById")
public String findDormitoryById(Integer d_id,HttpSession session) {
Dormitory d= dormitoryService.findDormitoryById(d_id);
session.setAttribute("d",d);
return "dormitory_edit";
}
/**
* 宿舍人员信息查询
*/
@RequestMapping(value = "/findDormitoryStudent")
public String findDormitoryStudent(Dormitory dormitory,Model model) {
List<Dormitory> d = dormitoryService.findDormitoryStudent(dormitory);
model.addAttribute("ds",d);
return "dormitory_Studentlist";
}
}
List<DormClean> dormclean = dormCleanService.getAll();
return dormclean;
}
/**
* 添加宿舍卫生信息
*/
@RequestMapping(value = "/addDormClean" ,method = RequestMethod.POST)
@ResponseBody
public String addDormClean( @RequestBody DormClean dormclean) {
int d = dormCleanService.addDormClean(dormclean);
return "dormclean_list";
}
/**
* 删除宿舍卫生信息
*/
@RequestMapping( "/deleteDormClean")
@ResponseBody
public String deleteDormClean(Integer g_id) {
int d = dormCleanService.deleteDormClean(g_id);
return "dormclean_list";
}
/**
* 修改宿舍卫生信息
*/
@RequestMapping( "/updateDormClean")
public String updateDormClean(HttpServletRequest request) {
DormClean vo = new DormClean();
vo.setG_id(Integer.valueOf(request.getParameter("g_id")));
vo.setD_id(Integer.valueOf(request.getParameter("d_id")));
vo.setD_dormbuilding(request.getParameter("d_dormbuilding:"));
vo.setD_grade(Integer.valueOf(request.getParameter("d_grade")));
vo.setUpdate_time(new Date());
int d = dormCleanService.updateDormClean(vo);
return "redirect:/findDormClean";
}
@RequestMapping( "/findDormCleanById")
public String findDormCleanById(Integer g_id, HttpSession session) {
/**
* 添加学生信息
*/
@RequestMapping(value = "/addStudent" ,method = RequestMethod.POST)
@ResponseBody
public String addStudent(@RequestBody Student student) {
int s = studentService.addStudent(student);
return "student_list";
}
/**
* 修改学生信息
*/
@RequestMapping(value = "/updateStudent" ,method = RequestMethod.POST )
public String updateStudent( Student student) {
int s = studentService.updateStudent(student);
return "redirect:/findStudent";
}
@RequestMapping( "/findStudentById")
public String findStudentById(Integer s_id,HttpSession session) {
Student s= studentService.findStudentById(s_id);
session.setAttribute("s",s);
return "student_edit";
}
}
/**
* @program: dormitorySystem
* @description: 访客管理
**/
@Controller
public class VisitorController {
//依赖注入
@Autowired
private VisitorService visitorService;
*/
@RequestMapping(value = "/exportdormrepairlist", method = RequestMethod.POST)
@ResponseBody
public List<DormRepair> exportDormrepair(){
List<DormRepair> dormRepairList = dormRepairService.getAll();
return dormRepairList;
}
/**
* 添加宿舍信息
*/
@RequestMapping(value = "/addDormRepair" ,method = RequestMethod.POST)
@ResponseBody
public String addDormitory( @RequestBody DormRepair dormrepair) {
int d = dormRepairService.addDormRepair(dormrepair);
return "dormrepair_list";
}
/**
* 删除宿舍信息
*/
@RequestMapping( "/deleteDormRepair")
@ResponseBody
public String deleteDormRepair(Integer r_id) {
int d = dormRepairService.deleteDormRepair(r_id);
return "dormrepair_list";
}
/**
* 修改学生信息
*/
@RequestMapping( "/updateDormRepair")
public String updateDormRepair( DormRepair dormrepair) {
int d = dormRepairService.updateDormRepair(dormrepair);
return "redirect:/findDormRepair";
}
@RequestMapping( "/findDormRepairById")
public String findDormRepairById(Integer r_id, HttpSession session) {
DormRepair d= dormRepairService.findDormRepairById(r_id);
session.setAttribute("d",d);
return "dormrepair_edit";
}
}
return "dormitory_list";
}
/**
* 修改学生信息
*/
@RequestMapping( "/updateDormitory")
public String updateDormitory( Dormitory dormitory) {
int d = dormitoryService.updateDormitory(dormitory);
return "redirect:/findDormitory";
}
@RequestMapping( "/findDormitoryById")
public String findDormitoryById(Integer d_id,HttpSession session) {
Dormitory d= dormitoryService.findDormitoryById(d_id);
session.setAttribute("d",d);
return "dormitory_edit";
}
/**
* 宿舍人员信息查询
*/
@RequestMapping(value = "/findDormitoryStudent")
public String findDormitoryStudent(Dormitory dormitory,Model model) {
List<Dormitory> d = dormitoryService.findDormitoryStudent(dormitory);
model.addAttribute("ds",d);
return "dormitory_Studentlist";
}
}
/**
* 用户控制器类
*/
@Controller
* 用户控制器类
*/
@Controller
public class StudentController {
// 依赖注入
@Autowired
private StudentService studentService;
/**
* 分页查询
* pageIndex 当前页码
* pageSize 显示条数
*/
@RequestMapping(value = "/findStudent")
public String findStudent(String s_name, Integer s_studentid,Integer s_classid, String s_classname,
Integer pageIndex, Integer pageSize, Model model) {
PageInfo<Student> pi = studentService.findPageInfo(s_name,s_studentid,s_classid,
s_classname,pageIndex,pageSize);
model.addAttribute("pi",pi);
model.addAttribute("s_name",s_name);
return "student_list";
}
/**
* 导出Excel
*/
@RequestMapping(value = "/exportstudentlist", method = RequestMethod.POST)
@ResponseBody
public List<Student> exportStudent(){
List<Student> studentList = studentService.getAll();
return studentList;
}
/**
* 删除学生信息
*/
@RequestMapping( "/deleteStudent")
@ResponseBody
public String deleteStudent(Integer s_id) {
int s = studentService.deleteStudent(s_id);
return "student_list";
}
/**
* 添加学生信息
*/
}
/**
* 修改学生信息
*/
@RequestMapping( "/updateDormitory")
public String updateDormitory( Dormitory dormitory) {
int d = dormitoryService.updateDormitory(dormitory);
return "redirect:/findDormitory";
}
@RequestMapping( "/findDormitoryById")
public String findDormitoryById(Integer d_id,HttpSession session) {
Dormitory d= dormitoryService.findDormitoryById(d_id);
session.setAttribute("d",d);
return "dormitory_edit";
}
/**
* 宿舍人员信息查询
*/
@RequestMapping(value = "/findDormitoryStudent")
public String findDormitoryStudent(Dormitory dormitory,Model model) {
List<Dormitory> d = dormitoryService.findDormitoryStudent(dormitory);
model.addAttribute("ds",d);
return "dormitory_Studentlist";
}
}
/**
* 用户控制器类
*/
@Controller
int a = adminService.addAdmin(admin);
return "admin_list";
}
/**
* 删除管理员信息;将请求体a_id写入参数a_id
*/
@RequestMapping( "/deleteAdmin")
@ResponseBody
public String deleteAdmin(Integer a_id) {
int a = adminService.deleteAdmin(a_id);
return "admin_list";
}
/**
* 修改管理员信息
*/
/**
* 将提交数据(a_id,a_username...)写入Admin对象
*/
@RequestMapping( value = "/updateAdmin", method = RequestMethod.POST)
public String updateAdmin(Admin admin) {
admin.setA_password(MD5Util.MD5EncodeUtf8(admin.getA_password()));
int a = adminService.updateAdmin(admin);
return "redirect:/findAdmin";
}
/**
* 根据管理员Id搜索;将请求数据a_id写入参数a_id
*/
@RequestMapping( "/findAdminById")
public String findAdminById( Integer a_id,HttpSession session) {
Admin a= adminService.findAdminById(a_id);
session.setAttribute("a",a);
return "admin_edit";
}
}
return "redirect:/findDormitory";
}
@RequestMapping( "/findDormitoryById")
public String findDormitoryById(Integer d_id,HttpSession session) {
Dormitory d= dormitoryService.findDormitoryById(d_id);
session.setAttribute("d",d);
return "dormitory_edit";
}
/**
* 宿舍人员信息查询
*/
@RequestMapping(value = "/findDormitoryStudent")
public String findDormitoryStudent(Dormitory dormitory,Model model) {
List<Dormitory> d = dormitoryService.findDormitoryStudent(dormitory);
model.addAttribute("ds",d);
return "dormitory_Studentlist";
}
}
/**
* 用户控制器类
*/
@Controller
public class StudentController {
// 依赖注入
@Autowired
private StudentService studentService;
/**
* 分页查询
@RequestMapping( "/findAdminById")
public String findAdminById( Integer a_id,HttpSession session) {
Admin a= adminService.findAdminById(a_id);
session.setAttribute("a",a);
return "admin_edit";
}
}
/**
* @program: dormitorySystem
* @description: 宿舍卫生控制器
**/
@Controller
public class DormCleanController {
//依赖注入
@Autowired
private DormCleanService dormCleanService;
/**
* 分页查询
* pageIndex 当前页码
* pageSize 显示条数
*/
@RequestMapping(value = "/findDormClean")
public String findDormClean(Integer d_id,String d_dormbuilding,
Integer pageIndex, Integer pageSize, Model model) {
PageInfo<DormClean> di = dormCleanService.findPageInfo(d_id,d_dormbuilding,
/**
* 添加班级信息
*/
@RequestMapping(value = "/addClass" ,method = RequestMethod.POST)
@ResponseBody
public String addClass( @RequestBody Class uclass) {
int c = classService.addClass(uclass);
return "class_list";
}
@RequestMapping( "/findClassById")
public String findClassById( Integer c_id,HttpSession session) {
Class c= classService.findClassById(c_id);
session.setAttribute("c",c);
return "class_edit";
}
/**
* 修改班级信息
*/
@RequestMapping(value = "/updateClass" ,method = RequestMethod.POST)
public String updateClass( Class uclass) {
int c = classService.updateClass(uclass);
return "redirect:/findClass";
}
/**
* 班级人员信息查询
*/
@RequestMapping(value = "/findClassStudent")
public String findClassStudent(Class uclass,Model model) {
List<Class> c = classService.findClassStudent(uclass);
model.addAttribute("cs",c);
return "class_Studentlist";
}
//采用Ajax来提交表单,并返回JSON数据
// @RequestMapping(value = "/findClassStudentlist",method = RequestMethod.POST)
// @ResponseBody
// public List<Class> findClassStudentlist(@RequestBody Class uclass){
// List<Class> c = classService.findClassStudent(uclass);
return "dormrepair_list";
}
/**
* 修改学生信息
*/
@RequestMapping( "/updateDormRepair")
public String updateDormRepair( DormRepair dormrepair) {
int d = dormRepairService.updateDormRepair(dormrepair);
return "redirect:/findDormRepair";
}
@RequestMapping( "/findDormRepairById")
public String findDormRepairById(Integer r_id, HttpSession session) {
DormRepair d= dormRepairService.findDormRepairById(r_id);
session.setAttribute("d",d);
return "dormrepair_edit";
}
}
/**
* 用户控制器类
*/
@Controller
public class DormitoryController {
// 依赖注入
@Autowired
private DormitoryService dormitoryService;
/**
* 分页查询
* pageIndex 当前页码