首页>代码>基于SpringBoot+Vue实现的社团管理系统>/club-management/server/src/main/java/com/bishe/club/controller/ActiveLogsController.java
package com.bishe.club.controller; import com.bishe.club.entity.ActiveLogs; import com.bishe.club.handle.CacheHandle; import com.bishe.club.msg.R; 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; import com.bishe.club.entity.Users; import com.bishe.club.service.UsersService; import com.bishe.club.utils.DateUtils; import com.bishe.club.utils.IDUtils; import com.bishe.club.service.ActiveLogsService; import java.util.List; import java.util.Map; /** * 系统请求响应控制器 * 报名记录 */ @Controller @RequestMapping("/activeLogs") public class ActiveLogsController extends BaseController { protected static final Logger Log = LoggerFactory.getLogger(ActiveLogsController.class); @Autowired private CacheHandle cacheHandle; @Autowired private UsersService usersService; @Autowired private ActiveLogsService activeLogsService; @RequestMapping("") public String index() { return "pages/ActiveLogs"; } @GetMapping("/info") @ResponseBody public R getInfo(String id) { Log.info("查找指定报名记录,ID:{}", id); ActiveLogs activeLogs = activeLogsService.getOne(id); return R.successData(activeLogs); } @GetMapping("/list") @ResponseBody public R getList(String activeId) { Log.info("获取指定活动的报名记录,活动ID:{}", activeId); List<Map<String, Object>> list = activeLogsService.getListByActiveId(activeId); return R.successData(list); } @PostMapping("/add") @ResponseBody public R addInfo(String token, ActiveLogs activeLogs) { Users user = usersService.getOne(cacheHandle.getUserInfoCache(token)); if(activeLogsService.isActive(activeLogs.getActiveId(), user.getId())){ activeLogs.setId(IDUtils.makeIDByCurrent()); activeLogs.setUserId(user.getId()); activeLogs.setCreateTime(DateUtils.getNowDate()); Log.info("添加报名记录,传入参数:{}", activeLogs); activeLogsService.add(activeLogs); return R.success(); }else{ return R.warn("该活动您已参与,请勿重复报名"); } } @PostMapping("/upd") @ResponseBody public R updInfo(ActiveLogs activeLogs) { Log.info("修改报名记录,传入参数:{}", activeLogs); activeLogsService.update(activeLogs); return R.success(); } @PostMapping("/del") @ResponseBody public R delInfo(String id) { Log.info("删除报名记录, ID:{}", id); ActiveLogs activeLogs = activeLogsService.getOne(id); activeLogsService.delete(activeLogs); return R.success(); } }

zolscy LV24
2024年11月26日
citybird LV4
2024年11月20日
withyouatdusk LV2
2024年10月19日
thsgli LV9
2024年8月21日
qq970040477 LV24
2024年6月25日
203163 LV5
2024年6月16日
sweetlove LV20
2024年6月14日
jc121140 LV3
2024年4月15日
玖零定制问题修复 LV34
2024年4月4日
dapeng0011 LV15
2024年4月4日

zolscy LV24
2024年11月26日
羊羊羊羊杨 LV1
2024年11月21日
citybird LV4
2024年11月20日
15719908287 LV10
2024年11月4日
shunlun8855 LV1
2024年10月28日
withyouatdusk LV2
2024年10月19日
黄志琴 LV1
2024年10月19日
kaiser622
2024年10月11日
暂无贡献等级
zzzyyy1 LV2
2024年10月4日
微信网友_7044194812350464 LV8
2024年9月14日