SSM学校社团管理系统

260 篇文章 9 订阅

作者主页:源码空间站2022

 简介: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. 前端:JSP+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_shetuan_sys 登录

运行截图

超级管理员角色

社团管理员角色

 

 

学生角色 

相关代码

管理员控制器

@Controller
@RequestMapping(value = "/Manager")
public class ManagerController {
	@Autowired
	private ManagerService managerService;

	// 1根据id查询
	@RequestMapping("/findManagerById")
	public @ResponseBody Manager findManagerById(Model model,String ma_id){
		System.out.println("===============findManagerById=================");
		System.out.println("MA_id:"+ma_id);
		int id=Integer.parseInt(ma_id);
		Manager manager=managerService.findManagerById(id);
		System.out.println("manager:"+manager.getMA_name());
		model.addAttribute("manager", manager);
		return manager;
	}
	// 2查询所有(分页显示)
	@RequestMapping("/findAllManager")
	public String findAllManager(Model model, String type, Integer pageNo,
			Integer pageSize) {
		System.out.println("===========findAllManager==============");
		System.out.println("传到type的值:" + type);
		PagedResult<Manager> pagedResult = (PagedResult<Manager>) managerService
				.findAllManager(pageNo, pageSize);
		model.addAttribute("pagedResult", pagedResult);
		List<Manager> managerList = pagedResult.getDataList();
		System.out.println("当前页码:" + pageNo);
		System.out.println("总页数:" + pageSize);
		System.out.println(pagedResult.getPages());
		model.addAttribute("managerList", managerList);
		if (type.equals("show1")) {
			return "jsp/sonpage/manager/managerson/findManager";
		}
		if (type.equals("show2")) {
			return "jsp/sonpage/manager/managerson/delManager";
		}
		return "";
	}

	// 3模糊查询
	@RequestMapping("/findLikeNameManager")
	public String findLikeNameManager(String ma_id, String ma_name,
			Model model, String type) {
		System.out.println("===========模糊查询系统管理员信息============");
		//String ma_id=id;
		//String ma_name=name;
		System.out.println("ma_id:" + ma_id);
		System.out.println("ma_name:" + ma_name);
		System.out.println("type:" + type);
		Map map = new HashMap();
		map.put("ma_id", ma_id);
		map.put("ma_name", ma_name);
		List<Manager> managerList = managerService.findLikeNameManager(map);
		model.addAttribute("managerList", managerList);
		if (type.equals("show1")) {
			System.out.println("===========从查询管理员信息页面===========");
			if (("").equals(ma_id) && ("").equals(ma_name)) {
				System.out.println("1没有传值");
				System.out.println("===========findAllManager==============");
				System.out.println("传到type的值:" + type);
				PagedResult<Manager> pagedResult = (PagedResult<Manager>) managerService
						.findAllManager(0, 5);
				model.addAttribute("pagedResult", pagedResult);
		        managerList = pagedResult.getDataList();
				System.out.println("当前页码:" + 1);
				System.out.println("总页数:" + 5);
				System.out.println(pagedResult.getPages());
				model.addAttribute("managerList", managerList);
				return "jsp/sonpage/manager/managerson/findManager";
			}
			System.out
					.println("===================跳回查询页面======================");
			return "jsp/sonpage/manager/managerson/findManager";
		}
		if (type.equals("show2")) {
			System.out.println("===========从删除管理员信息页面===========");
			if (("").equals(ma_id) && ("").equals(ma_name)) {
				System.out.println("2没有传值");
				System.out.println("1没有传值");
				System.out.println("===========findAllManager==============");
				System.out.println("传到type的值:" + type);
				PagedResult<Manager> pagedResult = (PagedResult<Manager>) managerService
						.findAllManager(0, 5);
				model.addAttribute("pagedResult", pagedResult);
				managerList = pagedResult.getDataList();
				System.out.println("当前页码:" + 1);
				System.out.println("总页数:" + 5);
				System.out.println(pagedResult.getPages());
				model.addAttribute("managerList", managerList);
				return "jsp/sonpage/manager/managerson/findManager";
			}
			System.out
					.println("===================跳回删除页面======================");
			return "jsp/sonpage/manager/managerson/delManager";
		}
		return "";
	}

	// 4添加系统管理员
	@RequestMapping("/addManager")
	public String addManager(Manager manager) {
		System.out.println("=========添加系统管理员=========");
		System.out.println("姓名:" + manager.getMA_name());
		managerService.addManager(manager);
		return "jsp/sonpage/manager/managerson/addManager";
	}

	// 5删除系统管理员
	@RequestMapping("/delManager")
	public String delManager(String MA_id) {
		System.out.println("===========删除系统管理员===========");
		System.out.println("MA_id:" + MA_id);
		int id = Integer.parseInt(MA_id);
		managerService.delManager(id);
		return "forward:findAllManager.action?type=show2";
	}

	// 6修改系统管理员
	@RequestMapping("/updateManager")
	public String updateManager(Manager manager) {
		System.out.println("=========修改系统管理员=========");
		System.out.println("名字:"+manager.getMA_name());
		managerService.updateManager(manager);
		return "forward:findAllManager.action?type=show1";
	}

	// 8批量删除管理员信息
	@RequestMapping("/delItem")
	public @ResponseBody boolean delItem(Model model, String ids) {
		System.out.println("==========批量删除已审批活动信息==========");
		System.out.println("ids:" + ids);
		// 用数组接收获取的选中集合
		String[] str = ids.split("_");
		for (int i = 0; i < str.length; i++) {
			int id = Integer.parseInt(str[i]);
			managerService.delManager(id);
			System.out.println("删除的方法执行了");
		}
		// return "forward:findAllMember.action?type=show2";
		return true;

	}
	//9登陆(根据学号查找)
	@RequestMapping("/findManagerByNum")
	public @ResponseBody boolean findManagerByNum(HttpSession session,String num,String pwd){
		System.out.println("===============findManagerByNum=================");
		System.out.println("num:"+num);

		Subject subject = SecurityUtils.getSubject();
		subject.getSession().setAttribute("userType", "Manager");
		// 保存至令牌环中,供MyRealm做验证
		UsernamePasswordToken token = new UsernamePasswordToken(num, pwd);
		// 保存用户类型供MyRealm获取
		
		try {
			// 跳转到MyRealm 做登录用户名和密码验证
			subject.login(token);
			session.setAttribute("num", num);
			session.setAttribute("role", "2");
			System.out.println("ManagerController-->>findManagerByNum-->>登录成功");
			return true;
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
			System.out.println("ManagerController-->>findManagerByNum-->>登录失败");
			return false;
		}
		
//		Manager manager=managerService.findManagerByNum(num);
//		System.out.println("manager:"+manager.getMA_pwd());
//		String MA_pwd=manager.getMA_pwd();
//		session.setAttribute("num", num);
//		session.setAttribute("role", "2");
//		if(MA_pwd.equals(pwd)){
//			System.out.println("返回值是真");
//			return true;
//		}else{
//			return false;
//		}
	}
	
	// 登出
	@RequestMapping("/logout")
	public String logout(Model model) {
		
		try {
			Subject subject = SecurityUtils.getSubject();
			System.out.println("==========>>>>>>>>logout>>>>>>======"+subject.getPrincipal().toString());
			subject.logout();
			System.out.println("****************logout成功*************");
		} catch (Exception e) {
  		}
		return "/jsp/sonpage/login";
	}
	
	//9修改密码
	@RequestMapping("/updateManagerPwd")
	public @ResponseBody boolean updateManagerPwd(Model model,String num,String oldPwd,String newPwd){
		System.out.println("===============updateManagerPwd=================");
		System.out.println("旧密码:"+oldPwd);
		System.out.println("新密码:"+newPwd);
		String MA_pwd=newPwd;
		String MA_num=num;
		Manager manager=managerService.findManagerByNum(num);
		String pwd=manager.getMA_pwd();
		if(pwd.equals(oldPwd)){
			managerService.updateManagerPwd(MA_pwd,MA_num);
			return true;
		}else{
			return false;
		}
	}
}

活动控制器

@Controller
@RequestMapping(value = "/Activity")
public class ActivityController {
	@Autowired
	private ActivityService activityService;

	// 1根据id查询
	@RequestMapping("/findActivityById")
	public @ResponseBody Activity findActivityById(Model model, String AC_id) {
		System.out.println("用户传过来的id值:" + AC_id);
		int id = Integer.parseInt(AC_id);
		Activity activity = activityService.findActivityById(id);
		System.out.println("查到的值:"+activity.getAC_theme());
		return activity;
	}

	// 2查询所有未审核活动信息(分页)
	@RequestMapping("/findAllActivity")
	public String findAllActivity(Model model, String type, Integer pageNo,
			Integer pageSize) {
		System.out.println("===========查询所有未审核活动信息==============");
		System.out.println("传到type的值:" + type);
		PagedResult<Activity> pagedResult = (PagedResult<Activity>) activityService
				.findAllActivity(pageNo, pageSize);
		model.addAttribute("pagedResult", pagedResult);
		List<Activity> activityList = pagedResult.getDataList();
		System.out.println("当前页码:" + pageNo);
		System.out.println("总页数:" + pageSize);
		System.out.println(pagedResult.getPages());
		model.addAttribute("activityList", activityList);
		return "jsp/sonpage/activity/activityson/findActivity";
	}

	// 3模糊查询未审核活动信息
	@RequestMapping("/findLikeNameActivity")
	public String findLikeNameActivity(String AC_id, String AC_theme,
			Model model, String type) {
		System.out.println("===========模糊查询未审核活动信息============");
		System.out.println("AC_id:" + AC_id);
		System.out.println("AC_theme:" + AC_theme);
		//String AC_id=ac_id;
		//String AC_theme=ac_theme;
		Map map = new HashMap();
		map.put("AC_id", AC_id);
		map.put("AC_theme", AC_theme);
		List<Activity> activityList = activityService.findLikeNameActivity(map);
		model.addAttribute("activityList", activityList);
		if (type.equals("show")) {
			if (("").equals(AC_id) && ("").equals(AC_theme)) {
				System.out.println("========输入为空跳转查询所有的方法=========");
				return "forward:findAllActivity.action?type";
			}
			return "jsp/sonpage/activity/activityson/findActivity";
		}
		return "jsp/sonpage/activity/activityson/findActivity";
	}

	// 4添加活动信息
	@RequestMapping("/addActivity")
	public String addActivity(HttpServletRequest request, Activity activity) {
		System.out.println("=========添加活动信息==========");
		activityService.addActivity(activity);
		// 查询所有物品
		List<Goods> goodsList = activityService.findAllGoods();
		request.getSession().setAttribute("goodsList", goodsList);
		// 将刚添加的活动id保存,供添加活动物品时使用
		request.getSession().setAttribute("AC_id", activity.getAC_id());
		// 跳转到添加物品
		return "redirect:../jsp/sonpage/activity/activityson/addActivityGoods.jsp";
	}

	// 5删除活动信息
	@RequestMapping("/delActivity")
	public String delActivity(int AC_id) {
		System.out.println("============根据id删除活动信息============");
		System.out.println("页面传值:" + AC_id);
		activityService.delActivity(AC_id);
		return "forward:findAllCActivity.action?type=show1";
	}

	// 6修改活动信息
	@RequestMapping("/updateActivity")
	public String updateActivity(Activity activity){
		System.out.println("===========updateActivity==============");
		System.out.println("活动编号:"+activity.getAC_theme());
		activityService.updateActivity(activity);
		return "forward:findAllCActivity.action?type=show";
	}

	// 7查询所有已审核活动信息(分页)
	@RequestMapping("/findAllCActivity")
	public String findAllCActivity(Model model, String type, Integer pageNo,
			Integer pageSize) {
		System.out.println("===========查询所有已审核活动信息==============");
		System.out.println("传到type的值:" + type);
		PagedResult<Activity> pagedResult = (PagedResult<Activity>) activityService
				.findAllCActivity(pageNo, pageSize);
		model.addAttribute("pagedResult", pagedResult);
		List<Activity> activityList = pagedResult.getDataList();
		System.out.println("当前页码:" + pageNo);
		System.out.println("总页数:" + pageSize);
		System.out.println(pagedResult.getPages());
		model.addAttribute("activityList", activityList);
		if (type.equals("show1")) {
			return "jsp/sonpage/activity/activityson/delActivity";
		}
		if (type.equals("show")) {
			return "jsp/sonpage/activity/activityson/findCActivity";
		}
		return "jsp/sonpage/activity/activityson/findCActivity";
	}

	// 8模糊查询已审核活动信息
	@RequestMapping("/findLikeNameCActivity")
	public String findLikeNameCActivity(String AC_id, String AC_theme,
			Model model, String type) {
		System.out.println("===========模糊查询已审核活动信息============");
		//String AC_id=id;
		//String AC_theme=theme;
		System.out.println("AC_id:" + AC_id);
		System.out.println("AC_theme:" + AC_theme);
		Map map = new HashMap();
		map.put("AC_id", AC_id);
		map.put("AC_theme", AC_theme);
		List<Activity> activityList = activityService
				.findLikeNameCActivity(map);
		model.addAttribute("activityList", activityList);
		if (type.equals("show")) {
			if (("").equals(AC_id) && ("").equals(AC_theme)) {
				return "forward:findAllCActivity.action?type";
			}
			return "jsp/sonpage/activity/activityson/findCActivity";
		}
		if (type.equals("show1")) {
			if (("").equals(AC_id) && ("").equals(AC_theme)) {
				return "forward:findAllCActivity.action?type";
			}
			return "jsp/sonpage/activity/activityson/delActivity";
		}
		return "";
	}

	// 8批量删除已审批活动信息
	@RequestMapping("/delItem")
	public @ResponseBody boolean delItem(Model model, String ids) {
		System.out.println("==========批量删除已审批活动信息==========");
		System.out.println("ids:" + ids);
		// 用数组接收获取的选中集合
		String[] str = ids.split("_");
		for (int i = 0; i < str.length; i++) {
			int id = Integer.parseInt(str[i]);
			activityService.delActivity(id);
			System.out.println("删除的方法执行了");
		}
		// return "forward:findAllMember.action?type=show2";
		return true;

	}
	
	//审批(同意)
	@RequestMapping("/updateActivityById")
	public @ResponseBody boolean updateActivityById(String id){
		System.out.println("===========updateActivityById==============");
		int AC_id=Integer.parseInt(id);
		activityService.updateActivityById(AC_id);
		return true;
	}
	
	//审批(不同意)
	@RequestMapping("/updateActivityNById")
	public @ResponseBody boolean updateActivityNById(String id,String AC_remark){
		System.out.println("===========updateActivityNById==============");
		int AC_id=Integer.parseInt(id);
		activityService.updateActivityNById(AC_remark,AC_id);
		return true;
	}
	
	//首页显示
	@RequestMapping("/show")
	public String show(HttpServletRequest request,Model model){
		System.out.println("===========show==============");
		List<Activity> activityList=activityService.findshow();
		request.getSession().setAttribute("activityList", activityList);
		return "redirect:../jsp/sonpage/index.jsp";
	}

	// 添加活动物品
	@RequestMapping("/addActivityGoods")
	@ResponseBody
	public boolean addActivityGoods(HttpServletRequest request, String strnums, String strids) {
		System.out.println("数量:" + strnums);
		System.out.println("ID:" + strids);
		String[] arrNums = strnums.split(",");
		String[] arrIds = strids.split(",");
		if (arrNums.length < 1 || arrIds.length < 1) {
			return false;
		} else {
			// 获取活动ID
			System.out.println(request.getSession().getAttribute("AC_id"));
			Integer AC_id = (Integer) request.getSession().getAttribute("AC_id");
			boolean result = activityService.addActivityGoods(AC_id, arrNums, arrIds);
			return result;
		}

	}
}

 如果也想学习本系统,下面领取。回复:96ssm 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值