当前位置:网站首页>SSM的教务管理系统(免费源码获取)
SSM的教务管理系统(免费源码获取)
2022-07-01 05:30:00 【azhou的代码园】
ssm-教务系统
介绍
采用了spring mvc,spring,mybatis框架,前端用到js,html,主要功能包括:课程管理,学生管理,教师管理,账号密码重置等功能
安装教程
把项目放到idea
注意把连接的数据库信息修改成自己的
配置tomcat
导入依赖,如果有的爆红导不进去可以选择换个maven版本试试
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;
/*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<学生操作>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
// 学生信息显示
@RequestMapping("/showStudent")
public String showStudent(Model model, Integer page) throws Exception {
List<StudentCustom> list = null;
//页码对象
PagingVO pagingVO = new PagingVO();
//设置总页数
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";
}
// 添加学生信息页面显示
@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";
}
// 添加学生信息操作
@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", "学号重复");
return "error";
}
//添加成功后,也添加到登录表
Userlogin userlogin = new Userlogin();
userlogin.setUsername(studentCustom.getUserid().toString());
userlogin.setPassword("123");
userlogin.setRole(2);
userloginService.save(userlogin);
//重定向
return "redirect:/admin/showStudent";
}
// 修改学生信息页面显示
@RequestMapping(value = "/editStudent", method = {RequestMethod.GET})
public String editStudentUI(Integer id, Model model) throws Exception {
if (id == null) {
//加入没有带学生id就进来的话就返回学生显示页面
return "redirect:/admin/showStudent";
}
StudentCustom studentCustom = studentService.findById(id);
if (studentCustom == null) {
throw new CustomException("未找到该名学生");
}
List<College> list = collegeService.finAll();
model.addAttribute("collegeList", list);
model.addAttribute("student", studentCustom);
return "admin/editStudent";
}
// 修改学生信息处理
@RequestMapping(value = "/editStudent", method = {RequestMethod.POST})
public String editStudent(StudentCustom studentCustom) throws Exception {
studentService.updataById(studentCustom.getUserid(), studentCustom);
//重定向
return "redirect:/admin/showStudent";
}
// 删除学生
@RequestMapping(value = "/removeStudent", method = {RequestMethod.GET} )
private String removeStudent(Integer id) throws Exception {
if (id == null) {
//加入没有带学生id就进来的话就返回学生显示页面
return "admin/showStudent";
}
studentService.removeById(id);
userloginService.removeByName(id.toString());
return "redirect:/admin/showStudent";
}
// 搜索学生
@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";
}
// 本账户密码重置
@RequestMapping("/passwordRest")
public String passwordRestUI() throws Exception {
return "admin/passwordRest";
}
}边栏推荐
- Global and Chinese markets of InGaAs APD arrays 2022-2028: Research Report on technology, participants, trends, market size and share
- Application and principle of ThreadPoolExecutor thread pool
- Global and Chinese market for kitchen range hoods 2022-2028: Research Report on technology, participants, trends, market size and share
- Multi table operation - foreign key cascade operation
- JS random verification code
- 0xc000007b应用程序无法正常启动解决方案(亲测有效)
- Fiber Bragg grating (FBG) notes [1]: waveguide structure and Bragg wavelength derivation
- Redis database deployment and common commands
- [RootersCTF2019]babyWeb
- LevelDB源码分析之memtable
猜你喜欢
![[excel] column operation, which performs specific column for data in a cell, such as text division by comma, colon, space, etc](/img/c8/e3e31ad9ef214d97228cb501dd752f.jpg)
[excel] column operation, which performs specific column for data in a cell, such as text division by comma, colon, space, etc

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

Tar command

Unity drags and modifies scene camera parameters under the editor

C# wpf 使用DockPanel实现截屏框

Use and principle of AQS related implementation classes

Precautions for use of conductive slip ring

Explanation of characteristics of hydraulic slip ring

Application and principle of ThreadPoolExecutor thread pool

Memtable for leveldb source code analysis
随机推荐
JDBC常见面试题
HDU - 1024 Max Sum Plus Plus(DP)
Global and Chinese market of digital badge 2022-2028: Research Report on technology, participants, trends, market size and share
Day 05 - file operation function
在Rainbond中一键部署高可用 EMQX 集群
Series of improving enterprise product delivery efficiency (1) -- one click installation and upgrade of enterprise applications
Rust hello-word
Unit testing with mongodb
数据库连接池的简单实现
Use and principle of AQS related implementation classes
Redis数据库的部署及常用命令
Programmers dig "holes" to get rich: if they find a loophole, they will be rewarded 12.72 million yuan
导电滑环使用的注意事项
如何开始学剪辑?零基础详细解析
Things generated by busybox
Global and Chinese markets of superconductor 2022-2028: Research Report on technology, participants, trends, market size and share
智慧运维:基于 BIM 技术的可视化管理系统
LevelDB源码分析之LRU Cache
Global and Chinese market of 3D design and modeling software 2022-2028: Research Report on technology, participants, trends, market size and share
Actual combat: basic use of Redux