当前位置:网站首页>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
边栏推荐
- Numeric amount plus comma; JS two methods of adding three digits and a comma to numbers; JS data formatting
- QT waiting box production
- busybox生成的东西
- Web Security (x) what is OAuth 2.0?
- Floweable source code annotation (40) class delegation
- 积分商城游戏能够给商家带来什么?怎么搭建积分商城?
- Mongodb学习篇:安装后的入门第一课
- eBPF Cilium实战(2) - 底层网络可观测性
- Mongodb learning chapter: introduction after installation lesson 1
- Simple implementation of database connection pool
猜你喜欢

轻松上手Fluentd,结合 Rainbond 插件市场,日志收集更快捷

Understand several related problems in JVM - JVM memory layout, class loading mechanism, garbage collection

Use and principle of reentrantlock

How to select conductive slip ring material

JDBC common interview questions

JDBC常见面试题

Use and principle of AQS related implementation classes

如何选择导电滑环材料

tar命令

【QT】qt加减乘除之后,保留小数点后两位
随机推荐
Rainbond结合NeuVector实践容器安全管理
3D建模與處理軟件簡介 劉利剛 中國科技大學
Rust基础入门之变量绑定与解构
LevelDB源码分析之memtable
[RootersCTF2019]babyWeb
Web Security (x) what is OAuth 2.0?
C# wpf 使用DockPanel实现截屏框
积分商城游戏能够给商家带来什么?怎么搭建积分商城?
LevelDB源码分析之LRU Cache
C WPF uses dockpanel to realize screenshot box
Application and principle of ThreadPoolExecutor thread pool
Common solutions for mobile terminals
Simple implementation of database connection pool
QT等待框制作
如何选择导电滑环材料
SSGSSRCSR区别
CentOS 7 installed php7.0 using Yum or up2date
LRU cache for leveldb source code analysis
0xc000007b应用程序无法正常启动解决方案(亲测有效)
Dynamic verification of new form items in El form; El form verifies that the dynamic form V-IF does not take effect;