基于javaweb的幼儿园管理系统(java+jsp+html+javascript+mysql)
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb+mysql的幼儿园管理系统(java+JSP+HTML+JavaScript+Mysql)
项目介绍
管理员角色包含以下功能: 管理员登录,管理员账号管理,修改密码,通知公告管理,教师管理,家长管理,班级管理,活动管理,教学内容管理,系统公告管理,系统简介管理,留言管理等功能。
用户角色包含以下功能: 查看首页,查看通知公告,家长注册,教师注册,在线留言,查看教学内容,查看教学内容详情,查看活动信息,活动信息详情,查看系统简介等功能。
教师角色包含以下功能: 查看首页,查看通知公告,家长注册,教师注册,在线留言,查看教学内容,查看上课内容详情,查看活动信息,查看活动信息详情等功能。
环境需要
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.数据库:MySql 5.7版本;
技术栈
HTML+CSS+JavaScript+jsp+mysql
使用说明
用户管理控制层:
@SuppressWarnings({ “unchecked”, “rawtypes” })
@Controller
@RequestMapping(“/user”)
public class UserController {
private final Logger logger = LoggerFactory.getLogger(UserController.class);
private final ResultMap resultMap;
@Autowired
private UserService userService;
@Autowired
private UserRoleService userRoleService;
@Autowired
public UserController(ResultMap resultMap) {
this.resultMap = resultMap;
@RequestMapping(value = “/getMessage”, method = RequestMethod.GET)
public ResultMap getMessage() {
return resultMap.success().message(“您拥有用户权限,可以获得该接口的信息!”);
@RequestMapping(value = “/editUserPage”)
public String editUserPage(String userId, Model model) {
model.addAttribute(“manageUser”, userId);
if (null != userId) {
User user = userService.selectByPrimaryKey(userId);
model.addAttribute(“manageUser”, user);
return “user/userEdit”;
@ResponseBody
@RequestMapping(“/updateUser”)
public String updateUser(User user) {
return userService.updateUser(user);
// 任务
/**
Descriiption: 查询所有管理员
@return List
*/
@ResponseBody
@RequestMapping(value = “/getAdmins”)
public List getAdmins() {
return userService.getAdmins();
/**
Descriiption: 查询所有授权用户
@return List
*/
@ResponseBody
@RequestMapping(value = “/getAllUser”)
public List getAllUser() {
return userService.getAllUser();
登录管理控制层:
@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
Descriiption: 退出登录
@return String
*/
@RequestMapping(value = “/logout”, method = RequestMethod.GET)
public String logout() {
Subject subject = SecurityUtils.getSubject();
User user = (User) subject.getPrincipal();
if (null != user) {
logger.info(“{}—退出登录!”, user.getUserName());
subject.logout();
return “login”;
/**
Method name: login
Descriiption: 登录验证
Remark:
@param username 用户名
@param password 密码
@return ResultMap
*/
@RequestMapping(value = “/login”)
@ResponseBody
public ResultMap login(String username, String password) {
return userService.login(username, password);
/**
Method name: login
Descriiption: 登录页面
@return String login.html
*/
@RequestMapping(value = “/index”)
public String login() {
return “login”;
/**
Method name: index
Descriiption: 登录页面
@return String login.html
*/
@RequestMapping(value = “/”)
public String index(Model model) {
Subject subject = SecurityUtils.getSubject();
User user = (User) subject.getPrincipal();
if (null != user) {
model.addAttribute(“user”, user);
List pageList = pageService.getAllRolePageByUserId(user.getUserId());
model.addAttribute(“pageList”, pageList);
return “index”;
} else {
return “login”;
/**
Method name: main
Descriiption: 进入主页面
@param model
@return String
*/
@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 pageList = pageService.getAllRolePageByUserId(user.getUserId());
model.addAttribute(“pageList”, pageList);
return “index”;
/**
Method name: checkUserPassword
Descriiption: 检测旧密码是否正确
@param password 旧密码
@return boolean 是否正确
*/
@RequestMapping(value = “/user/checkUserPassword”)
@ResponseBody
public boolean checkUserPassword(String password) {
return userService.checkUserPassword(password);
/**
Method name: updatePassword
Descriiption: 更新密码
@param password 旧密码
@return String 是否成功
*/
@RequestMapping(value = “/user/updatePassword”)
@ResponseBody
public String updatePassword(String password) {
return userService.updatePassword(password);
教师管理控制层:
@Controller
@RequestMapping(value = “/ls”)
public class TeacherController {
@Autowired
private StudentService studentService;
@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=classService.selectAllClasses();
model.addAttribute(“cla”, classes);
return “ls/stuPage”;
//学生管理
/**
Method name: teacherPage
Descriiption: 教师管理页面
@return String
*/
@RequestMapping(value = “/stuMG”)
public String teaMG(Model model) {
List classes=classService.selectAllClasses();
model.addAttribute(“cla”, classes);
return “ls/student”;
/**
Method name: getAllStudentByLimit
Descriiption: 根据条件获取所有教师
@param userParameter
@return Object
*/
@RequestMapping(“/getAllStudentByLimit”)
@ResponseBody
public Object getAllStudentByLimit(Children stuParameter) {
return studentService.getAllStudentByLimit(stuParameter);
/**
Method name: addStuPage
Descriiption: 增加教师界面
@return String
*/
@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=classService.selectAllClasses();
model.addAttribute(“cla”, classes);
List user=userService.selectAllJiazhang();
model.addAttribute(“user”, user);
return “ls/stuPageAdd”;
/**
Method name: addStu
Descriiption: 教师添加
@param user
@return String
*/
@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
Descriiption: 更新教师
@param user
@return String
*/
@ResponseBody
@RequestMapping(“/updateStudent”)
public String updateStudent(Children studnet) {
UserChildren uc = new UserChildren();
uc.setId(studnet.getUcId());
uc.setChildrenId(studnet.getId());
uc.setIsFaMa(studnet.getIsFaMa());
uc.setIsJinji(studnet.getIsJinji());
uc.setUserId(studnet.getUserId());
userChildrenService.updateUC(uc);
return studentService.updateStu(studnet);
/**
Method name: delClaTea
Descriiption: 批量删除教师
@param ids
@return String
*/
@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
Descriiption: 教师管理页面
@return String
*/
@RequestMapping(value = “/gg”)
public String gg() {
return “ls/notice”;
/**
Method name: getAllNoticeByLimit
Descriiption: 根据条件获取所有教师
@param userParameter
@return Object
*/
@RequestMapping(“/getAllNoticeByLimit”)
@ResponseBody
public Object getAllNoticeByLimit(Notice noticeParameter) {
return noticeService.getAllNoticeByLimit(noticeParameter);
/**
Method name: addStuPage
Descriiption: 增加教师界面
@return String
*/
@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
Descriiption: 教师添加
@param user
@return String
*/
@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
Descriiption: 更新教师
@param user
@return String
*/
@ResponseBody
@RequestMapping(“/updateNotice”)
public String updateNotice(Notice notice) {
return noticeService.updateStu(notice);
/**
Method name: delClaTea
Descriiption: 批量删除教师
@param ids
@return String
*/
@RequestMapping(value = “delNotice”)
@ResponseBody
@Transactional
public String delNotice(String[] ids) {
try {
for (String id : ids) {
noticeService.delNoticeById(Integer.parseInt(id));
return “SUCCESS”;
} catch (Exception e) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return “ERROR”;
//考勤管理
/**
Method name: lskq
Descriiption: 教师管理页面
@return String
*/
@RequestMapping(value = “/lskq”)
public String lskq() {
return “ls/sign”;
/**
Method name: getAllSignByLimit
Descriiption: 根据条件获取所有教师
@param userParameter
@return Object
*/
@RequestMapping(“/getAllSignByLimit”)
@ResponseBody
public Object getAllSignByLimit(Sign signParameter) {
return signService.getAllSignByLimit(signParameter);
//打卡
@RequestMapping(value = “/qianDaoTui”)
public String qianDaoTui() {
return “ls/daKa”;
/**
Method name: addStu
Descriiption: 教师添加
@param user
@return String
*/
@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());
sign.setKqrType(user.getUserState());
signService.addSign(sign);
return “SUCCESS”;
} catch (Exception e) {
return “ERR”;
/**
Method name: addStu
Descriiption: 教师添加
@param user
@return String
*/
@ResponseBody
@RequestMapping(“/addQianTui”)
public String addQianTui(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(“endTime”);
if(time.equals(“下午”) && time1.compareTo(s)<0) {
sign.setState(1);
}else{
sign.setState(2);
sign.setType(2);
sign.setSignIn(date);
sign.setKqrId(user.getUserId());
sign.setKqrType(user.getUserState());
signService.addSign(sign);
return “SUCCESS”;
} catch (Exception e) {
return “ERR”;
//学生考勤
@RequestMapping(value = “/xskq”)
public String xskq() {
return “ls/childSign”;
/**
Method name: getAllSignByLimit
Descriiption: 根据条件获取所有教师
@param userParameter
@return Object
*/
@RequestMapping(“/getAllChildSignByLimit”)
@ResponseBody
public Object getAllChildSignByLimit(Sign signParameter) {
return signService.getAllChildSignByLimit(signParameter);
//所有老师签到的总次数统计
@RequestMapping(value = “/kqtj”)
public String kqtj(Model model) {
List ts = signService.getAllTeacherCount();
List names = new ArrayList<>();
List zc = new ArrayList<>();
List tq = new ArrayList<>();
List 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/tongJi”;
//所有学生签到的总次数统计
@RequestMapping(value = “/tongJiXueSheng”)
public String tongJiXueSheng(Model model) {
List ts = signService.getAllChildCount();
List names = new ArrayList<>();
List zc = new ArrayList<>();
List tq = new ArrayList<>();
List 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 users = userService.selectAllTea();
model.addAttribute(“users”, users);
List 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
@RequestMapping(“/delCourse”)
public String delCourse(Integer id) {
try {
courseService.delCourse(id);
return “SUCCESS”;
} catch (Exception e) {
return “ERR”;