当前位置:网站首页>Educational administration management system of SSM (free source code)
Educational administration management system of SSM (free source code)
2022-07-01 05:34:00 【Code garden of Azhou】
ssm- Educational administration system
Introduce
Adopted spring mvc,spring,mybatis frame , Front end use js,html, The main functions include : Course management , Student management , Teacher management , Account password reset and other functions
Installation tutorial
Put the project in idea
Pay attention to modifying the connected database information to your own
To configure tomcat
Import dependence , If some red hot conductors can't go in, you can choose to change them maven Version to try
package com.system.controller;
import com.system.exception.CustomException;
import com.system.po.*;
import com.system.service.*;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import javax.annotation.Resource;
import java.util.List;
@Controller
@RequestMapping("/admin")
public class AdminController {
@Resource
private StudentService studentService;
@Resource
private TeacherService teacherService;
@Resource
private CourseService courseService;
@Resource
private CollegeService collegeService;
@Resource
private UserloginService userloginService;
/*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Student operation >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
// Student information shows
@RequestMapping("/showStudent")
public String showStudent(Model model, Integer page) throws Exception {
List<StudentCustom> list = null;
// Page number object
PagingVO pagingVO = new PagingVO();
// Set the total number of pages
pagingVO.setTotalCount(studentService.getCountStudent());
if (page == null || page == 0) {
pagingVO.setToPageNo(1);
list = studentService.findByPaging(1);
} else {
pagingVO.setToPageNo(page);
list = studentService.findByPaging(page);
}
model.addAttribute("studentList", list);
model.addAttribute("pagingVO", pagingVO);
return "admin/showStudent";
}
// The add student information page displays
@RequestMapping(value = "/addStudent", method = {RequestMethod.GET})
public String addStudentUI(Model model) throws Exception {
List<College> list = collegeService.finAll();
model.addAttribute("collegeList", list);
return "admin/addStudent";
}
// Add student information operation
@RequestMapping(value = "/addStudent", method = {RequestMethod.POST})
public String addStudent(StudentCustom studentCustom, Model model) throws Exception {
Boolean result = studentService.save(studentCustom);
if (!result) {
model.addAttribute("message", " Repeat the student number ");
return "error";
}
// After successful addition , Also added to the login table
Userlogin userlogin = new Userlogin();
userlogin.setUsername(studentCustom.getUserid().toString());
userlogin.setPassword("123");
userlogin.setRole(2);
userloginService.save(userlogin);
// Redirect
return "redirect:/admin/showStudent";
}
// Modify the student information page display
@RequestMapping(value = "/editStudent", method = {RequestMethod.GET})
public String editStudentUI(Integer id, Model model) throws Exception {
if (id == null) {
// Join without taking students id If you come in, you will return to the student display page
return "redirect:/admin/showStudent";
}
StudentCustom studentCustom = studentService.findById(id);
if (studentCustom == null) {
throw new CustomException(" The student was not found ");
}
List<College> list = collegeService.finAll();
model.addAttribute("collegeList", list);
model.addAttribute("student", studentCustom);
return "admin/editStudent";
}
// Modify student information processing
@RequestMapping(value = "/editStudent", method = {RequestMethod.POST})
public String editStudent(StudentCustom studentCustom) throws Exception {
studentService.updataById(studentCustom.getUserid(), studentCustom);
// Redirect
return "redirect:/admin/showStudent";
}
// Delete students
@RequestMapping(value = "/removeStudent", method = {RequestMethod.GET} )
private String removeStudent(Integer id) throws Exception {
if (id == null) {
// Join without taking students id If you come in, you will return to the student display page
return "admin/showStudent";
}
studentService.removeById(id);
userloginService.removeByName(id.toString());
return "redirect:/admin/showStudent";
}
// Search students
@RequestMapping(value = "selectStudent", method = {RequestMethod.POST})
private String selectStudent(String findByName, Model model) throws Exception {
List<StudentCustom> list = studentService.findByName(findByName);
model.addAttribute("studentList", list);
return "admin/showStudent";
}
// The password of this account is reset
@RequestMapping("/passwordRest")
public String passwordRestUI() throws Exception {
return "admin/passwordRest";
}
} Educational administration management system download link https://gitee.com/wuyanzua/blog-applet
边栏推荐
- SSM的教务管理系统(免费源码获取)
- printk 调试总结
- Design and application of immutable classes
- CentOS 7使用yum安装PHP7.0
- Series of improving enterprise product delivery efficiency (1) -- one click installation and upgrade of enterprise applications
- Receiving package install and uninstall events
- Use and principle of Park unpark
- Mongodb學習篇:安裝後的入門第一課
- Global and Chinese market of protection circuit modules 2022-2028: Research Report on technology, participants, trends, market size and share
- Thread process foundation of JUC
猜你喜欢

Use and principle of reentrantlock

JDBC common interview questions

第05天-文件操作函数

Set set detailed explanation

eBPF Cilium实战(2) - 底层网络可观测性

CockroachDB: The Resilient Geo-Distributed SQL Database 论文阅读笔记

Daily code 300 lines learning notes day 11

Deeply understand the underlying implementation principle of countdownlatch in concurrent programming

使用 Nocalhost 开发 Rainbond 上的微服务应用

TypeORM 框架
随机推荐
Variable binding and deconstruction for rudimentary rust
Global and Chinese markets for soft ferrite cores 2022-2028: Research Report on technology, participants, trends, market size and share
JDBC common interview questions
Wild melon or split melon?
云原生存储解决方案Rook-Ceph与Rainbond结合的实践
idea启动查看项目端口
Web Security (IX) what is JWT?
How to meet the requirements of source code confidentiality and source code security management
轩逸保养手册
第05天-文件操作函数
数据治理:数据治理管理(第五篇)
Practice of combining rook CEPH and rainbow, a cloud native storage solution
Flowable source code comment (XXXIX) task listener
基于TI DRV8424驱动步进电机实现调速和行程控制
如何选择导电滑环材料
ssm+mysql二手交易网站(论文+源码获取链接)
Deeply understand the underlying implementation principle of countdownlatch in concurrent programming
Redis数据库的部署及常用命令
json数据比较器
Receiving package install and uninstall events