• Java项目:SSM学业预警平台信息管理系统


    作者主页:夜未央5788

     简介:Java领域优质创作者、Java项目、学习资料、技术互助

    文末获取源码

    项目介绍

    本项目为后台管理系统;

    管理员角色包含以下功能:

    管理员登录,学生管理,课程管理,课堂表现管理,成绩信息管理,作业管理,出勤信息管理,归宿情况管理,宿舍卫生管理等功能。

    环境需要

    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版本;

    6.是否Maven项目:是;

    技术栈

    1. 后端:Spring+SpringMVC+Mybatis

    2. 前端:HTML+CSS+JavaScript+jquery+bootstrap

    使用说明

    1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;

    2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;

    若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;

    3. 将项目中db.properties配置文件中的数据库配置改为自己的配置;

    4. 运行项目,输入localhost:8080/ssm_xueyeyujing_sys 登录

    运行截图

     

     

     

     

     

     

     

     

     

     代码相关

    出勤控制器

    1. package com.learn.controller;
    2. import java.util.List;
    3. import java.util.Map;
    4. import org.apache.shiro.authz.annotation.RequiresPermissions;
    5. import org.springframework.beans.factory.annotation.Autowired;
    6. import org.springframework.web.bind.annotation.PathVariable;
    7. import org.springframework.web.bind.annotation.RequestBody;
    8. import org.springframework.web.bind.annotation.RequestMapping;
    9. import org.springframework.web.bind.annotation.RequestParam;
    10. import org.springframework.web.bind.annotation.RestController;
    11. import com.learn.entity.ChuqinEntity;
    12. import com.learn.service.ChuqinService;
    13. import com.learn.utils.PageUtils;
    14. import com.learn.utils.Query;
    15. import com.learn.utils.R;
    16. /**
    17. * 出勤信息
    18. *
    19. * @author chenshun
    20. * @email sunlightcs@gmail.com
    21. * @date 2020-04-01 16:42:55
    22. */
    23. @RestController
    24. @RequestMapping("chuqin")
    25. public class ChuqinController extends AbstractController {
    26. @Autowired
    27. private ChuqinService chuqinService;
    28. /**
    29. * 列表
    30. */
    31. @RequestMapping("/list")
    32. public R list(@RequestParam Map params){
    33. if (super.getUserId() > 1)
    34. params.put("user", super.getUserId());
    35. //查询列表数据
    36. Query query = new Query(params);
    37. List chuqinList = chuqinService.queryList(query);
    38. int total = chuqinService.queryTotal(query);
    39. PageUtils pageUtil = new PageUtils(chuqinList, total, query.getLimit(), query.getPage());
    40. return R.ok().put("page", pageUtil);
    41. }
    42. /**
    43. * 列表
    44. */
    45. @RequestMapping("/list2")
    46. public R list2(@RequestParam Map params){
    47. Query query = new Query(params);
    48. List chuqinList = chuqinService.queryList(query);
    49. return R.ok().put("list", chuqinList );
    50. }
    51. /**
    52. * 信息
    53. */
    54. @RequestMapping("/info/{id}")
    55. public R info(@PathVariable("id") Long id){
    56. ChuqinEntity chuqin = chuqinService.queryObject(id);
    57. return R.ok().put("chuqin", chuqin);
    58. }
    59. /**
    60. * 保存
    61. */
    62. @RequestMapping("/save")
    63. public R save(@RequestBody ChuqinEntity chuqin){
    64. if (chuqin.getUser() == null)
    65. chuqin.setUser(super.getUserId());
    66. chuqinService.save(chuqin);
    67. return R.ok();
    68. }
    69. /**
    70. * 修改
    71. */
    72. @RequestMapping("/update")
    73. public R update(@RequestBody ChuqinEntity chuqin){
    74. chuqinService.update(chuqin);
    75. return R.ok();
    76. }
    77. /**
    78. * 删除
    79. */
    80. @RequestMapping("/delete")
    81. public R delete(@RequestBody Long[] ids){
    82. chuqinService.deleteBatch(ids);
    83. return R.ok();
    84. }
    85. }

    课程控制器

    1. package com.learn.controller;
    2. import java.util.List;
    3. import java.util.Map;
    4. import org.apache.shiro.authz.annotation.RequiresPermissions;
    5. import org.springframework.beans.factory.annotation.Autowired;
    6. import org.springframework.web.bind.annotation.PathVariable;
    7. import org.springframework.web.bind.annotation.RequestBody;
    8. import org.springframework.web.bind.annotation.RequestMapping;
    9. import org.springframework.web.bind.annotation.RequestParam;
    10. import org.springframework.web.bind.annotation.RestController;
    11. import com.learn.entity.CourseEntity;
    12. import com.learn.service.CourseService;
    13. import com.learn.utils.PageUtils;
    14. import com.learn.utils.Query;
    15. import com.learn.utils.R;
    16. /**
    17. * 课程信息
    18. *
    19. * @author chenshun
    20. * @email sunlightcs@gmail.com
    21. * @date 2020-04-01 16:42:55
    22. */
    23. @RestController
    24. @RequestMapping("course")
    25. public class CourseController extends AbstractController {
    26. @Autowired
    27. private CourseService courseService;
    28. /**
    29. * 列表
    30. */
    31. @RequestMapping("/list")
    32. public R list(@RequestParam Map params){
    33. //查询列表数据
    34. Query query = new Query(params);
    35. List courseList = courseService.queryList(query);
    36. int total = courseService.queryTotal(query);
    37. PageUtils pageUtil = new PageUtils(courseList, total, query.getLimit(), query.getPage());
    38. return R.ok().put("page", pageUtil);
    39. }
    40. /**
    41. * 列表
    42. */
    43. @RequestMapping("/list2")
    44. public R list2(@RequestParam Map params){
    45. Query query = new Query(params);
    46. List courseList = courseService.queryList(query);
    47. return R.ok().put("list", courseList );
    48. }
    49. /**
    50. * 信息
    51. */
    52. @RequestMapping("/info/{id}")
    53. public R info(@PathVariable("id") Long id){
    54. CourseEntity course = courseService.queryObject(id);
    55. return R.ok().put("course", course);
    56. }
    57. /**
    58. * 保存
    59. */
    60. @RequestMapping("/save")
    61. public R save(@RequestBody CourseEntity course){
    62. courseService.save(course);
    63. return R.ok();
    64. }
    65. /**
    66. * 修改
    67. */
    68. @RequestMapping("/update")
    69. public R update(@RequestBody CourseEntity course){
    70. courseService.update(course);
    71. return R.ok();
    72. }
    73. /**
    74. * 删除
    75. */
    76. @RequestMapping("/delete")
    77. public R delete(@RequestBody Long[] ids){
    78. courseService.deleteBatch(ids);
    79. return R.ok();
    80. }
    81. }

    登录控制器

    1. package com.learn.controller;
    2. import com.learn.entity.SysUserEntity;
    3. import com.learn.service.SysUserService;
    4. import com.learn.utils.R;
    5. import com.learn.utils.ShiroUtils;
    6. import java.awt.image.BufferedImage;
    7. import java.io.IOException;
    8. import java.util.ArrayList;
    9. import java.util.List;
    10. import javax.imageio.ImageIO;
    11. import javax.servlet.ServletException;
    12. import javax.servlet.ServletOutputStream;
    13. import javax.servlet.http.HttpServletResponse;
    14. import org.apache.shiro.authc.AuthenticationException;
    15. import org.apache.shiro.authc.IncorrectCredentialsException;
    16. import org.apache.shiro.authc.LockedAccountException;
    17. import org.apache.shiro.authc.UnknownAccountException;
    18. import org.apache.shiro.authc.UsernamePasswordToken;
    19. import org.apache.shiro.crypto.hash.Sha256Hash;
    20. import org.apache.shiro.subject.Subject;
    21. import org.springframework.beans.factory.annotation.Autowired;
    22. import org.springframework.stereotype.Controller;
    23. import org.springframework.web.bind.annotation.RequestMapping;
    24. import org.springframework.web.bind.annotation.RequestMethod;
    25. import org.springframework.web.bind.annotation.ResponseBody;
    26. import com.google.code.kaptcha.Constants;
    27. import com.google.code.kaptcha.Producer;
    28. /**
    29. * 登录相关
    30. *
    31. * @author chenshun
    32. * @email sunlightcs@gmail.com
    33. * @date 2018年11月10日 下午1:15:31
    34. */
    35. @Controller
    36. public class SysLoginController {
    37. @Autowired
    38. private Producer producer;
    39. @Autowired
    40. private SysUserService sysUserService;
    41. @RequestMapping("captcha.jpg")
    42. public void captcha(HttpServletResponse response) throws ServletException, IOException {
    43. response.setHeader("Cache-Control", "no-store, no-cache");
    44. response.setContentType("image/jpeg");
    45. //生成文字验证码
    46. String text = producer.createText();
    47. //生成图片验证码
    48. BufferedImage image = producer.createImage(text);
    49. //保存到shiro session
    50. ShiroUtils.setSessionAttribute(Constants.KAPTCHA_SESSION_KEY, text);
    51. ServletOutputStream out = response.getOutputStream();
    52. ImageIO.write(image, "jpg", out);
    53. }
    54. /**
    55. * 登录
    56. */
    57. @ResponseBody
    58. @RequestMapping(value = "/sys/login", method = RequestMethod.POST)
    59. public R login(String username, String password, String captcha) throws IOException {
    60. // String kaptcha = ShiroUtils.getKaptcha(Constants.KAPTCHA_SESSION_KEY);
    61. // if(!captcha.equalsIgnoreCase(kaptcha)){
    62. // return R.error("验证码不正确");
    63. // }
    64. try {
    65. Subject subject = ShiroUtils.getSubject();
    66. //sha256加密
    67. password = new Sha256Hash(password).toHex();
    68. UsernamePasswordToken token = new UsernamePasswordToken(username, password);
    69. subject.login(token);
    70. } catch (UnknownAccountException e) {
    71. return R.error(e.getMessage());
    72. } catch (IncorrectCredentialsException e) {
    73. return R.error(e.getMessage());
    74. } catch (LockedAccountException e) {
    75. return R.error(e.getMessage());
    76. } catch (AuthenticationException e) {
    77. return R.error("账户验证失败");
    78. }
    79. return R.ok();
    80. }
    81. /**
    82. */
    83. @ResponseBody
    84. @RequestMapping(value = "/sys/reg", method = RequestMethod.POST)
    85. public R reg(String username, String password, String captcha) throws IOException {
    86. // String kaptcha = ShiroUtils.getKaptcha(Constants.KAPTCHA_SESSION_KEY);
    87. // if(!captcha.equalsIgnoreCase(kaptcha)){
    88. // return R.error("验证码不正确");
    89. // }
    90. //sha256加密
    91. SysUserEntity user = new SysUserEntity();
    92. user.setUsername(username);
    93. user.setPassword(password);
    94. user.setStatus(1);
    95. List roles = new ArrayList<>();
    96. roles.add(1L);
    97. user.setRoleIdList(roles);
    98. this.sysUserService.save(user);
    99. return R.ok();
    100. }
    101. /**
    102. * 退出
    103. */
    104. @RequestMapping(value = "logout", method = RequestMethod.GET)
    105. public String logout() {
    106. ShiroUtils.logout();
    107. return "redirect:login.html";
    108. }
    109. }

    用户控制器

    1. package com.learn.controller;
    2. import com.learn.entity.SysUserEntity;
    3. import com.learn.service.SysUserRoleService;
    4. import com.learn.service.SysUserService;
    5. import com.learn.utils.PageUtils;
    6. import com.learn.utils.Query;
    7. import com.learn.utils.R;
    8. import com.learn.utils.ShiroUtils;
    9. import org.apache.commons.lang.ArrayUtils;
    10. import org.apache.shiro.crypto.hash.Sha256Hash;
    11. import org.springframework.beans.factory.annotation.Autowired;
    12. import org.springframework.web.bind.annotation.*;
    13. import java.util.List;
    14. import java.util.Map;
    15. /**
    16. * 系统用户
    17. *
    18. * @author chenshun
    19. * @email sunlightcs@gmail.com
    20. * @date 2018年10月31日 上午10:40:10
    21. */
    22. @RestController
    23. @RequestMapping("/sys/user")
    24. public class SysUserController extends AbstractController {
    25. @Autowired
    26. private SysUserService sysUserService;
    27. @Autowired
    28. private SysUserRoleService sysUserRoleService;
    29. /**
    30. * 所有用户列表
    31. */
    32. @RequestMapping("/list")
    33. public R list(@RequestParam Map params) {
    34. //查询列表数据
    35. Query query = new Query(params);
    36. List userList = sysUserService.queryList(query);
    37. int total = sysUserService.queryTotal(query);
    38. PageUtils pageUtil = new PageUtils(userList, total, query.getLimit(), query.getPage());
    39. return R.ok().put("page", pageUtil);
    40. }
    41. @RequestMapping("/list2")
    42. public R list2(@RequestParam Map params) {
    43. //查询列表数据
    44. Query query = new Query(params);
    45. List userList = sysUserService.queryList(query);
    46. return R.ok().put("list", userList);
    47. }
    48. /**
    49. * 获取登录的用户信息
    50. */
    51. @RequestMapping("/info")
    52. public R info() {
    53. return R.ok().put("user", this.sysUserService.queryObject(getUser().getUserId()));
    54. }
    55. /**
    56. * 修改登录用户密码
    57. */
    58. @RequestMapping("/password")
    59. public R password(String password, String newPassword) {
    60. //sha256加密
    61. password = new Sha256Hash(password).toHex();
    62. //sha256加密
    63. newPassword = new Sha256Hash(newPassword).toHex();
    64. //更新密码
    65. int count = sysUserService.updatePassword(getUserId(), password, newPassword);
    66. if (count == 0) {
    67. return R.error("原密码不正确");
    68. }
    69. //退出
    70. ShiroUtils.logout();
    71. return R.ok();
    72. }
    73. @RequestMapping("/updateInfo")
    74. public R updateInfo(@RequestBody SysUserEntity user) {
    75. this.sysUserService.update(user);
    76. return R.ok();
    77. }
    78. /**
    79. * 用户信息
    80. */
    81. @RequestMapping("/info/{userId}")
    82. public R info(@PathVariable("userId") Long userId) {
    83. SysUserEntity user = sysUserService.queryObject(userId);
    84. //获取用户所属的角色列表
    85. List roleIdList = sysUserRoleService.queryRoleIdList(userId);
    86. user.setRoleIdList(roleIdList);
    87. return R.ok().put("user", user);
    88. }
    89. /**
    90. * 保存用户
    91. */
    92. @RequestMapping("/save")
    93. public R save(@RequestBody SysUserEntity user) {
    94. user.setCreateUserId(getUserId());
    95. sysUserService.save(user);
    96. return R.ok();
    97. }
    98. /**
    99. * 修改用户
    100. */
    101. @RequestMapping("/update")
    102. public R update(@RequestBody SysUserEntity user) {
    103. user.setCreateUserId(getUserId());
    104. sysUserService.update(user);
    105. return R.ok();
    106. }
    107. /**
    108. * 删除用户
    109. */
    110. @RequestMapping("/delete")
    111. public R delete(@RequestBody Long[] userIds) {
    112. if (ArrayUtils.contains(userIds, 1L) || ArrayUtils.contains(userIds, -1L)) {
    113. return R.error("系统管理员不能删除");
    114. }
    115. if (ArrayUtils.contains(userIds, getUserId())) {
    116. return R.error("当前用户不能删除");
    117. }
    118. sysUserService.deleteBatch(userIds);
    119. return R.ok();
    120. }
    121. }

    如果也想学习本系统,下面领取。关注并回复:156ssm

  • 相关阅读:
    woocommerce虚拟商品和可下载商品介绍
    MySQL字符串合并
    thingsboard IoT gateway OPC-UA 连接器配置
    TRIZ理论下攀爬机器人的创新设计与研究
    MT6701磁编码器使用指南,14Bit单圈绝对值,I2C stm32 HAL库读角度
    工控产线安全该如何进行系统加固
    一文详解GaussDB(DWS) 的并发管控和内存管控
    排序算法(一)
    【JAVA学习笔记】64 - 坦克大战1.4,限制坦克发射子弹,敌方击中我方坦克爆炸
    Docker常规操作命令(常用)
  • 原文地址:https://blog.csdn.net/hanyunlong1989/article/details/126474622