package com.scs.web.peopleInfo;
import com.scs.po.Activity;
import com.scs.po.Club;
import com.scs.po.New;
import com.scs.service.ActivityService;
import com.scs.service.ClubService;
import com.scs.service.NewService;
import com.scs.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.web.PageableDefault;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import javax.servlet.http.HttpSession;
import java.util.Date;
import java.util.List;
@Controller
@RequestMapping("/peopleInfo/clubManager")
public class MyclubController {
@Autowired
private UserService userService;
@Autowired
private ActivityService activityService;
@Autowired
private NewService newService;
@Autowired
private ClubService clubService;
private Long getClubId(HttpSession httpSession){
List<Club> myclub = (List<Club>) httpSession.getAttribute("myclub");
return myclub.get(0).getId();
}
@GetMapping("/members")
public String members(@PageableDefault(size = 10,sort = {"grade"},direction = Sort.Direction.ASC) Pageable pageable,
HttpSession httpSession, Model model){
Long myClubId = getClubId(httpSession);
model.addAttribute("page",userService.getUsersByClubId(myClubId,pageable));
return "peopleInfo/clubManager/members";
}
@GetMapping("/members/{userid}/delete")
public String deleteMember(@PathVariable Long userid,RedirectAttributes attributes,HttpSession httpSession){
Long clubId = getClubId(httpSession);
clubService.removeUser(userid,clubId);
attributes.addFlashAttribute("message","操作成功!");
return "redirect:/peopleInfo/clubManager/members";
}
@GetMapping("/activitys")
public String activitys(@PageableDefault(size = 1,sort = {"activitytime"},direction = Sort.Direction.DESC) Pageable pageable,
HttpSession httpSession, Model model){
Long myClubId = getClubId(httpSession);
model.addAttribute("page",activityService.listActivitiesByClubId(myClubId,pageable));
return "peopleInfo/clubManager/activitys";
}
@GetMapping("/activity-input")
public String activity(Model model){
model.addAttribute("activity",new Activity());
return "peopleInfo/clubManager/activity-input";
}
@PostMapping("/activity/input")
public String activityInput(@ModelAttribute Activity activity , RedirectAttributes attributes, HttpSession httpSession){
Long clubId = getClubId(httpSession);
activity.setClub(clubService.getClubByClubId(clubId));
Activity a;
a= activityService.saveActivity(activity);
if (a == null) {
attributes.addFlashAttribute("message","操作失败");
}else {
attributes.addFlashAttribute("message","操作成功");
}
return "redirect:/peopleInfo/clubManager/activitys";
}
@GetMapping("/activity/{id}")
public String activityEdit(@PathVariable Long id,Model model){
model.addAttribute("activity",activityService.getActivity(id));
return "peopleInfo/clubManager/activity-input";
}
@GetMapping("/activity/{id}/delete")
public String activityDelete(@PathVariable Long id ,RedirectAttributes attributes){
activityService.deleteActivity(id);
attributes.addFlashAttribute("message","操作成功");
return "redirect:/peopleInfo/clubManager/activitys";
}
@GetMapping("/news")
public String news(@PageableDefault(size = 1,sort = {"publishtime"},direction = Sort.Direction.DESC) Pageable pageable,
HttpSession httpSession, Model model){
Long myClubId = getClubId(httpSession);
model.addAttribute("page",newService.listNewsByClubId(myClubId,pageable));
return "peopleInfo/clubManager/news";
}
@GetMapping("/new-input")
public String newInput(Model model){
model.addAttribute("mynew",new New());
return "peopleInfo/clubManager/new-input";
}
@PostMapping("/new/input")
public String newInput(@ModelAttribute New mynew , RedirectAttributes attributes, HttpSession httpSession){
Long clubId = getClubId(httpSession);
mynew.setClub(clubService.getClubByClubId(clubId));
New a;
a= newService.saveNew(mynew);
if (a == null) {
attributes.addFlashAttribute("message","操作失败");
}else {
attributes.addFlashAttribute("message","操作成功");
}
return "redirect:/peopleInfo/clubManager/news";
}
@GetMapping("/new/{id}")
public String newEdit(@PathVariable Long id,Model model){
model.addAttribute("mynew",newService.getActivity(id));
return "peopleInfo/clubManager/new-input";
}
@GetMapping("/new/{id}/delete")
public String newDelete(@PathVariable Long id ,RedirectAttributes attributes){
newService.deleteActivity(id);
attributes.addFlashAttribute("message","操作成功");
return "redirect:/peopleInfo/clubManager/news";
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
基于SpringBoot的社团管理系统.zip
共574个文件
js:195个
html:125个
xml:96个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 167 浏览量
2023-10-29
18:16:23
上传
评论
收藏 13.13MB ZIP 举报
温馨提示
1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载学习,也适合小白学习进阶,当然也可作为毕设项目、课程设计、作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修改,以实现其他功能,也可用于毕设、课设、作业等。 -------- 下载后请首先打开README.md文件(如有),仅供学习参考, 切勿用于商业用途。
资源推荐
资源详情
资源评论
收起资源包目录
基于SpringBoot的社团管理系统.zip (574个子文件)
AUTHORS 6KB
bootstrap.min.css 138KB
editormd.css 76KB
animate.css 68KB
editormd.min.css 60KB
editormd.preview.css 55KB
editormd.preview.min.css 44KB
main.css 42KB
ambiance.css 26KB
line-icons.css 14KB
responsive.css 8KB
codemirror.css 8KB
magnific-popup.css 7KB
nivo-lightbox.css 6KB
codemirror.min.css 5KB
mdn-like.css 5KB
solarized.css 5KB
menu_sideslide.css 4KB
merge.css 3KB
me.css 3KB
lint.css 3KB
xq-dark.css 3KB
owl.carousel.css 2KB
lesser-dark.css 2KB
pastel-on-dark.css 2KB
xq-light.css 2KB
tomorrow-night-eighties.css 2KB
editormd.logo.css 2KB
erlang-dark.css 2KB
zenburn.css 2KB
twilight.css 2KB
midnight.css 2KB
vibrant-ink.css 2KB
mbo.css 2KB
base16-dark.css 2KB
base16-light.css 2KB
tern.css 2KB
3024-night.css 2KB
paraiso-dark.css 2KB
paraiso-light.css 2KB
tomorrow-night-bright.css 2KB
3024-day.css 2KB
blackboard.css 2KB
colorforth.css 2KB
owl.theme.css 2KB
editormd.logo.min.css 2KB
the-matrix.css 2KB
night.css 2KB
rubyblue.css 2KB
monokai.css 1KB
cobalt.css 1KB
simplescrollbars.css 1KB
eclipse.css 1KB
neo.css 932B
elegant.css 768B
neat.css 693B
show-hint.css 662B
qi.css 575B
dialog.css 502B
tiki.css 440B
foldgutter.css 435B
tiddlywiki.css 220B
matchesonscrollbar.css 188B
fullscreen.css 116B
ambiance-mobile.css 103B
LineIcons.eot 99KB
fontawesome-webfont.eot 59KB
editormd-logo.eot 1KB
loading@3x.gif 21KB
loading@2x.gif 16KB
loading.gif 8KB
.gitignore 117B
.gitignore 32B
scala.html 28KB
activity.html 24KB
new.html 24KB
club.html 23KB
index.html 22KB
index.html 17KB
index.html 17KB
index.html 13KB
index.html 13KB
index.html 11KB
index.html 10KB
index.html 9KB
news.html 9KB
register.html 9KB
members.html 9KB
index.html 8KB
info.html 8KB
activity-input.html 8KB
index.html 8KB
allNews.html 7KB
club-create.html 7KB
joinActivities.html 7KB
index.html 7KB
index.html 7KB
login.html 6KB
allClubs.html 6KB
index.html 6KB
共 574 条
- 1
- 2
- 3
- 4
- 5
- 6
资源评论
程皮
- 粉丝: 262
- 资源: 2568
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于java开发的密码解锁APP,包含手势密码解锁+指纹密码解锁+源码+项目界面展示(毕业设计&课程设计&项目开发)
- 基于单片机的智能窗帘设计
- 基于STM32F103C8T6+LCD1602+MCP6S28的8通道模拟可编程增益放大器Proteus仿真
- 5G RAN NR TDD单用户峰值吞吐率计算过程.pptx
- 基于Objective-C开发的手势密码解锁和面容解锁(代码简洁高效通俗易懂)+源码+开发文档+源码解析(毕业设计&课程设计)
- LangChain学习之 Question And Answer的操作附带数据文件
- linux常用命令大全.zip
- CATIA入门操作案例-正八边异形带孔凸台绘制,等距点绘制正多边形,凸台绘制
- 大型代码语言模型的项目级提示生成pdf
- 纸片战争The War of paper.sb3
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功