基于Springboot实现校友录管理系统
Posted 编程指南针
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了基于Springboot实现校友录管理系统相关的知识,希望对你有一定的参考价值。
项目编号:BS-PT-018
数据库:mysql
开发工具:IDEA / Eclipse
开发语言:JAVA
使用框架:Springboot+SSM
本系统基于Springboot和SSM框架来实现校友录管理。分前端系统和后端系统。后端系统模块主要实现功能有:校友信息管理、校友会信息管理、校友活动管理、新闻管理、招聘管理、捐赠项目管理、系统管理等模块。前端系统主要进行数据展示和相应信息操作,用户注册登陆后可以查看新闻,查看校友会并加入选择的校友会,查看并申请校友活动(管理员后台审核),查看并发布招聘信息(管理员后台审核),论坛发贴,项目损赠和发布等模块。功能完整,运行无误。
部分展示功能如下:
后端功能:
后台主界面:
校友信息管理:
校友会管理:用户前创建校友会,管理员后端审核
校友活动管理:
新闻管理:
内推招聘模块:
项目损赠管理:
系统设置:
前端系统模块:
首页:
新闻查看:
查看并加入校友会:
查看并创建校友活动:
论坛交流模块:
查看并设置捐赠:
发布招聘信息
前端用户个人主页
个人资料
以上是展示的部分系统的功能模块
部分功能实现代码:
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";
/**
* 根据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";
/**
* 根据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;
/**
* 根据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";
/**
* 根据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;
/**
* 根据校友会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";
/**
* 根据校友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;
以上是关于基于Springboot实现校友录管理系统的主要内容,如果未能解决你的问题,请参考以下文章