基于javaweb+mysql的springboot蓝天幼儿园管理系统(java+springboot+thymeleaf+html+maven+mysql)
运行环境
Java≥8、MySQL≥5.7
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb+mysql的SpringBoot蓝天幼儿园管理系统(java+springboot+thymeleaf+html+maven+mysql)
项目介绍
蓝天幼儿园管理系统,共分为三种角色,管理员、家长、教师。
管理员角色具有功能:
系统管理-用户管理、页面管理、角色管理,
校园管理-老师管理、工资管理、物资管理、菜谱管理、班级管理
班级管理-学生管理、公告管理、课程管理
考勤管理-老师考勤、学生考勤、老师考勤统计、学生考勤统计、签到签退
技术栈
-
Springboot
-
html+thymeleaf
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可
4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
5.是否Maven项目: 是;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目
6.数据库:MySql 8.0版本;
使用说明
-
使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
-
将项目中yml配置文件中的数据库配置改为自己的配置
-
使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,
-
运行项目,输入localhost:8081 登录
-
管理员账户admin 密码123456
教师账号wangjianlin 密码123456
XiaoYuan xy = new XiaoYuan();
if(userId==null || userId.equals("null")) {
return JSON.toJSONString(xy);
}
//获取当天食物
Foot foot = jiaZhangService.getFoot();
//获取孩子信息
List<Children> childres = jiaZhangService.getChildren(userId);
//获取课程
Course course = null;
Sign qd = null;
Sign qt = null;
User bzr = null;
Classes cl = null;
if(childres.size()!=0) {
course = jiaZhangService.getCourse(childres.get(0).getClassId());
//签到记录
qd = jiaZhangService.getSign(1, childres.get(0).getId()+"");
qt = jiaZhangService.getSign(2, childres.get(0).getId()+"");
//获取班主任信息
bzr = jiaZhangService.getBZR(childres.get(0).getClassId());
//获取班级
cl = jiaZhangService.getClasses(childres.get(0).getClassId());
}
//获取家长信息
User jiazhang = jiaZhangService.getJiaZhang(userId);
if(bzr!=null) {
xy.setBanZhuRen(bzr.getUserName());
xy.setBanZhuRenHao(bzr.getUserTel());
}
if(cl!=null) {
xy.setClassName(cl.getName());
}
if(childres.size()!=0) {
xy.setcName(childres.get(0).getName());
}
if(qd!=null) {
xy.setQiandao(MyUtils.getDate2String(qd.getSignIn()));
* 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>
* Description: 更新教师 <BR>
*
* @param user
* @return String<BR>
*/
@ResponseBody
@RequestMapping("/updateFoot")
public String updateFoot(Foot foot) {
return footService.updateFoot(foot);
}
/**
* Method name: delFood <BR>
* Description: 批量删除教师<BR>
*
* @param ids
* @return String<BR>
*/
@RequestMapping(value = "delFood")
@ResponseBody
@Transactional
public String delFood(String[] ids) {
try {
for (String id : ids) {
footService.delFootById(Integer.parseInt(id));
}
return "SUCCESS";
} catch (Exception e) {
logger.error("根据班级id删除异常", e);
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return "ERROR";
}
}
}
uc.setUserId(studnet.getUserId());
userChildrenService.updateUC(uc);
return studentService.updateStu(studnet);
}
/**
* Method name: delClaTea <BR>
* Description: 批量删除教师<BR>
*
* @param ids
* @return String<BR>
*/
@RequestMapping(value = "delStudent")
@ResponseBody
@Transactional
public String delStudent(String[] ids) {
try {
for (String id : ids) {
studentService.delStudentById(Integer.parseInt(id));
}
return "SUCCESS";
} catch (Exception e) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return "ERROR";
}
}
//公告管理
/**
* Method name: gg <BR>
* Description: 教师管理页面 <BR>
*
* @return String<BR>
*/
@RequestMapping(value = "/gg")
public String gg() {
return "ls/notice";
}
/**
* Method name: getAllNoticeByLimit <BR>
}
List<Classes> classes=classService.selectAllClasses();
model.addAttribute("cla", classes);
List<User> user=userService.selectAllJiazhang();
model.addAttribute("user", user);
return "ls/stuPageAdd";
}
/**
* Method name: addStu <BR>
* Description: 教师添加 <BR>
*
* @param user
* @return String<BR>
*/
@ResponseBody
@RequestMapping("/addStu")
public String addStu(Children student) {
try {
studentService.addStudent(student);
addUserChildren(student);
return "SUCCESS";
} catch (Exception e) {
return "ERR";
}
}
public void addUserChildren(Children student) {
UserChildren userChildern = new UserChildren();
userChildern.setChildrenId(student.getId());
userChildern.setUserId(student.getUserId());
userChildern.setIsFaMa(student.getIsFaMa());
userChildern.setIsJinji(student.getIsJinji());
userChildrenService.addUserChildren(userChildern);
}
/**
* Method name: updateStudent <BR>
* Description: 更新教师 <BR>
*
* @param user
* @return String<BR>
*/
@ResponseBody
@RequestMapping("/updateStudent")
public String updateStudent(Children studnet) {
/**
* Method name: teacherPage <BR>
* Description: 教师管理页面 <BR>
*
* @return String<BR>
*/
@RequestMapping(value = "/teaMG")
public String teaMG() {
return "sa/claTea";
}
/**
* Method name: getAllTeacherByLimit <BR>
* Description: 根据条件获取所有教师 <BR>
*
* @param userParameter
* @return Object<BR>
*/
@RequestMapping("/getAllTeacherByLimit")
@ResponseBody
public Object getAllTeacherByLimit(ClaTea teaParameter) {
return teaService.getAllTeaByLimit(teaParameter);
}
/**
* Method name: addTeaPage <BR>
* Description: 增加教师界面 <BR>
*
* @return String<BR>
*/
@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";
}
* 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: updatePassword <BR>
* Description: 更新密码 <BR>
*
* @param password 旧密码
* @return String 是否成功<BR>
*/
@RequestMapping(value = "/user/updatePassword")
@ResponseBody
public String updatePassword(String password) {
return userService.updatePassword(password);
}
}
/*
* All rights Reserved, Copyright (C) Aisino LIMITED 2018
* FileName: WebConfig.java
* Version: $Revision$
* Modify record:
* NO. | Date | Name | Content
public ResultMap login(String username, String password) {
return userService.login(username, password);
}
/**
* Method name: login <BR>
* Description: 登录页面 <BR>
*
* @return String login.html<BR>
*/
@RequestMapping(value = "/index")
public String login() {
return "login";
}
/**
* Method name: index <BR>
* Description: 登录页面 <BR>
*
* @return String login.html<BR>
*/
@RequestMapping(value = "/")
public String index(Model model) {
Subject subject = SecurityUtils.getSubject();
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);
@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));
}
return "SUCCESS";
} catch (Exception e) {
logger.error("根据班级id删除异常", e);
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return "ERROR";
}
}
/**
* Method name: getAllPage <BR>
* Description: 获取所有页面 <BR>
*
* @return List<Page><BR>
*/
@RequestMapping("/getAllPage")
@ResponseBody
public List<Page> getAllPage() {
return pageService.getAllPage();
}
/**
* Method name: getPageByRole <BR>
* Description: 获取某个角色的权限页面 <BR>
*
* @param userId
* @return Object<BR>
*/
@RequestMapping("/getPageByRole")
@ResponseBody
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);
}
/**
@Controller
@RequestMapping(value = "/jz")
@ResponseBody
public class JiaZhangController {
@Autowired
NoticeService noticeService;
@Autowired
JiaZhangService jiaZhangService;
@Autowired
SignService signService;
@RequestMapping(value = "/notices")
public Object notices() {
List<Notice> notices = new ArrayList<>();
notices = noticeService.getAllNotice();
return JSON.toJSONString(notices);
}
@RequestMapping(value = "/xy")
public Object xy(String userId) {
XiaoYuan xy = new XiaoYuan();
if(userId==null || userId.equals("null")) {
return JSON.toJSONString(xy);
}
//获取当天食物
Foot foot = jiaZhangService.getFoot();
//获取孩子信息
List<Children> childres = jiaZhangService.getChildren(userId);
//获取课程
Course course = null;
Sign qd = null;
Sign qt = null;
User bzr = null;
Classes cl = null;
if(childres.size()!=0) {
course = jiaZhangService.getCourse(childres.get(0).getClassId());
//签到记录
qd = jiaZhangService.getSign(1, childres.get(0).getId()+"");
qt = jiaZhangService.getSign(2, childres.get(0).getId()+"");
/**
* 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);
}
List<Classes> classes=classService.selectAllClasses();
model.addAttribute("cla", classes);
List<User> user=userService.selectAllJiazhang();
model.addAttribute("user", user);
return "ls/stuPageAdd";
}
/**
* Method name: addStu <BR>
* Description: 教师添加 <BR>
*
* Method name: delManageRole <BR>
* Description: 根据角色id删除角色 <BR>
*
* @param id
* @return String<BR>
*/
@RequestMapping("/delRole")
@ResponseBody
public String delRole(int id) {
// 删除角色
boolean flag1 = roleService.delRoleById(id);
// 删除角色_权限表
boolean flag2 = pageRoleService.delPageRoleByRoleId(id);
// 删除某个角色的所有用户
boolean flag3 = userRoleService.delUserRoleByRoleId(id);
if (flag1 && flag2 && flag3) {
return "SUCCESS";
}
return "ERROR";
}
/**
* Method name: updateRole <BR>
* Description: 根据权限id修改权限信息 <BR>
*
* @param id
* @param name
* @return String<BR>
*/
@RequestMapping("/updateRole")
@ResponseBody
public String updateRole(Integer id, String name) {
int n = roleService.updateRoleById(id, name);
if (n != 0) {
return "SUCCESS";
}
return "ERROR";
}
/**
* Method name: addPageRoleByRoleId <BR>
* Description: 增加某个角色的权限页面 <BR>
*
* @param roleId
* @param pageIds
* @return String<BR>
*/
@RequestMapping("/addPageRoleByRoleId")
@ResponseBody
public String addPageRoleByRoleId(Integer roleId, Integer[] pageIds) {
@Controller
@RequestMapping(value = "/jz")
@ResponseBody
public class JiaZhangController {
@Autowired
NoticeService noticeService;
@Autowired
JiaZhangService jiaZhangService;
@Autowired
SignService signService;
@RequestMapping(value = "/notices")
public Object notices() {
List<Notice> notices = new ArrayList<>();
notices = noticeService.getAllNotice();
return JSON.toJSONString(notices);
}
@RequestMapping(value = "/xy")
public Object xy(String userId) {
XiaoYuan xy = new XiaoYuan();
if(userId==null || userId.equals("null")) {
return JSON.toJSONString(xy);
}
//获取当天食物
Foot foot = jiaZhangService.getFoot();
//获取孩子信息
List<Children> childres = jiaZhangService.getChildren(userId);
//获取课程
Course course = null;
Sign qd = null;
Sign qt = null;
User bzr = null;
Classes cl = null;
if(childres.size()!=0) {
*
* @param id
* @return String<BR>
*/
@RequestMapping("/delRole")
@ResponseBody
public String delRole(int id) {
// 删除角色
boolean flag1 = roleService.delRoleById(id);
// 删除角色_权限表
boolean flag2 = pageRoleService.delPageRoleByRoleId(id);
// 删除某个角色的所有用户
boolean flag3 = userRoleService.delUserRoleByRoleId(id);
if (flag1 && flag2 && flag3) {
return "SUCCESS";
}
return "ERROR";
}
/**
* Method name: updateRole <BR>
* Description: 根据权限id修改权限信息 <BR>
*
* @param id
* @param name
* @return String<BR>
*/
@RequestMapping("/updateRole")
@ResponseBody
public String updateRole(Integer id, String name) {
int n = roleService.updateRoleById(id, name);
if (n != 0) {
return "SUCCESS";
}
return "ERROR";
}
/**
* Method name: addPageRoleByRoleId <BR>
* Description: 增加某个角色的权限页面 <BR>
*
* @param roleId
* @param pageIds
* @return String<BR>
*/
@RequestMapping("/addPageRoleByRoleId")
}
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")
@ResponseBody
public Object getAllCourseByLimit(Course course) {
return courseService.getAllCourseByLimit(course);
}
@ResponseBody
@RequestMapping("/addCourse")
public String addCourse(Course course) {
course.setCreateTime(new Date());
try {
courseService.addCourse(course);
return "SUCCESS";
} catch (Exception e) {
return "ERR";
}
}
@ResponseBody
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";
}
}
/**
* Method name: updateStudent <BR>
* Description: 更新教师 <BR>
*
* @param user
* @return String<BR>
*/
@ResponseBody
@RequestMapping("/updateNotice")
public String updateNotice(Notice notice) {
return noticeService.updateStu(notice);
}
/**
* Method name: delClaTea <BR>
* Description: 批量删除教师<BR>
*
* @param ids
* @return String<BR>
*/
@RequestMapping(value = "delNotice")
@ResponseBody
@Transactional
public String delNotice(String[] ids) {
try {
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(Integer.parseInt(type));
sign.setKqrType(2);
sign.setSignIn(new Date());
signService.addSign(sign);
}else {
//签退
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";
}
}