基于javaweb+mysql的springboot蓝天幼儿园管理系统(java+springboot+thymeleaf+html+maven+mysql)
私信源码获取及调试交流
运行环境
Java≥8、MySQL≥5.7
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb的SpringBoot蓝天幼儿园管理系统(java+springboot+thymeleaf+html+maven+mysql)
项目介绍
蓝天幼儿园管理系统,共分为三种角色,管理员、家长、教师。
管理员角色具有功能:
系统管理-用户管理、页面管理、角色管理,
校园管理-老师管理、工资管理、物资管理、菜谱管理、班级管理
班级管理-学生管理、公告管理、课程管理
考勤管理-老师考勤、学生考勤、老师考勤统计、学生考勤统计、签到签退
技术栈
-
Springboot
-
html+thymeleaf
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
4.数据库:MySql 8.0版本;
使用说明
运行项目,输入localhost:8081 登录
管理员账户admin 密码123456
教师账号wangjianlin 密码123456
}
/*
* All rights Reserved, Copyright (C) Aisino LIMITED 2018
* FileName: WebConfig.java
* Version: $Revision$
* Modify record:
* NO. | Date | Name | Content
*/
/**
* class name:UserController <BR>
* class description: 用户角色 <BR>
* Remark: <BR>
*
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
@Controller
@RequestMapping("/user")
public class UserController {
private final Logger logger = LoggerFactory.getLogger(UserController.class);
private final ResultMap resultMap;
User user = (User) subject.getPrincipal();
if (null != user) {
model.addAttribute("user", user);
List<Page> pageList = pageService.getAllRolePageByUserId(user.getUserId());
model.addAttribute("pageList", pageList);
return "index";
} else {
return "login";
}
}
/**
* Method name: main <BR>
* Description: 进入主页面 <BR>
*
* @param model
* @return String<BR>
*/
@RequestMapping(value = "/main")
public String main(Model model) {
Subject subject = SecurityUtils.getSubject();
User user = (User) subject.getPrincipal();
if (null != user) {
model.addAttribute("user", user);
} else {
return "login";
}
List<Page> pageList = pageService.getAllRolePageByUserId(user.getUserId());
model.addAttribute("pageList", pageList);
return "index";
}
/**
* Method name: checkUserPassword <BR>
* Description: 检测旧密码是否正确 <BR>
*
* @param password 旧密码
* @return boolean 是否正确<BR>
*/
@RequestMapping(value = "/user/checkUserPassword")
@ResponseBody
public boolean checkUserPassword(String password) {
return userService.checkUserPassword(password);
}
/**
/**
* Method name: getAllDelUserByLimit <BR>
* Description: 获取所有删除用户 <BR>
*
* @param userParameter
* @return Object<BR>
*/
@RequestMapping("/getAllDelUserByLimit")
@ResponseBody
public Object getAllDelUserByLimit(UserParameter userParameter) {
return userService.getAllDelUserByLimit(userParameter);
}
/**
* Method name: delUser <BR>
* Description: 批量删除用户 <BR>
*
* @param ids
* @return String<BR>
*/
@RequestMapping(value = "delUser")
@ResponseBody
@Transactional
public String delUser(String[] ids) {
Subject subject = SecurityUtils.getSubject();
User user = (User) subject.getPrincipal();
try {
for (String id : ids) {
if (id.equals(user.getUserId())) {
return "DontOP";
}
userService.delUserById(id);
}
return "SUCCESS";
} catch (Exception e) {
logger.error("根据用户id更新用户异常", e);
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return "ERROR";
}
}
/**
* Method name: addUserPage <BR>
* Description: 增加用户界面 <BR>
*
* @return String<BR>
*/
@RequestMapping(value = "/addUserPage")
public String addUserPage(String userId, Model model) {
model.addAttribute("manageUser", userId);
if (null != userId) {
User user = userService.selectByPrimaryKey(userId);
model.addAttribute("manageUser", user);
/**
* Method name: getAllPayByLimit <BR>
* Description: 根据条件获取所有教师 <BR>
*
* @param userParameter
* @return Object<BR>
*/
@RequestMapping("/getAllPayByLimit")
@ResponseBody
public Object getAllPayByLimit(Pay payParameter) {
return payService.getAllPayByLimit(payParameter);
}
/**
* Method name: addTeaPage <BR>
* Description: 增加教师界面 <BR>
*
* @return String<BR>
*/
@RequestMapping(value = "/addPayPage")
public String addPayPage(Integer id, Model model) {
model.addAttribute("managePay", id);
if (null != id) {
Pay pay = payService.selectByPrimaryKey(id);
model.addAttribute("managePay", pay);
}
List<User> teacher=userService.selectAllTea();
model.addAttribute("tea", teacher);
return "sa/payAdd";
}
/**
* Method name: addPay <BR>
* Description: 教师添加 <BR>
*
* @param user
* @return String<BR>
*/
@ResponseBody
@RequestMapping("/addPay")
public String addPay(Pay pay) {
try {
pay.setPaymentTime(new Date());
payService.addPayTea(pay);
return "SUCCESS";
} catch (Exception e) {
return "ERR";
}
}
/**
* Method name: updatePay <BR>
* Description: 更新教师 <BR>
/**
* Method name: getAllFootByLimit <BR>
* Description: 根据条件获取所有教师 <BR>
*
* @param userParameter
* @return Object<BR>
*/
@RequestMapping("/getAllFootByLimit")
@ResponseBody
public Object getAllFootByLimit(Foot foot) {
return footService.getAllFootByLimit(foot);
}
/**
* Method name: addFootPage <BR>
* Description: 增加教师界面 <BR>
*
* @return String<BR>
*/
@RequestMapping(value = "/addFootPage")
public String addFootPage(Integer id, Model model) {
model.addAttribute("manageFoot", id);
if (null != id) {
Foot foot = footService.selectByPrimaryKey(id);
model.addAttribute("manageFoot", foot);
}
return "sa/footAdd";
}
/**
* Method name: addFoot <BR>
* Description: 教师添加 <BR>
*
* @param user
* @return String<BR>
*/
@ResponseBody
@RequestMapping("/addFoot")
public String addFoot(Foot foot) {
try {
foot.setCreateTime(new Date());
footService.addFoot(foot);
return "SUCCESS";
} catch (Exception e) {
return "ERR";
}
}
/**
* Method name: updateFoot <BR>
//签退
Sign sign = new Sign();
sign.setKqrId(uid);
Date date=new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss a");
String time = formatter.format(date).split(" ")[2];
String time1 = formatter.format(date).split(" ")[1];
String s=PropertyUtil.getConfigureProperties("endTime");
if(time.equals("下午") && time1.compareTo(s)<0) {
sign.setState(1);
}else{
sign.setState(2);
}
sign.setType(Integer.parseInt(type));
sign.setKqrType(2);
sign.setSignIn(new Date());
signService.addSign(sign);
}
return "OK";
}
}
*/
@ResponseBody
@RequestMapping(value = "/getAdmins")
public List<User> getAdmins() {
return userService.getAdmins();
}
/**
* Description: 查询所有授权用户<BR>
*
* @return List<User>
*/
@ResponseBody
@RequestMapping(value = "/getAllUser")
public List<User> getAllUser() {
return userService.getAllUser();
}
}
/**
*
*/
public class ProcessInterceptor implements HandlerInterceptor {
@Override
public boolean preHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o) throws Exception {
httpServletResponse.setHeader("Access-Control-Allow-Origin", "*");
httpServletResponse.setHeader("Access-Control-Allow-Headers", "Content-Type,Content-Length, Authorization, Accept,X-Requested-With");
httpServletResponse.setHeader("Access-Control-Allow-Methods","PUT,POST,GET,DELETE,OPTIONS");
httpServletResponse.setHeader("X-Powered-By","Jetty");
/**
* Method name: teacherPage <BR>
* Description: 教师管理页面 <BR>
*
* @return String<BR>
*/
@RequestMapping(value = "/stuMG")
public String teaMG(Model model) {
List<Classes> classes=classService.selectAllClasses();
model.addAttribute("cla", classes);
return "ls/student";
}
/**
* Method name: getAllStudentByLimit <BR>
* Description: 根据条件获取所有教师 <BR>
*
* @param userParameter
* @return Object<BR>
*/
@RequestMapping("/getAllStudentByLimit")
@ResponseBody
public Object getAllStudentByLimit(Children stuParameter) {
return studentService.getAllStudentByLimit(stuParameter);
}
/**
* Method name: addStuPage <BR>
* Description: 增加教师界面 <BR>
*
* @return String<BR>
*/
@RequestMapping(value = "/addStuPage")
public String addStuPage(Integer id, Model model) {
model.addAttribute("manageStu", id);
if (null != id) {
Children student = studentService.selectByPrimaryKey(id);
//UserChildren userChild = userChildrenService.selectById(id);
model.addAttribute("manageStu", student);
//model.addAttribute("manageChild", userChild);
UserChildren uc = userChildrenService.selectByUCId(student.getId());
model.addAttribute("uc", uc);
}
/**
* Method name: getAllNoticeByLimit <BR>
* Description: 根据条件获取所有教师 <BR>
*
* @param userParameter
* @return Object<BR>
*/
@RequestMapping("/getAllNoticeByLimit")
@ResponseBody
public Object getAllNoticeByLimit(Notice noticeParameter) {
return noticeService.getAllNoticeByLimit(noticeParameter);
}
/**
* Method name: addStuPage <BR>
* Description: 增加教师界面 <BR>
*
* @return String<BR>
*/
@RequestMapping(value = "/addNoticePage")
public String addNoticePage(Integer id, Model model) {
model.addAttribute("manageNotice", id);
if (null != id) {
Notice notice = noticeService.selectByPrimaryKey(id);
model.addAttribute("manageNotice", notice);
}
return "ls/noticeAdd";
}
/**
* Method name: addStu <BR>
* Description: 教师添加 <BR>
*
* @param user
* @return String<BR>
*/
@ResponseBody
@RequestMapping("/addNotice")
public String addNotice(Notice notice) {
try {
notice.setCreatTime(new Date());
noticeService.addNotice(notice);
return "SUCCESS";
} catch (Exception e) {
return "ERR";
}
}
/**
@RequestMapping(value = "/addPayPage")
public String addPayPage(Integer id, Model model) {
model.addAttribute("managePay", id);
if (null != id) {
Pay pay = payService.selectByPrimaryKey(id);
model.addAttribute("managePay", pay);
}
List<User> teacher=userService.selectAllTea();
model.addAttribute("tea", teacher);
return "sa/payAdd";
}
/**
* Method name: addPay <BR>
* Description: 教师添加 <BR>
*
* @param user
* @return String<BR>
*/
@ResponseBody
@RequestMapping("/addPay")
public String addPay(Pay pay) {
try {
pay.setPaymentTime(new Date());
payService.addPayTea(pay);
return "SUCCESS";
} catch (Exception e) {
return "ERR";
}
}
/**
* Method name: updatePay <BR>
* Description: 更新教师 <BR>
*
* @param user
* @return String<BR>
*/
@ResponseBody
@RequestMapping("/updatePay")
public String updatePay(Pay pay) {
return payService.updateTea(pay);
}
/**
* Method name: delClaTea <BR>
* Description: 批量删除教师<BR>
*
@RequestMapping("/updateClaTea")
public String updateClaTea(ClaTea clatea) {
return teaService.updateTea(clatea);
}
/**
* Method name: delClaTea <BR>
* Description: 批量删除教师<BR>
*
* @param ids
* @return String<BR>
*/
@RequestMapping(value = "delClaTea")
@ResponseBody
@Transactional
public String delClaTea(String[] ids) {
try {
for (String id : ids) {
teaService.delClaTeaById(Integer.parseInt(id));
}
return "SUCCESS";
} catch (Exception e) {
logger.error("根据班级id删除异常", e);
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return "ERROR";
}
}
//工资管理
/**
* Method name: payMG <BR>
* Description: 工资管理页面 <BR>
*
* @return String<BR>
*/
@RequestMapping(value = "/payMG")
public String payMG() {
return "sa/pay";
}
@Autowired
private ClassService classService;
@Autowired
private NoticeService noticeService;
@Autowired
private SignService signService;
@Autowired
private UserService userService;
@Autowired
private UserChildrenService userChildrenService;
@Autowired
private CourseService courseService;
@RequestMapping("/stu")
public String stu(Model model) {
List<Classes> classes=classService.selectAllClasses();
model.addAttribute("cla", classes);
return "ls/stuPage";
}
//学生管理
/**
* Method name: teacherPage <BR>
* Description: 教师管理页面 <BR>
*
* @return String<BR>
*/
@RequestMapping(value = "/stuMG")
public String teaMG(Model model) {
List<Classes> classes=classService.selectAllClasses();
model.addAttribute("cla", classes);
return "ls/student";
}
/**
* Method name: getAllStudentByLimit <BR>
* Description: 根据条件获取所有教师 <BR>
*
* @param userParameter
* @return Object<BR>
*/
* Remark: <BR>
*/
@Controller
public class LoginController {
@Autowired
private ResultMap resultMap;
@Autowired
private UserService userService;// 用户登录service
@Autowired
private PageService pageService;
private final Logger logger = LoggerFactory.getLogger(LoginController.class);
@RequestMapping(value = "/notLogin", method = RequestMethod.GET)
@ResponseBody
public ResultMap notLogin() {
logger.warn("尚未登陆!");
return resultMap.success().message("您尚未登陆!");
}
@RequestMapping(value = "/notRole", method = RequestMethod.GET)
@ResponseBody
public ResultMap notRole() {
Subject subject = SecurityUtils.getSubject();
User user = (User) subject.getPrincipal();
if (user != null) {
logger.info("{}---没有权限!", user.getUserName());
}
return resultMap.success().message("您没有权限!");
}
/**
* Method name: logout <BR>
* Description: 退出登录 <BR>
* @return String<BR>
*/
@RequestMapping(value = "/logout", method = RequestMethod.GET)
public String logout() {
Subject subject = SecurityUtils.getSubject();
User user = (User) subject.getPrincipal();
}
/**
* Method name: getAllSignByLimit <BR>
* Description: 根据条件获取所有教师 <BR>
*
* @param userParameter
* @return Object<BR>
*/
@RequestMapping("/getAllSignByLimit")
@ResponseBody
public Object getAllSignByLimit(Sign signParameter) {
return signService.getAllSignByLimit(signParameter);
}
//打卡
@RequestMapping(value = "/qianDaoTui")
public String qianDaoTui() {
return "ls/daKa";
}
/**
* Method name: addStu <BR>
* Description: 教师添加 <BR>
*
* @param user
* @return String<BR>
*/
@ResponseBody
@RequestMapping("/addSign")
public String addSign(Sign sign) {
Subject subject = SecurityUtils.getSubject();
User user = (User) subject.getPrincipal();
try {
Date date=new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss a");
String time = formatter.format(date).split(" ")[2];
String time1 = formatter.format(date).split(" ")[1];
String s=PropertyUtil.getConfigureProperties("startTime");
if(time.equals("上午") && time1.compareTo(s)>0) {
sign.setState(1);
}else {
sign.setState(3);
}
sign.setType(1);
sign.setSignIn(date);
sign.setKqrId(user.getUserId());
@RequestMapping(value = "/addTeaPage")
public String addTeaPage(Integer id, Model model) {
model.addAttribute("manageTea", id);
if (null != id) {
ClaTea clatea = teaService.selectByPrimaryKey(id);
model.addAttribute("manageTea", clatea);
}
List<Classes> classes=classService.selectAllClasses();
model.addAttribute("cla", classes);
List<User> teacher=userService.selectAllTea();
model.addAttribute("tea", teacher);
return "sa/claTeaAdd";
}
/**
* Method name: addTea <BR>
* Description: 教师添加 <BR>
*
* @param user
* @return String<BR>
*/
@ResponseBody
@RequestMapping("/addTea")
public String addTea(ClaTea clatea) {
try {
teaService.addClaTea(clatea);
return "SUCCESS";
} catch (Exception e) {
return "ERR";
}
}
/**
* Method name: updateClaTea <BR>
* Description: 更新教师 <BR>
*
* @param user
* @return String<BR>
*/
@ResponseBody
*
* @param user
* @return String<BR>
*/
@ResponseBody
@RequestMapping("/addMaterial")
public String addMaterial(Material material) {
try {
material.setCreateTime(new Date());
materialService.addMaterial(material);
return "SUCCESS";
} catch (Exception e) {
return "ERR";
}
}
/**
* Method name: updateMaterial <BR>
* Description: 更新教师 <BR>
*
* @param user
* @return String<BR>
*/
@ResponseBody
@RequestMapping("/updateMaterial")
public String updateMaterial(Material material) {
return materialService.updateMaterial(material);
}
/**
* Method name: delClaTea <BR>
* Description: 批量删除教师<BR>
*
* @param ids
* @return String<BR>
*/
@RequestMapping(value = "delMaterial")
@ResponseBody
@Transactional
public String delMaterial(String[] ids) {
try {
for (String id : ids) {
materialService.delMaterialById(Integer.parseInt(id));
public Object getPageByRole(Integer roleId) {
return pageService.getAllPageByRoleId(roleId);
}
/**
* Method name: updatePageById <BR>
* Description: 根据页面id更新页面 <BR>
*
* @param page
* @return ResultMap<BR>
*/
@RequestMapping("/updatePageById")
@ResponseBody
public ResultMap updatePageById(Page page) {
return pageService.updatePageById(page);
}
/**
* Method name: addPage <BR>
* Description: 添加页面 <BR>
*
* @param page
* @return Page<BR>
*/
@RequestMapping("/addPage")
@ResponseBody
public Page addPage(Page page) {
return pageService.addPage(page);
}
/**
* Method name: delPageById <BR>
* Description: 根据页面id删除页面 <BR>
*
* @param id
* @return ResultMap<BR>
*/
@RequestMapping("/delPageById")
@ResponseBody
public ResultMap delPageById(Integer id) {
if (null == id) {
//所有学生签到的总次数统计
@RequestMapping(value = "/tongJiXueSheng")
public String tongJiXueSheng(Model model) {
List<TongJi> ts = signService.getAllChildCount();
List<String> names = new ArrayList<>();
List<Integer> zc = new ArrayList<>();
List<Integer> tq = new ArrayList<>();
List<Integer> cd = new ArrayList<>();
for (TongJi tongJi : ts) {
names.add(tongJi.getUserName());
zc.add(tongJi.getZhengChang());
tq.add(tongJi.getTiQian());
cd.add(tongJi.getChiDao());
}
model.addAttribute("names", names);
model.addAttribute("zc", zc);
model.addAttribute("tq", tq);
model.addAttribute("cd", cd);
return "ls/tongJiXueSheng";
}
@RequestMapping(value = "/course")
public String course(Model model) {
return "ls/course";
}
//课程
@RequestMapping(value = "/courseAdd")
public String courseAdd(Model model) {
List<User> users = userService.selectAllTea();
model.addAttribute("users", users);
List<Classes> clas = classService.selectAllClasses();
model.addAttribute("cla", clas);
return "ls/courseAdd";
}
@RequestMapping("/getAllCourseByLimit")