首页>代码>基于SpringBoot+Vue实现的社团管理系统>/club-management/server/src/main/java/com/bishe/club/controller/ActivitiesController.java
package com.bishe.club.controller; import com.bishe.club.entity.Activities; import com.bishe.club.entity.Users; import com.bishe.club.handle.CacheHandle; import com.bishe.club.msg.PageData; import com.bishe.club.msg.R; import com.bishe.club.service.ActivitiesService; import com.bishe.club.service.UsersService; import com.bishe.club.utils.IDUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; /** * 系统请求响应控制器 * 活动信息 */ @Controller @RequestMapping("/activities") public class ActivitiesController extends BaseController { protected static final Logger Log = LoggerFactory.getLogger(ActivitiesController.class); @Autowired private CacheHandle cacheHandle; @Autowired private UsersService usersService; @Autowired private ActivitiesService activitiesService; @RequestMapping("") public String index() { return "pages/Activities"; } @GetMapping("/info") @ResponseBody public R getInfo(String id) { Log.info("查找指定活动信息,ID:{}", id); Activities activities = activitiesService.getOne(id); return R.successData(activities); } @GetMapping("/page") @ResponseBody public R getPageInfos(Long pageIndex, Long pageSize, String token, String teamName, String activeName) { Users user = usersService.getOne(cacheHandle.getUserInfoCache(token)); if (user.getType() == 0) { Log.info("分页查找活动信息,当前页码:{}," + "每页数据量:{}, 模糊查询,社团名称:{},活动名称:{}", pageIndex, pageSize, teamName, activeName); PageData page = activitiesService.getPageAll(pageIndex, pageSize, teamName, activeName); return R.successData(page); } else { Log.info("分页查找活动信息,当前页码:{}," + "每页数据量:{}, 模糊查询,社团名称:{},活动名称:{}", pageIndex, pageSize, teamName, activeName); PageData page = activitiesService.getPageByUserId(pageIndex, pageSize, user.getId(), teamName, activeName); return R.successData(page); } } @PostMapping("/add") @ResponseBody public R addInfo(Activities activities) { activities.setId(IDUtils.makeIDByCurrent()); Log.info("添加活动信息,传入参数:{}", activities); activitiesService.add(activities); return R.success(); } @PostMapping("/upd") @ResponseBody public R updInfo(Activities activities) { Log.info("修改活动信息,传入参数:{}", activities); activitiesService.update(activities); return R.success(); } @PostMapping("/del") @ResponseBody public R delInfo(String id) { Log.info("删除活动信息, ID:{}", id); Activities activities = activitiesService.getOne(id); activitiesService.delete(activities); return R.success(); } }
最近下载更多
citybird LV4
昨天
withyouatdusk LV2
10月19日
thsgli LV8
8月21日
qq970040477 LV24
6月25日
203163 LV5
6月16日
sweetlove LV20
6月14日
jc121140 LV3
4月15日
玖零定制问题修复 LV34
4月4日
dapeng0011 LV15
4月4日
yuan666 LV1
3月27日
最近浏览更多
羊羊羊羊杨
8小时前
暂无贡献等级
citybird LV4
昨天
15719908287 LV9
11月4日
shunlun8855 LV1
10月28日
withyouatdusk LV2
10月19日
黄志琴 LV1
10月19日
kaiser622
10月11日
暂无贡献等级
zzzyyy1 LV2
10月4日
微信网友_7044194812350464 LV8
9月14日
thsgli LV8
8月21日