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个
2 下载量 127 浏览量
2023-08-16
15:29:27
上传
评论
收藏 13.14MB ZIP 举报
温馨提示
基于SpringBoot的社团管理系统.zip
资源推荐
资源详情
资源评论
收起资源包目录
基于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
[email protected] 21KB
[email protected] 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
资源评论
LeapMay
- 粉丝: 2w+
- 资源: 2302
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功