首页>代码>基于SpringBoot+Vue实现的社团管理系统>/club-management/server/src/main/java/com/bishe/club/controller/ApplyLogsController.java
package com.bishe.club.controller;
import com.bishe.club.entity.ApplyLogs;
import com.bishe.club.handle.CacheHandle;
import com.bishe.club.msg.PageData;
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.ApplyLogsService;
/**
* 系统请求响应控制器
* 申请记录
*/
@Controller
@RequestMapping("/applyLogs")
public class ApplyLogsController extends BaseController {
protected static final Logger Log = LoggerFactory.getLogger(ApplyLogsController.class);
@Autowired
private CacheHandle cacheHandle;
@Autowired
private UsersService usersService;
@Autowired
private ApplyLogsService applyLogsService;
@RequestMapping("")
public String index() {
return "pages/ApplyLogs";
}
@GetMapping("/info")
@ResponseBody
public R getInfo(String id) {
Log.info("查找指定申请记录,ID:{}", id);
ApplyLogs applyLogs = applyLogsService.getOne(id);
return R.successData(applyLogs);
}
@GetMapping("/page")
@ResponseBody
public R getPageInfos(Long pageIndex, Long pageSize,
String token, String teamName, String userName) {
Users user = usersService.getOne(cacheHandle.getUserInfoCache(token));
if (user.getType() == 0) {
Log.info("分页查看全部申请记录,当前页码:{},"
+ "每页数据量:{}, 模糊查询,团队名称:{},用户姓名:{}", pageIndex,
pageSize, teamName, userName);
PageData page = applyLogsService.getPageInfo(pageIndex, pageSize, null, teamName, userName);
return R.successData(page);
} else if (user.getType() == 1) {
Log.info("团队管理员查看申请记录,当前页码:{},"
+ "每页数据量:{}, 模糊查询,团队名称:{},用户姓名:{}", pageIndex,
pageSize, teamName, userName);
PageData page = applyLogsService.getManPageInfo(pageIndex, pageSize, user.getId(), teamName, userName);
return R.successData(page);
} else {
Log.info("分页用户相关申请记录,当前页码:{},"
+ "每页数据量:{}, 模糊查询,团队名称:{},用户姓名:{}", pageIndex,
pageSize, teamName, userName);
PageData page = applyLogsService.getPageInfo(pageIndex, pageSize, user.getId(), teamName, null);
return R.successData(page);
}
}
@PostMapping("/add")
@ResponseBody
public R addInfo(String token, ApplyLogs applyLogs) {
Users user = usersService.getOne(cacheHandle.getUserInfoCache(token));
if(applyLogsService.isApply(user.getId(), applyLogs.getTeamId())){
applyLogs.setId(IDUtils.makeIDByCurrent());
applyLogs.setUserId(user.getId());
applyLogs.setCreateTime(DateUtils.getNowDate());
Log.info("添加申请记录,传入参数:{}", applyLogs);
applyLogsService.add(applyLogs);
return R.success();
}else{
return R.warn("申请审核中,请耐心等待");
}
}
@PostMapping("/upd")
@ResponseBody
public R updInfo(ApplyLogs applyLogs) {
Log.info("修改申请记录,传入参数:{}", applyLogs);
applyLogsService.update(applyLogs);
return R.success();
}
@PostMapping("/del")
@ResponseBody
public R delInfo(String id) {
Log.info("删除申请记录, ID:{}", id);
ApplyLogs applyLogs = applyLogsService.getOne(id);
applyLogsService.delete(applyLogs);
return R.success();
}
}
最近下载更多
微信网友_7739013020405760 LV1
10月23日
ziwng5211314 LV9
10月18日
康日澜 LV10
8月3日
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日
最近浏览更多
khmumuno
10月24日
暂无贡献等级
微信网友_7739013020405760 LV1
10月23日
ziwng5211314 LV9
10月18日
康日澜 LV10
8月2日
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日

