首先分析了当前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 = "https://www.it610.com/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 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 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 nameList = new ArrayList();
List valueList = new ArrayList();
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;
}}
【spring|基于springboot疫情防控管理系统源码和论文】
推荐阅读
- Java|Java-Aspose实现Word文字替换(本地储存或浏览器下载)
- spring|springboot实现疫情防控核酸检测管理系统【源码和论文】
- spring|基于springboot社区疫情防控管理系统
- 《带你学》云原生|2022年找工作你必须要会的技能---看了就找工作领先别人一步
- docker|Docker部署Mysql常见问题总结
- docker|docker笔记总结
- SpringBoot|Spring Boot 参考文档(官网对照翻译)
- Spring|09 SpringSecurity-跨域与CORS
- Java基础|Java程序员的重启人生-3.Java基础碾压