基于Springboot實現(xiàn)校友錄管理系統(tǒng)
?作者主頁:
?簡介:Java領域優(yōu)質創(chuàng)作者、CSDN博客專家? Java項目、簡歷模板、學習資料、面試題庫、技術互助
文末獲取源碼?
?項目編號:BS-PT-018
數(shù)據(jù)庫:mysql
開發(fā)工具:IDEA /? Eclipse
開發(fā)語言:JAVA
使用框架:Springboot+SSM
本系統(tǒng)基于Springboot和SSM框架來實現(xiàn)校友錄管理。分前端系統(tǒng)和后端系統(tǒng)。后端系統(tǒng)模塊主要實現(xiàn)功能有:校友信息管理、校友會信息管理、校友活動管理、新聞管理、招聘管理、捐贈項目管理、系統(tǒng)管理等模塊。前端系統(tǒng)主要進行數(shù)據(jù)展示和相應信息操作,用戶注冊登陸后可以查看新聞,查看校友會并加入選擇的校友會,查看并申請校友活動(管理員后臺審核),查看并發(fā)布招聘信息(管理員后臺審核),論壇發(fā)貼,項目損贈和發(fā)布等模塊。功能完整,運行無誤。
部分展示功能如下:
后端功能:
? ?后臺主界面:

? ?
校友信息管理:

校友會管理:用戶前創(chuàng)建校友會,管理員后端審核

校友活動管理:

新聞管理:

內推招聘模塊:

項目損贈管理:

系統(tǒng)設置:

前端系統(tǒng)模塊:
首頁:

新聞查看:

查看并加入校友會:

查看并創(chuàng)建校友活動:

論壇交流模塊:

查看并設置捐贈:

發(fā)布招聘信息

前端用戶個人主頁


個人資料

以上是展示的部分系統(tǒng)的功能模塊
部分功能實現(xiàn)代碼:
package com.lgy.xiaoyou_manage.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.lgy.tools.entity.TbStu;
import com.lgy.tools.entity.TbUserRole;
import com.lgy.xiaoyou_manage.config.CustomUserDetailsService;
import com.lgy.xiaoyou_manage.service.ITbStuService;
import com.lgy.xiaoyou_manage.service.ITbUserRoleService;
import org.apache.ibatis.annotations.Param;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;import javax.servlet.http.HttpSession;
/**
?* <p>
?* ?前端控制器
?* </p>
?*
?* @author lgy
?* @since 2020-02-07
?*/
@Controller
public class LoginController {? ? @Autowired
? ? private ITbStuService tbStuService;? ? @Autowired
? ? private CustomUserDetailsService userDetailsService;? ? @Autowired
? ? private ITbUserRoleService userRoleService;? ? private Logger logger= ?LoggerFactory.getLogger(LoginController.class);
? ? @RequestMapping("/home")
? ? public String showHome(Model m, Authentication authentication){
? ? ? ? String name = SecurityContextHolder.getContext().getAuthentication().getName();
? ? ? ? logger.info("當前登錄用戶:"+name);
? ? ? ? TbStu tbStu = tbStuService.getByUserName(name);
? ? ? ? m.addAttribute("tbStu",tbStu);
? ? ? ? return "home";
? ? }? ? @RequestMapping("/login")
? ? public String showLogin() {? ? ? ? return "login";
? ? }? ? @RequestMapping("/check/UserName")
? ? @ResponseBody
? ? public Integer checkUserName(@Param("username") String username){
? ? ? ? TbStu tbStu = tbStuService.getOne(new QueryWrapper<TbStu>().eq("username", username).select("username"));
? ? ? ? if(tbStu!=null){
? ? ? ? ? ? return 1;
? ? ? ? }else {
? ? ? ? ? ? return 2;
? ? ? ? }
? ? }? ? /*@RequestMapping("/check/PassWord")
? ? @ResponseBody
? ? public Integer checkPassWord(@Param("password") String password,@Param("username") String username){
? ? ? ? TbStu tbStu = tbStuService.getOne(new QueryWrapper<TbStu>().eq("password", password).eq("username",username).select("username"));
? ? ? ? if(tbStu!=null){
? ? ? ? ? ? return 1;
? ? ? ? }else {
? ? ? ? ? ? return 2;
? ? ? ? }
? ? }*/? ? @RequestMapping("/check/PassWord")
? ? @ResponseBody
? ? public Integer checkRole(@Param("password") String password,@Param("username") String username){
? ? ? ? TbStu tbStu = tbStuService.getOne(new QueryWrapper<TbStu>().eq("password", password).eq("username",username).select("username","user_id"));
? ? ? ? if(tbStu==null){
? ? ? ? ? ? return 2;
? ? ? ? }else {
? ? ? ? ? ? TbUserRole userRole = userRoleService.getById(tbStu.getUserId());
? ? ? ? ? ? if(userRole!=null){
? ? ? ? ? ? ? ? if(userRole.getRoleId()==1){
? ? ? ? ? ? ? ? ? ? return 1;
? ? ? ? ? ? ? ? }else {
? ? ? ? ? ? ? ? ? ? return 3;
? ? ? ? ? ? ? ? }
? ? ? ? ? ? }else {
? ? ? ? ? ? ? ? return 3;
? ? ? ? ? ? }
? ? ? ? }
? ? }? ? @RequestMapping("/index")
? ? public String showIndex(){
? ? ? ? return "index";
? ? }? ? @RequestMapping("/password")
? ? public String pwd(){
? ? ? ? return "/settings/password";
? ? }? ? @RequestMapping("/editPwd")
? ? @ResponseBody
? ? public Integer editPwd(@Param("newpwd") String newpwd, HttpSession session){
? ? ? ? System.out.println(newpwd);
? ? ? ? TbStu tbStu= (TbStu) session.getAttribute("tbStu");
? ? ? ? boolean b = tbStuService.update(new UpdateWrapper<TbStu>().set("password", newpwd).eq("user_id", tbStu.getUserId()));
? ? ? ? if(b){
? ? ? ? ? ? return 1;
? ? ? ? }else {
? ? ? ? ? ? return 0;
? ? ? ? }
? ? }
? ? @RequestMapping("/admin")
? ? @ResponseBody
? ? @PreAuthorize("hasRole('ROLE_ADMIN')")
? ? public String printAdmin() {
? ? ? ? return "如果你看見這句話,說明你有ROLE_ADMIN角色";
? ? }? ? @RequestMapping("/user")
? ? @ResponseBody
? ? public String printUser() {
? ? ? ? return "如果你看見這句話,說明你有ROLE_USER角色";
? ? }}
?
package com.lgy.xiaoyou_manage.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lgy.tools.common.utils.MailUtils;
import com.lgy.tools.common.utils.QueryObj;
import com.lgy.tools.entity.TbActivity;
import com.lgy.tools.entity.TbActivityJoin;
import com.lgy.tools.entity.TbStu;
import com.lgy.xiaoyou_manage.service.ITbActivityJoinService;
import com.lgy.xiaoyou_manage.service.ITbActivityService;
import com.lgy.xiaoyou_manage.service.ITbStuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;import javax.mail.MessagingException;
import java.util.List;/**
?* <p>
?* ?前端控制器
?* </p>
?*
?* @author lgy
?* @since 2020-02-11
?*/
@Controller
@RequestMapping("/act")
public class TbActivityController {? ? @Autowired
? ? private ITbActivityService activityService;? ? @Autowired
? ? private ITbActivityJoinService activityJoinService;? ? @Autowired
? ? private ITbStuService tbStuService;? ? /**
? ? ?* 分頁獲取所有活動
? ? ?* @param m
? ? ?* @param page
? ? ?* @param limit
? ? ?* @param queryObj
? ? ?* @return
? ? ?*/
? ? @RequestMapping("/getAllAct")
? ? public String getAllAct(Model m, @RequestParam(defaultValue = "1") long page, @RequestParam(defaultValue = "10") long limit, QueryObj queryObj){
? ? ? ? QueryWrapper<QueryObj> wrapper = new QueryWrapper<>();
? ? ? ? wrapper.setEntity(queryObj);
? ? ? ? IPage<TbActivity> actPage = activityService.getAllAct(page,limit,wrapper);
? ? ? ? m.addAttribute("actPage",actPage);
? ? ? ? m.addAttribute("page",page);
? ? ? ? m.addAttribute("queryObj",queryObj);
? ? ? ? return "/activity/act-base";? ? }
? ? /**
? ? ?* 根據(jù)id獲取活動信息
? ? ?* @param m
? ? ?* @param acId
? ? ?* @return
? ? ?*/
? ? @RequestMapping("/getActById")
? ? public String getActById(Model m,Integer acId){
? ? ? ? TbActivity act=activityService.getActById(acId);
? ? ? ? m.addAttribute("act",act);
? ? ? ? return "/activity/act-edit";
? ? }? ? /**
? ? ?* 根據(jù)Id更新活動
? ? ?* @param tbActivity
? ? ?* @return
? ? ?*/
? ? @RequestMapping("/updateActById")
? ? @ResponseBody
? ? public Integer updateActById(TbActivity tbActivity){
? ? ? ? activityService.updateById(tbActivity);
? ? ? ? TbActivityJoin activityJoin = new TbActivityJoin();
? ? ? ? activityJoin.setUserId(tbActivity.getAcPer());
? ? ? ? activityJoin.setAcId(tbActivity.getAcId());
? ? ? ? boolean b = activityJoinService.save(activityJoin);
? ? ? ? if(b){
? ? ? ? ? ? TbStu tbStu = tbStuService.getOne(new QueryWrapper<TbStu>().select("name", "email").eq("user_id", tbActivity.getAcPer()));
? ? ? ? ? ? if(tbActivity.getAcStatus()==1&&tbStu.getEmail()!=null){
? ? ? ? ? ? ? ? try {
? ? ? ? ? ? ? ? ? ? MailUtils.sendMail(tbStu.getEmail(),"你申請的校友活動審核通過啦"," ");
? ? ? ? ? ? ? ? ? ? return 1;
? ? ? ? ? ? ? ? } catch (MessagingException e) {
? ? ? ? ? ? ? ? ? ? e.printStackTrace();
? ? ? ? ? ? ? ? ? ? return 2;
? ? ? ? ? ? ? ? }
? ? ? ? ? ? }
? ? ? ? ? ? if(tbActivity.getAcStatus()==2&&tbStu.getEmail()!=null){
? ? ? ? ? ? ? ? try {
? ? ? ? ? ? ? ? ? ? MailUtils.sendMail(tbStu.getEmail(),"你申請的校友活動未通過審核","請重新申請活動");
? ? ? ? ? ? ? ? ? ? return 1;
? ? ? ? ? ? ? ? } catch (MessagingException e) {
? ? ? ? ? ? ? ? ? ? e.printStackTrace();
? ? ? ? ? ? ? ? ? ? return 2;
? ? ? ? ? ? ? ? }
? ? ? ? ? ? }
? ? ? ? }
? ? ? ? return 2;
? ? }? ? /**
? ? ?* 查詢參與活動的校友
? ? ?* @param m
? ? ?* @param acId
? ? ?* @param page
? ? ?* @param limit
? ? ?* @return
? ? ?*/
? ? @RequestMapping("/getActJoinById")
? ? public String getActJoinById(Model m,Integer acId,@RequestParam(defaultValue = "1") long page, @RequestParam(defaultValue = "10") long limit){
? ? ? ? IPage<TbStu> stuPage = tbStuService.getActJoinById(new Page<TbStu>(page,limit),acId);
? ? ? ? m.addAttribute("stuPage",stuPage);
? ? ? ? m.addAttribute("page",page);
? ? ? ? m.addAttribute("acId",acId);
? ? ? ? return "/activity/actStu-look";
? ? }? ? /**
? ? ?* 刪除加入活動的校友
? ? ?* @param userIds
? ? ?* @param acId
? ? ?* @return
? ? ?*/
? ? @RequestMapping("/delActJoinById")
? ? public String delActJoinById(@RequestParam("userId") List<Integer> userIds,Integer acId){
? ? ? ? QueryWrapper<TbActivityJoin> wrapper = new QueryWrapper<>();
? ? ? ? wrapper.in("user_id",userIds);
? ? ? ? activityJoinService.remove(wrapper);
? ? ? ? return "redirect:/act/getActJoinById?acId="+acId;
? ? }
? ? /**
? ? ?* 根據(jù)id刪除
? ? ?* @param acIds
? ? ?* @return
? ? ?*/
? ? @RequestMapping("/delActById")
? ? public String delActById(@RequestParam("acId") List<Integer> acIds){
? ? ? ? activityService.removeByIds(acIds);
? ? ? ? QueryWrapper<TbActivityJoin> wrapper = new QueryWrapper<>();
? ? ? ? wrapper.in("ac_id",acIds);
? ? ? ? activityJoinService.remove(wrapper);
? ? ? ? return "redirect:/act/getAllAct";
? ? }}
?
package com.lgy.xiaoyou_manage.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lgy.tools.common.utils.MailUtils;
import com.lgy.tools.common.utils.QueryObj;
import com.lgy.tools.entity.TbAss;
import com.lgy.tools.entity.TbAssstu;
import com.lgy.tools.entity.TbStu;
import com.lgy.xiaoyou_manage.service.ITbAssService;
import com.lgy.xiaoyou_manage.service.ITbAssstuService;
import com.lgy.xiaoyou_manage.service.ITbStuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;import javax.mail.MessagingException;
import java.time.LocalDatetime;
import java.util.List;/**
?* <p>
?* ?前端控制器
?* </p>
?*
?* @author lgy
?* @since 2020-02-03
?*/
@Controller
@RequestMapping("/ass")
public class TbAssController {? ? @Autowired
? ? ITbAssService tbAssService;? ? @Autowired
? ? ITbAssstuService tbAssstuService;? ? @Autowired
? ? ITbStuService tbStuService;? ? /**
? ? ?* 分頁查詢校友會信息
? ? ?* @param m
? ? ?* @param page
? ? ?* @param limit
? ? ?* @param queryObj
? ? ?* @return
? ? ?*/
? ? @RequestMapping("/getAllAss")
? ? public String getAllAss(Model m, @RequestParam(defaultValue = "1") long page, @RequestParam(defaultValue = "10") long limit, QueryObj queryObj){
? ? ? ? QueryWrapper<QueryObj> wrapper = new QueryWrapper<>();
? ? ? ? wrapper.setEntity(queryObj);
? ? ? ? IPage<TbAss> assPage = tbAssService.getAllAss(page,limit,wrapper);
? ? ? ? m.addAttribute("assPage",assPage);
? ? ? ? m.addAttribute("page",page);
? ? ? ? m.addAttribute("queryObj",queryObj);
? ? ? ? return "/aluAss/aluAss-base";? ? }
? ? /**
? ? ?* 根據(jù)ID查詢
? ? ?* @param m
? ? ?* @param assId
? ? ?* @return
? ? ?*/
? ? @RequestMapping("/getAssById")
? ? public String getAssById(Model m,Integer assId){
? ? ? ? TbAss tbAss = tbAssService.getAssById(assId);
? ? ? ? m.addAttribute("ass",tbAss);
? ? ? ? return "/aluAss/aluAss-edit";
? ? }? ? /**
? ? ?* 更新信息
? ? ?* @param tbAss
? ? ?* @return
? ? ?*/? ? @RequestMapping("/updateAssById")
? ? @ResponseBody
? ? public Integer updateAssById(TbAss tbAss) ?{
? ? ? ? tbAss.setAssExaminetime(LocalDatetime.now());
? ? ? ? tbAssService.updateById(tbAss);
? ? ? ? TbAssstu assstu = new TbAssstu();
? ? ? ? assstu.setUserId(tbAss.getAssPer());
? ? ? ? assstu.setAssId(tbAss.getAssId());
? ? ? ? boolean b = tbAssstuService.save(assstu);
? ? ? ? if(b){
? ? ? ? ? ? TbStu tbStu = tbStuService.getOne(new QueryWrapper<TbStu>().select("name", "email").eq("user_id", tbAss.getAssPer()));
? ? ? ? ? ? if(tbAss.getAssStatus()==1&&tbStu.getEmail()!=null){
? ? ? ? ? ? ? ? try {
? ? ? ? ? ? ? ? ? ? MailUtils.sendMail(tbStu.getEmail(),"你申請的校友會審核通過啦"," ");
? ? ? ? ? ? ? ? ? ? return 1;
? ? ? ? ? ? ? ? } catch (MessagingException e) {
? ? ? ? ? ? ? ? ? ? e.printStackTrace();
? ? ? ? ? ? ? ? ? ? return 2;
? ? ? ? ? ? ? ? }
? ? ? ? ? ? }
? ? ? ? ? ? if(tbAss.getAssStatus()==2&&tbStu.getEmail()!=null){
? ? ? ? ? ? ? ? try {
? ? ? ? ? ? ? ? ? ? MailUtils.sendMail(tbStu.getEmail(),"你申請的校友會未通過審核","請重新申請");
? ? ? ? ? ? ? ? ? ? return 1;
? ? ? ? ? ? ? ? } catch (MessagingException e) {
? ? ? ? ? ? ? ? ? ? e.printStackTrace();
? ? ? ? ? ? ? ? ? ? return 2;
? ? ? ? ? ? ? ? }
? ? ? ? ? ? }
? ? ? ? }
? ? ? ? return 2;
? ? }
? ? /**
? ? ?* 根據(jù)校友會ID查詢所有的校友
? ? ?* @param m
? ? ?* @param assId
? ? ?* @return
? ? ?*/
? ? @RequestMapping("/getAssStuById")
? ? public String getAssStuById(Model m,Integer assId,@RequestParam(defaultValue = "1") long page, @RequestParam(defaultValue = "10") long limit){
? ? ? ? IPage<TbStu> stuList=tbAssService.getAssStuById(new Page<>(page,limit),assId);
? ? ? ? m.addAttribute("stuPage",stuList);
? ? ? ? m.addAttribute("page",page);
? ? ? ? m.addAttribute("assId",assId);
? ? ? ? return "/aluAss/AssStu-look";
? ? }? ? /**
? ? ?* 刪除校友會
? ? ?* @param assIds
? ? ?* @return
? ? ?*/
? ? @RequestMapping("delAssById")
? ? public String delAssById(@RequestParam("assId")List<Integer> assIds){
? ? ? ? tbAssService.removeByIds(assIds);
? ? ? ? QueryWrapper<TbAssstu> wrapper = new QueryWrapper<>();
? ? ? ? wrapper.in("ass_id",assIds);
? ? ? ? tbAssstuService.remove(wrapper);
? ? ? ? return "redirect:/ass/getAllAss";
? ? }? ? /**
? ? ?* 根據(jù)校友ID刪除對應的校友會成員信息表
? ? ?* @param userIds
? ? ?* @return
? ? ?*/
? ? @RequestMapping("/delAssStuById")
? ? public String delAssStuById(@RequestParam("userId") List<Integer> userIds,Integer assId){
? ? ? ? QueryWrapper<TbAssstu> queryWrapper = new QueryWrapper<>();
? ? ? ? queryWrapper.in("user_id",userIds);
? ? ? ? tbAssstuService.remove(queryWrapper);
? ? ? ? return "redirect:/ass/getAssStuById?assId="+assId;
? ? }}