首先分析了当前XX地区疫情防控的现状。然后对当前软件开发的开发平台和技术、数据库等进行了研究,提出采用JSP技术,同时选择了Spring
Boot作为开发的框架,数据存储上则是采用了经典的MySQL开源数据库,从界面简洁、实用的要求出发,完成了基于Spring Boot的校园
疫情防控系统;最后实现了一个具有注册登陆、管理个人信息、订购防疫物资、申报个人信息、评论管理,以及管理员对该系统的用户管理、防疫物资管理、订单管理、信息管理等功能的
校园疫情防控系统。该系统可以为学校提供学生申报的个人信息,为学生提供订购防疫物资,即时与他人交流沟通的平台,从而提高疫情防控的效率。

关键词:疫情防控 Spring Boot MySQL

 

 
package com.boot.controller; import java.util.ArrayList; import
java.util.List; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import
org.springframework.web.bind.annotation.RequestMapping; import
com.boot.entity.Admin; import com.boot.service.AdminService; import
com.boot.util.PageHelper; import com.boot.util.VeDate; //定义为控制器 @Controller //
设置路径 @RequestMapping(value = "/admin" , produces = "text/plain;charset=utf-8")
public class AdminController extends BaseController { // 注入Service 由于标签的存在
所以不需要getter setter @Autowired private AdminService adminService; // 管理员准备
@RequestMapping("index.action") public String index() { return "admin/index"; }
// 管理员登录 1 验证用户名是否存在 2 验证密码是否正确 @RequestMapping("login.action") public String
login() { String username = this.getRequest().getParameter("username"); String
password = this.getRequest().getParameter("password"); Admin adminEntity = new
Admin(); adminEntity.setUsername(username); List<Admin> adminlist =
this.adminService.getAdminByCond(adminEntity); if (adminlist.size() == 0) {
this.getRequest().setAttribute("message", "用户名不存在"); return
"redirect:/admin/index.action"; } else { Admin admin = adminlist.get(0); if
(password.equals(admin.getPassword())) {
this.getSession().setAttribute("adminid", admin.getAdminid());
this.getSession().setAttribute("adminname", admin.getUsername());
this.getSession().setAttribute("realname", admin.getRealname()); } else {
this.getRequest().setAttribute("message", "密码错误"); return
"redirect:/admin/index.action"; } } return "admin/main"; } // 管理员准备修改密码
@RequestMapping("prePwd.action") public String prePwd() { return
"admin/editpwd"; } // 修改密码 @RequestMapping("editpwd.action") public String
editpwd() { String adminid = (String)
this.getSession().getAttribute("adminid"); String password =
this.getRequest().getParameter("password"); String repassword =
this.getRequest().getParameter("repassword"); Admin admin =
this.adminService.getAdminById(adminid); if
(password.equals(admin.getPassword())) { admin.setPassword(repassword);
this.adminService.updateAdmin(admin); } else {
this.getRequest().setAttribute("message", "旧密码错误"); } return
"redirect:/admin/prePwd.action"; } // 管理员退出登录 @RequestMapping("exit.action")
public String exit() { this.getSession().removeAttribute("adminid");
this.getSession().removeAttribute("adminname");
this.getSession().removeAttribute("realname"); return
"redirect:/admin/index.action"; } // 准备添加数据
@RequestMapping("createAdmin.action") public String createAdmin() { return
"admin/addadmin"; } // 添加数据 @RequestMapping("addAdmin.action") public String
addAdmin(Admin admin) { admin.setAddtime(VeDate.getStringDateShort());
this.adminService.insertAdmin(admin); return
"redirect:/admin/createAdmin.action"; } // 通过主键删除数据
@RequestMapping("deleteAdmin.action") public String deleteAdmin(String id) {
this.adminService.deleteAdmin(id); return "redirect:/admin/getAllAdmin.action";
} // 批量删除数据 @RequestMapping("deleteAdminByIds.action") public String
deleteAdminByIds() { String[] ids =
this.getRequest().getParameterValues("adminid"); for (String adminid : ids) {
this.adminService.deleteAdmin(adminid); } return
"redirect:/admin/getAllAdmin.action"; } // 更新数据
@RequestMapping("updateAdmin.action") public String updateAdmin(Admin admin) {
this.adminService.updateAdmin(admin); return
"redirect:/admin/getAllAdmin.action"; } // 显示全部数据
@RequestMapping("getAllAdmin.action") public String getAllAdmin(String number)
{ List<Admin> adminList = this.adminService.getAllAdmin();
PageHelper.getPage(adminList, "admin", null, null, 10, number,
this.getRequest(), null); return "admin/listadmin"; } // 按条件查询数据 (模糊查询)
@RequestMapping("queryAdminByCond.action") public String
queryAdminByCond(String cond, String name, String number) { Admin admin = new
Admin(); if(cond != null){ if ("username".equals(cond)) {
admin.setUsername(name); } if ("password".equals(cond)) {
admin.setPassword(name); } if ("realname".equals(cond)) {
admin.setRealname(name); } if ("contact".equals(cond)) {
admin.setContact(name); } if ("addtime".equals(cond)) { admin.setAddtime(name);
} } List<String> nameList = new ArrayList<String>(); List<String> valueList =
new ArrayList<String>(); nameList.add(cond); valueList.add(name);
PageHelper.getPage(this.adminService.getAdminByLike(admin), "admin", nameList,
valueList, 10, number, this.getRequest(), "query"); name = null; cond = null;
return "admin/queryadmin"; } // 按主键查询数据 @RequestMapping("getAdminById.action")
public String getAdminById(String id) { Admin admin =
this.adminService.getAdminById(id); this.getRequest().setAttribute("admin",
admin); return "admin/editadmin"; } public AdminService getAdminService() {
return adminService; } public void setAdminService(AdminService adminService) {
this.adminService = adminService; } }

技术
©2019-2020 Toolsou All rights reserved,
在算法研究过程中如何进行算法创新七大排序算法(java代码)MYSQL中的索引与事务———javaweb(8)(面试必考)2022蓝桥杯JavaB组省赛试题网络安全-wifi攻防网络层协议——ICMP协议MySQL查询表中指定条件下的最新记录JavaSE笔记(一)Java基础语法mysql 查询条件之外的数据_mysql 查询符合条件的数据qt使用数据库sqlite