diff --git a/README.md b/README.md index 3f2357f..6ca13c3 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,17 @@ # socialPractiseManagementSys a course of SSM's homework + +一份SSM课程的期末大作业 +是一个学生信息管理系统 + +运行时需要自行将jdbcConfig.sample.properties重命名为jdbcConfig.properties + +同时使用maven导入pom.xml中指定的包 + +自行修改其中连接数据库的账号和密码,并且使用sql文件夹中的sql语句创建数据库 + +项目使用Spring+SpringMVC+Mybatis-plus+shiro作为框架,前后端不分离,选择了原始的jsp,并在jsp中使用了vue.js以进行一部分mvvm架构的页面设计 + +德鲁伊后台的密码在web.xml中进行配置 + +前段样式基本采用element-ui \ No newline at end of file diff --git a/src/main/java/com/peteralbus/config/CustomRealm.java b/src/main/java/com/peteralbus/config/CustomRealm.java index 3372be1..d3d4990 100644 --- a/src/main/java/com/peteralbus/config/CustomRealm.java +++ b/src/main/java/com/peteralbus/config/CustomRealm.java @@ -2,11 +2,9 @@ package com.peteralbus.config; import com.peteralbus.entity.User; import com.peteralbus.service.UserService; -import com.peteralbus.util.Md5Util; import org.apache.shiro.authc.*; import org.apache.shiro.authz.AuthorizationInfo; import org.apache.shiro.authz.SimpleAuthorizationInfo; -import org.apache.shiro.realm.AuthenticatingRealm; import org.apache.shiro.realm.AuthorizingRealm; import org.apache.shiro.subject.PrincipalCollection; import org.apache.shiro.util.ByteSource; @@ -18,11 +16,15 @@ import java.util.Set; /** * The type Custom realm. + * * @author PeterAlbus */ @Component public class CustomRealm extends AuthorizingRealm { + /** + * The User service. + */ @Autowired UserService userService; @Override @@ -53,21 +55,14 @@ public class CustomRealm extends AuthorizingRealm @Override protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException { - // token是用户输入的用户名和密码 - // 第一步从token中取出用户名 String principal = (String) token.getPrincipal(); User user=userService.queryByUsername(principal); - // 第二步:根据用户输入的userCode从数据库查询用户信息 if(user==null) { throw new UnknownAccountException("用户名不存在!"); } - // 从数据库查询到密码 String credentials = user.getPassword(); - //盐 String salt = user.getUserSalt(); - - // 如果查询到,返回认证信息AuthenticationInfo return new SimpleAuthenticationInfo(user,credentials,ByteSource.Util.bytes(salt),getName()); } diff --git a/src/main/java/com/peteralbus/config/CustomRolesAuthorizationFilter.java b/src/main/java/com/peteralbus/config/CustomRolesAuthorizationFilter.java index 7dbea5b..9c0e43e 100644 --- a/src/main/java/com/peteralbus/config/CustomRolesAuthorizationFilter.java +++ b/src/main/java/com/peteralbus/config/CustomRolesAuthorizationFilter.java @@ -7,6 +7,7 @@ import org.apache.shiro.web.filter.authz.AuthorizationFilter; /** * The type Custom roles authorization filter. + * * @author chen1218chen(csdn) */ public class CustomRolesAuthorizationFilter extends AuthorizationFilter diff --git a/src/main/java/com/peteralbus/controller/AccountController.java b/src/main/java/com/peteralbus/controller/AccountController.java index 13d68b0..24c82f1 100644 --- a/src/main/java/com/peteralbus/controller/AccountController.java +++ b/src/main/java/com/peteralbus/controller/AccountController.java @@ -14,6 +14,7 @@ import javax.servlet.http.HttpSession; /** * The type Account controller. + * * @author PeterAlbus */ @Controller @@ -22,6 +23,7 @@ public class AccountController /** * Login model and view. * + * @param session the session * @return the model and view */ @RequestMapping("/login") @@ -37,6 +39,11 @@ public class AccountController return modelAndView; } + /** + * Register model and view. + * + * @return the model and view + */ @RequestMapping("/register") public ModelAndView register() { @@ -45,6 +52,11 @@ public class AccountController return modelAndView; } + /** + * Refuse model and view. + * + * @return the model and view + */ @RequiresAuthentication @RequestMapping("/refuse") public ModelAndView refuse() diff --git a/src/main/java/com/peteralbus/controller/AdminController.java b/src/main/java/com/peteralbus/controller/AdminController.java index 1da1001..69228f6 100644 --- a/src/main/java/com/peteralbus/controller/AdminController.java +++ b/src/main/java/com/peteralbus/controller/AdminController.java @@ -26,10 +26,19 @@ import java.util.List; @RequestMapping("/admin") public class AdminController { + /** + * The Message service. + */ @Autowired MessageService messageService; + /** + * The Activity service. + */ @Autowired ActivityService activityService; + /** + * The User service. + */ @Autowired UserService userService; private ModelAndView basicModelAndView() @@ -39,6 +48,12 @@ public class AdminController modelAndView.addObject("newMessageList",messageService.getNewMessage()); return modelAndView; } + + /** + * Activities model and view. + * + * @return the model and view + */ @RequestMapping("/activities") public ModelAndView activities() { @@ -48,6 +63,12 @@ public class AdminController modelAndView.setViewName("/jsp/admin/activities.jsp"); return modelAndView; } + + /** + * Users model and view. + * + * @return the model and view + */ @RequestMapping("/users") public ModelAndView users() { @@ -57,6 +78,13 @@ public class AdminController modelAndView.setViewName("/jsp/admin/users.jsp"); return modelAndView; } + + /** + * Restore activity string. + * + * @param activityId the activity id + * @return the string + */ @ResponseBody @RequestMapping("/restoreActivity") public String restoreActivity(Long activityId) @@ -67,6 +95,13 @@ public class AdminController } return "error"; } + + /** + * Reset password string. + * + * @param userId the user id + * @return the string + */ @ResponseBody @RequestMapping("/resetPassword") public String resetPassword(Long userId) @@ -79,6 +114,13 @@ public class AdminController } return "error"; } + + /** + * Sets admin. + * + * @param userId the user id + * @return the admin + */ @ResponseBody @RequestMapping("/setAdmin") public String setAdmin(Long userId) diff --git a/src/main/java/com/peteralbus/controller/PageController.java b/src/main/java/com/peteralbus/controller/PageController.java index ea58ba2..9090217 100644 --- a/src/main/java/com/peteralbus/controller/PageController.java +++ b/src/main/java/com/peteralbus/controller/PageController.java @@ -23,15 +23,25 @@ import java.util.TreeMap; /** * The type Page controller. + * * @author PeterAlbus */ @Controller public class PageController { + /** + * The User service. + */ @Autowired UserService userService; + /** + * The Message service. + */ @Autowired MessageService messageService; + /** + * The Activity service. + */ @Autowired ActivityService activityService; /** @@ -46,6 +56,12 @@ public class PageController modelAndView.addObject("newMessageList",messageService.getNewMessage()); return modelAndView; } + + /** + * Home page model and view. + * + * @return the model and view + */ @RequestMapping("/index") public ModelAndView homePage() { @@ -71,6 +87,13 @@ public class PageController modelAndView.setViewName("/jsp/home.jsp"); return modelAndView; } + + /** + * User detail model and view. + * + * @param userId the user id + * @return the model and view + */ @RequestMapping("/user") public ModelAndView userDetail(Long userId) { @@ -92,6 +115,13 @@ public class PageController modelAndView.setViewName("/jsp/account/user.jsp"); return modelAndView; } + + /** + * User center model and view. + * + * @param session the session + * @return the model and view + */ @RequestMapping("/userCenter") public ModelAndView userCenter(HttpSession session) { @@ -104,6 +134,12 @@ public class PageController modelAndView.setViewName("/jsp/account/userCenter.jsp"); return modelAndView; } + + /** + * Message list model and view. + * + * @return the model and view + */ @RequestMapping("/messageList") public ModelAndView messageList() { @@ -112,6 +148,13 @@ public class PageController modelAndView.setViewName("/jsp/message/messageList.jsp"); return modelAndView; } + + /** + * Message model and view. + * + * @param messageId the message id + * @return the model and view + */ @RequestMapping("/message") public ModelAndView message(Long messageId) { @@ -119,6 +162,13 @@ public class PageController modelAndView.setViewName("/jsp/message/message.jsp"); return modelAndView; } + + /** + * Read message string. + * + * @param messageId the message id + * @return the string + */ @ResponseBody @RequestMapping("/readMessage") public String readMessage(Long messageId) diff --git a/src/main/java/com/peteralbus/controller/StudentController.java b/src/main/java/com/peteralbus/controller/StudentController.java index 2ea9e88..82656f2 100644 --- a/src/main/java/com/peteralbus/controller/StudentController.java +++ b/src/main/java/com/peteralbus/controller/StudentController.java @@ -19,6 +19,7 @@ import java.util.Map; /** * The type Student controller. + * * @author peteralbus */ @Controller @@ -26,14 +27,29 @@ import java.util.Map; @RequestMapping("/student") public class StudentController { + /** + * The Message service. + */ @Autowired MessageService messageService; + /** + * The Activity service. + */ @Autowired ActivityService activityService; + /** + * The Group service. + */ @Autowired GroupService groupService; + /** + * The Participate service. + */ @Autowired ParticipateService participateService; + /** + * The Record service. + */ @Autowired RecordService recordService; private ModelAndView basicModelAndView() @@ -43,6 +59,12 @@ public class StudentController modelAndView.addObject("newMessageList",messageService.getNewMessage()); return modelAndView; } + + /** + * Activities model and view. + * + * @return the model and view + */ @RequestMapping("/activities") public ModelAndView activities() { @@ -56,6 +78,13 @@ public class StudentController modelAndView.setViewName("/jsp/student/activities.jsp"); return modelAndView; } + + /** + * Apply activity model and view. + * + * @param activityId the activity id + * @return the model and view + */ @RequestMapping("/applyActivity") public ModelAndView applyActivity(Long activityId) { @@ -74,6 +103,13 @@ public class StudentController modelAndView.setViewName("/jsp/student/applyActivity.jsp"); return modelAndView; } + + /** + * Manage activity model and view. + * + * @param activityId the activity id + * @return the model and view + */ @RequestMapping("/manageActivity") public ModelAndView manageActivity(Long activityId) { @@ -120,6 +156,13 @@ public class StudentController modelAndView.addObject("activity",activity); return modelAndView; } + + /** + * Insert record string. + * + * @param record the record + * @return the string + */ @ResponseBody @RequestMapping("/insertRecord") public String insertRecord(Record record) @@ -139,6 +182,13 @@ public class StudentController } return "success"; } + + /** + * Accept join string. + * + * @param participateId the participate id + * @return the string + */ @ResponseBody @RequestMapping("/acceptJoin") public String acceptJoin(Long participateId) @@ -153,6 +203,13 @@ public class StudentController "小组申请通过通知","先前申请社会实践小组的申请通过了!快去看看!(活动id:"+participate.getActivityId()+")"); return "success"; } + + /** + * Refuse join string. + * + * @param participateId the participate id + * @return the string + */ @ResponseBody @RequestMapping("/refuseJoin") public String refuseJoin(Long participateId) @@ -167,6 +224,13 @@ public class StudentController "小组申请拒绝通知","很遗憾,你加入小组的申请被组长拒绝了(活动id:"+participate.getActivityId()+")"); return "success"; } + + /** + * Participate with new group string. + * + * @param group the group + * @return the string + */ @ResponseBody @RequestMapping("/participateWithNewGroup") public String participateWithNewGroup(Group group) @@ -181,6 +245,13 @@ public class StudentController return "error"; } } + + /** + * Participate with old group string. + * + * @param groupId the group id + * @return the string + */ @ResponseBody @RequestMapping("/participateWithOldGroup") public String participateWithOldGroup(Long groupId) @@ -206,6 +277,13 @@ public class StudentController return "error"; } } + + /** + * Delete activity string. + * + * @param participationId the participation id + * @return the string + */ @ResponseBody @RequestMapping("/deleteParticipate") public String deleteActivity(Long participationId) diff --git a/src/main/java/com/peteralbus/controller/TeacherController.java b/src/main/java/com/peteralbus/controller/TeacherController.java index 3dd8e20..858cef0 100644 --- a/src/main/java/com/peteralbus/controller/TeacherController.java +++ b/src/main/java/com/peteralbus/controller/TeacherController.java @@ -20,6 +20,7 @@ import java.util.Map; /** * The type Teacher controller. + * * @author PeterAlbus */ @Controller @@ -27,20 +28,44 @@ import java.util.Map; @RequestMapping("/teacher") public class TeacherController { + /** + * The Activity service. + */ @Autowired ActivityService activityService; + /** + * The User service. + */ @Autowired UserService userService; + /** + * The Group service. + */ @Autowired GroupService groupService; + /** + * The Record service. + */ @Autowired RecordService recordService; + /** + * The Score group service. + */ @Autowired ScoreGroupService scoreGroupService; + /** + * The Score stu service. + */ @Autowired ScoreStuService scoreStuService; + /** + * The Message service. + */ @Autowired MessageService messageService; + /** + * The Participate service. + */ @Autowired ParticipateService participateService; private ModelAndView basicModelAndView() @@ -50,6 +75,12 @@ public class TeacherController modelAndView.addObject("newMessageList",messageService.getNewMessage()); return modelAndView; } + + /** + * Activities model and view. + * + * @return the model and view + */ @RequestMapping("/activities") public ModelAndView activities() { @@ -63,6 +94,13 @@ public class TeacherController modelAndView.setViewName("/jsp/teacher/activity.jsp"); return modelAndView; } + + /** + * Activity detail model and view. + * + * @param activityId the activity id + * @return the model and view + */ @RequestMapping("/activityDetail") public ModelAndView activityDetail(Long activityId) { @@ -72,6 +110,13 @@ public class TeacherController modelAndView.setViewName("/jsp/teacher/activityDetail.jsp"); return modelAndView; } + + /** + * Modify activity model and view. + * + * @param activityId the activity id + * @return the model and view + */ @RequestMapping("/modifyActivity") public ModelAndView modifyActivity(Long activityId) { @@ -91,6 +136,13 @@ public class TeacherController modelAndView.setViewName("/jsp/teacher/modifyActivity.jsp"); return modelAndView; } + + /** + * Manage group model and view. + * + * @param groupId the group id + * @return the model and view + */ @RequestMapping("/manageGroup") public ModelAndView manageGroup(Long groupId) { @@ -112,6 +164,13 @@ public class TeacherController modelAndView.setViewName("/jsp/teacher/manageGroup.jsp"); return modelAndView; } + + /** + * Add activity string. + * + * @param activity the activity + * @return the string + */ @ResponseBody @RequestMapping("/addActivity") public String addActivity(Activity activity) @@ -133,6 +192,13 @@ public class TeacherController return "error:"+e.getMessage(); } } + + /** + * Update activity string. + * + * @param activity the activity + * @return the string + */ @ResponseBody @RequestMapping("/updateActivity") public String updateActivity(Activity activity) @@ -154,6 +220,13 @@ public class TeacherController return "error:"+e.getMessage(); } } + + /** + * Delete activity string. + * + * @param activityId the activity id + * @return the string + */ @ResponseBody @RequestMapping("/deleteActivity") public String deleteActivity(Long activityId) @@ -175,6 +248,14 @@ public class TeacherController return "error:"+e.getMessage(); } } + + /** + * Add teacher to activity string. + * + * @param userId the user id + * @param activityId the activity id + * @return the string + */ @ResponseBody @RequestMapping("/addTeacherToActivity") public String addTeacherToActivity(Long userId,Long activityId) @@ -192,6 +273,13 @@ public class TeacherController } return "error"; } + + /** + * Sets read. + * + * @param recordId the record id + * @return the read + */ @ResponseBody @RequestMapping("/setRead") public String setRead(Long recordId) @@ -203,6 +291,13 @@ public class TeacherController } return "error"; } + + /** + * Score stu string. + * + * @param scoreStu the score stu + * @return the string + */ @ResponseBody @RequestMapping("/scoreStu") public String scoreStu(ScoreStu scoreStu) @@ -217,6 +312,13 @@ public class TeacherController } return "error"; } + + /** + * Score group string. + * + * @param scoreGroup the score group + * @return the string + */ @ResponseBody @RequestMapping("/scoreGroup") public String scoreGroup(ScoreGroup scoreGroup) diff --git a/src/main/java/com/peteralbus/controller/UserController.java b/src/main/java/com/peteralbus/controller/UserController.java index b706875..0c81e8c 100644 --- a/src/main/java/com/peteralbus/controller/UserController.java +++ b/src/main/java/com/peteralbus/controller/UserController.java @@ -34,8 +34,14 @@ import java.util.List; @RequestMapping("/user") public class UserController { + /** + * The User service. + */ @Autowired UserService userService; + /** + * The Message service. + */ @Autowired MessageService messageService; @@ -46,11 +52,13 @@ public class UserController modelAndView.addObject("newMessageList",messageService.getNewMessage()); return modelAndView; } + /** * Login string. * - * @param username the username - * @param password the password + * @param username the username + * @param password the password + * @param rememberMe the remember me * @return the string */ @ResponseBody @@ -73,6 +81,13 @@ public class UserController } return "success"; } + + /** + * Register string. + * + * @param user the user + * @return the string + */ @ResponseBody @RequestMapping("/register") public String register(User user) @@ -102,6 +117,13 @@ public class UserController return "注册失败:"+e.getMessage(); } } + + /** + * Update user string. + * + * @param user the user + * @return the string + */ @ResponseBody @RequestMapping("/updateUser") public String updateUser(User user) @@ -121,6 +143,15 @@ public class UserController return "error"; } } + + /** + * Change password model and view. + * + * @param oldPassword the old password + * @param newPassword the new password + * @param session the session + * @return the model and view + */ @RequestMapping("/changePassword") public ModelAndView changePassword(String oldPassword, String newPassword, HttpSession session) { @@ -156,6 +187,12 @@ public class UserController } return modelAndView; } + + /** + * Delete user model and view. + * + * @return the model and view + */ @RequestMapping("/deleteUser") public ModelAndView deleteUser() { diff --git a/src/main/java/com/peteralbus/handler/MyMetaObjectHandler.java b/src/main/java/com/peteralbus/handler/MyMetaObjectHandler.java index c257ed3..8224515 100644 --- a/src/main/java/com/peteralbus/handler/MyMetaObjectHandler.java +++ b/src/main/java/com/peteralbus/handler/MyMetaObjectHandler.java @@ -7,6 +7,7 @@ import java.time.LocalDateTime; /** * The type My meta-object handler. + * * @author PeterAlbus */ public class MyMetaObjectHandler implements MetaObjectHandler diff --git a/src/main/java/com/peteralbus/service/ActivityService.java b/src/main/java/com/peteralbus/service/ActivityService.java index 5dbbffd..0ed950b 100644 --- a/src/main/java/com/peteralbus/service/ActivityService.java +++ b/src/main/java/com/peteralbus/service/ActivityService.java @@ -162,6 +162,12 @@ public class ActivityService return activityList; } + /** + * Gets teacher list. + * + * @param activityId the activity id + * @return the teacher list + */ public List getTeacherList(Long activityId) { return activityDao.getTeacherList(activityId); @@ -177,6 +183,12 @@ public class ActivityService return activityDao.getCount(); } + /** + * Delete activity int. + * + * @param activityId the activity id + * @return the int + */ public int deleteActivity(Long activityId) { int result=0; @@ -200,11 +212,22 @@ public class ActivityService return result; } + /** + * Admin activity list list. + * + * @return the list + */ public List adminActivityList() { return activityDao.adminActivityList(); } + /** + * Restore int. + * + * @param activityId the activity id + * @return the int + */ public int restore(Long activityId) { int result=0; @@ -222,6 +245,12 @@ public class ActivityService return result; } + /** + * Gets user stat. + * + * @param user the user + * @return the user stat + */ public Map getUserStat(User user) { Map stat=new TreeMap<>(); diff --git a/src/main/java/com/peteralbus/service/GroupService.java b/src/main/java/com/peteralbus/service/GroupService.java index f7d7e3b..24f4f32 100644 --- a/src/main/java/com/peteralbus/service/GroupService.java +++ b/src/main/java/com/peteralbus/service/GroupService.java @@ -36,9 +36,15 @@ public class GroupService @Autowired ParticipateDao participateDao; + /** + * The Score group dao. + */ @Autowired ScoreGroupDao scoreGroupDao; + /** + * The Score stu dao. + */ @Autowired ScoreStuDao scoreStuDao; @@ -115,6 +121,12 @@ public class GroupService return memberList; } + /** + * Gets score. + * + * @param groupId the group id + * @return the score + */ public Map getScore(Long groupId) { Map map=new HashMap<>(); diff --git a/src/main/java/com/peteralbus/service/MessageService.java b/src/main/java/com/peteralbus/service/MessageService.java index 4732524..43d9943 100644 --- a/src/main/java/com/peteralbus/service/MessageService.java +++ b/src/main/java/com/peteralbus/service/MessageService.java @@ -13,13 +13,23 @@ import java.util.List; /** * The type Message service. + * * @author peteralbus */ @Service public class MessageService { + /** + * The Message dao. + */ @Autowired MessageDao messageDao; + + /** + * Gets message. + * + * @return the message + */ public List getMessage() { Subject subject = SecurityUtils.getSubject(); @@ -28,6 +38,12 @@ public class MessageService queryWrapper.eq("message_receiver",user.getUserId()); return messageDao.selectList(queryWrapper); } + + /** + * Gets new message. + * + * @return the new message + */ public List getNewMessage() { Subject subject = SecurityUtils.getSubject(); @@ -37,6 +53,12 @@ public class MessageService queryWrapper.eq("is_read",false); return messageDao.selectList(queryWrapper); } + + /** + * Gets new message count. + * + * @return the new message count + */ public Long getNewMessageCount() { Subject subject = SecurityUtils.getSubject(); @@ -46,6 +68,16 @@ public class MessageService queryWrapper.eq("is_read",false); return messageDao.selectCount(queryWrapper); } + + /** + * Send message int. + * + * @param targetId the target id + * @param sender the sender + * @param title the title + * @param content the content + * @return the int + */ public int sendMessage(Long targetId,String sender,String title,String content) { Message message=new Message(); @@ -56,6 +88,13 @@ public class MessageService message.setRead(false); return messageDao.insert(message); } + + /** + * Read message int. + * + * @param messageId the message id + * @return the int + */ public int readMessage(Long messageId) { Message message=messageDao.selectById(messageId); diff --git a/src/main/java/com/peteralbus/service/ParticipateService.java b/src/main/java/com/peteralbus/service/ParticipateService.java index 71a48a9..c0380a4 100644 --- a/src/main/java/com/peteralbus/service/ParticipateService.java +++ b/src/main/java/com/peteralbus/service/ParticipateService.java @@ -18,6 +18,7 @@ import java.util.List; /** * The type Participate service. + * * @author peteralbus */ @Service @@ -34,6 +35,9 @@ public class ParticipateService @Autowired GroupDao groupDao; + /** + * The Record dao. + */ @Autowired RecordDao recordDao; @@ -150,6 +154,12 @@ public class ParticipateService } } + /** + * Delete participate int. + * + * @param participationId the participation id + * @return the int + */ public int deleteParticipate(Long participationId) { Participate participate=participateDao.selectById(participationId); @@ -172,6 +182,12 @@ public class ParticipateService return participateDao.deleteById(participationId); } + /** + * Gets by id. + * + * @param participationId the participation id + * @return the by id + */ public Participate getById(Long participationId) { return participateDao.selectById(participationId); diff --git a/src/main/java/com/peteralbus/service/RecordService.java b/src/main/java/com/peteralbus/service/RecordService.java index ce403d8..dad786d 100644 --- a/src/main/java/com/peteralbus/service/RecordService.java +++ b/src/main/java/com/peteralbus/service/RecordService.java @@ -27,10 +27,19 @@ public class RecordService */ @Autowired RecordDao recordDao; + /** + * The Group dao. + */ @Autowired GroupDao groupDao; + /** + * The Participate dao. + */ @Autowired ParticipateDao participateDao; + /** + * The User dao. + */ @Autowired UserDao userDao; @@ -58,6 +67,12 @@ public class RecordService return recordDao.selectList(queryWrapper); } + /** + * Select by group list. + * + * @param groupId the group id + * @return the list + */ public List selectByGroup(Long groupId) { Group group= groupDao.selectById(groupId); @@ -77,6 +92,12 @@ public class RecordService return recordList; } + /** + * Sets read. + * + * @param recordId the record id + * @return the read + */ public int setRead(Long recordId) { Record record=recordDao.selectById(recordId); diff --git a/src/main/java/com/peteralbus/service/ScoreGroupService.java b/src/main/java/com/peteralbus/service/ScoreGroupService.java index 27febe1..61e85c6 100644 --- a/src/main/java/com/peteralbus/service/ScoreGroupService.java +++ b/src/main/java/com/peteralbus/service/ScoreGroupService.java @@ -8,17 +8,36 @@ import org.springframework.stereotype.Service; /** * The type Score group service. + * * @author peteralbus */ @Service public class ScoreGroupService { + /** + * The Score group dao. + */ @Autowired ScoreGroupDao scoreGroupDao; + + /** + * Insert int. + * + * @param scoreGroup the score group + * @return the int + */ public int insert(ScoreGroup scoreGroup) { return scoreGroupDao.insert(scoreGroup); } + + /** + * Gets scored. + * + * @param teacherId the teacher id + * @param groupId the group id + * @return the scored + */ public Boolean getScored(Long teacherId,Long groupId) { QueryWrapper queryWrapper=new QueryWrapper<>(); diff --git a/src/main/java/com/peteralbus/service/ScoreStuService.java b/src/main/java/com/peteralbus/service/ScoreStuService.java index ee8e1d9..ace9c13 100644 --- a/src/main/java/com/peteralbus/service/ScoreStuService.java +++ b/src/main/java/com/peteralbus/service/ScoreStuService.java @@ -9,15 +9,29 @@ import org.springframework.stereotype.Service; /** * The type Score stu service. + * * @author peteralbus */ @Service public class ScoreStuService { + /** + * The Score stu dao. + */ @Autowired ScoreStuDao scoreStuDao; + /** + * The Participate dao. + */ @Autowired ParticipateDao participateDao; + + /** + * Insert int. + * + * @param scoreStu the score stu + * @return the int + */ public int insert(ScoreStu scoreStu) { if(scoreStuDao.insert(scoreStu)>0) diff --git a/src/main/java/com/peteralbus/service/UserService.java b/src/main/java/com/peteralbus/service/UserService.java index fa2be04..6a3eed4 100644 --- a/src/main/java/com/peteralbus/service/UserService.java +++ b/src/main/java/com/peteralbus/service/UserService.java @@ -35,10 +35,17 @@ public class UserService return userDao.insert(user); } + /** + * Update user int. + * + * @param user the user + * @return the int + */ public int updateUser(User user) { return userDao.updateById(user); } + /** * Query by username user. * @@ -77,6 +84,11 @@ public class UserService return userDao.deleteById(user); } + /** + * Gets teacher list. + * + * @return the teacher list + */ public List getTeacherList() { QueryWrapper queryWrapper=new QueryWrapper<>(); @@ -84,16 +96,33 @@ public class UserService return userDao.selectList(queryWrapper); } + /** + * Gets user list. + * + * @return the user list + */ public List getUserList() { return userDao.selectList(null); } + /** + * Query by id user. + * + * @param userId the user id + * @return the user + */ public User queryById(Long userId) { return userDao.selectById(userId); } + /** + * Sets admin. + * + * @param userId the user id + * @return the admin + */ public int setAdmin(Long userId) { User user=userDao.selectById(userId); diff --git a/src/main/java/com/peteralbus/util/Md5Util.java b/src/main/java/com/peteralbus/util/Md5Util.java index f6764e0..4573259 100644 --- a/src/main/java/com/peteralbus/util/Md5Util.java +++ b/src/main/java/com/peteralbus/util/Md5Util.java @@ -7,16 +7,31 @@ import java.util.Random; /** * The type Md 5 util. + * * @author PeterAlbus */ public class Md5Util { + /** + * Md 5 hash string. + * + * @param credentials the credentials + * @param salt the salt + * @return the string + */ public static String md5Hash(String credentials, String salt) { String hashAlgorithmName="MD5"; int hashIterations=1; return new SimpleHash(hashAlgorithmName, credentials, ByteSource.Util.bytes(salt),hashIterations).toHex(); } + + /** + * Get salt string. + * + * @param n the n + * @return the string + */ public static String getSalt(int n){ char[] chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz~!@#$%^&*()_+".toCharArray(); int length = chars.length; diff --git a/src/main/java/com/peteralbus/util/PrincipalUtil.java b/src/main/java/com/peteralbus/util/PrincipalUtil.java index e1376c0..1a683a4 100644 --- a/src/main/java/com/peteralbus/util/PrincipalUtil.java +++ b/src/main/java/com/peteralbus/util/PrincipalUtil.java @@ -14,6 +14,7 @@ import java.util.List; /** * The type Principal util. + * * @author peteralbus */ @Component