当前位置:网站首页>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
边栏推荐
- Flutter can refresh data every time the interface comes in
- Programmers dig "holes" to get rich: if they find a loophole, they will be rewarded 12.72 million yuan
- Application and principle of ThreadPoolExecutor thread pool
- Vérification simple de la lecture et de l'écriture de qdatastream
- Set集合详细讲解
- RecycleView的一些使用
- 数据治理:数据治理框架(第一篇)
- 小程序常用组件小结
- Thread process foundation of JUC
- mysql 将毫秒数转为时间字符串
猜你喜欢

CockroachDB 分布式事务源码分析之 TxnCoordSender

Intelligent operation and maintenance: visual management system based on BIM Technology

激活函数简述

液压滑环的特点讲解

Tar command

Use and principle of AQS related implementation classes

Day 05 - file operation function

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

Rainbond结合NeuVector实践容器安全管理

Series of improving enterprise product delivery efficiency (1) -- one click installation and upgrade of enterprise applications
随机推荐
[Yugong series] February 2022 Net architecture class 005 ABP vNext Net core web application getting started configuration
CentOS 7使用yum安装PHP7.0
Detailed explanation of set
Receiving package install and uninstall events
Unity项目心得总结
el-form表单新增表单项动态校验;el-form校验动态表单v-if不生效;
HDU - 1024 Max Sum Plus Plus(DP)
Rust hello-word
What can the points mall Games bring to businesses? How to build a points mall?
使用 Nocalhost 开发 Rainbond 上的微服务应用
Redis数据库的部署及常用命令
Flowable source code comment (XXXIX) task listener
SSGSSRCSR区别
Unit testing with mongodb
实战:redux的基本使用
如何创建一个根据进度改变颜色的进度条
More than one file was found with OS independent path ‘lib/armeabi-v7a/libyuv.so‘.
液压滑环的特点讲解
导电滑环使用的注意事项
LevelDB源码分析之memtable