比赛报名出现全部数据以及没有判空

main
王家东 4 months ago
parent 13ebba7b6f
commit f2c9aed30f
  1. 207
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualcompetitionprojectregistration/controller/AnnualCompetitionProjectRegistrationController.java

@ -143,8 +143,40 @@ public class AnnualCompetitionProjectRegistrationController {
//处理查询信息 //处理查询信息
QueryWrapper<AnnualCompetitionProjectRegistration> queryWrapper = QueryGenerator.initQueryWrapper(annualCompetitionProjectRegistration, req.getParameterMap()); QueryWrapper<AnnualCompetitionProjectRegistration> queryWrapper = QueryGenerator.initQueryWrapper(annualCompetitionProjectRegistration, req.getParameterMap());
Page<AnnualCompetitionProjectRegistration> page = new Page<AnnualCompetitionProjectRegistration>(pageNo, pageSize); Page<AnnualCompetitionProjectRegistration> page = new Page<AnnualCompetitionProjectRegistration>(pageNo, pageSize);
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
//根据登录信息查询负责比赛
List<Comp> compList =compService.query().eq("comp_admin",loginUser.getUsername()).list();
//判空
if (compList.isEmpty()){
return Result.error("未绑定比赛");
}
//将比赛的id放进一个list里面
List<String> compIds = compList.stream()
.map(Comp::getId) // 使用方法引用获取每个Comp对象的id
.collect(Collectors.toList()); // 收集到List中
//根据比赛的id查询年度比赛id,这里没有去卡年度
List<AnnualComp> annualCompList = annualCompService.query().in("compid",compIds).list();
//判空
if (annualCompList.isEmpty()){
return Result.error("未创建年度比赛");
}
//将年度比赛id存放到一个list里面
List<String> anncompIds = annualCompList.stream()
.map(AnnualComp::getId) // 使用方法引用获取每个Comp对象的id
.collect(Collectors.toList()); // 收集到List中
List<AnnualCompPoint> annualCompPointList = annualCompPointService.query().in("annual_comp_id", anncompIds).list();
//判空
if (annualCompPointList.isEmpty()){
return Result.error("未创建年度比赛项目");
}
//将年度比赛项目id存放到一个list里面
List<String> anncomppointIds = annualCompPointList.stream()
.map(AnnualCompPoint::getId) // 使用方法引用获取每个Comp对象的id
.collect(Collectors.toList()); // 收集到List中
//根据用户角色决定查询信息 //根据用户角色决定查询信息
queryWrapperAddRoleInfo(queryWrapper); queryWrapper.in("annual_compid",anncomppointIds);
/* queryWrapperAddRoleInfo(queryWrapper);*/
//查询 //查询
IPage<AnnualCompetitionProjectRegistration> pageList = annualCompetitionProjectRegistrationService.page(page, queryWrapper); IPage<AnnualCompetitionProjectRegistration> pageList = annualCompetitionProjectRegistrationService.page(page, queryWrapper);
//处理返回信息 //处理返回信息
@ -163,8 +195,40 @@ public class AnnualCompetitionProjectRegistrationController {
//处理查询信息 //处理查询信息
QueryWrapper<AnnualCompetitionProjectRegistration> queryWrapper = QueryGenerator.initQueryWrapper(annualCompetitionProjectRegistration, req.getParameterMap()); QueryWrapper<AnnualCompetitionProjectRegistration> queryWrapper = QueryGenerator.initQueryWrapper(annualCompetitionProjectRegistration, req.getParameterMap());
Page<AnnualCompetitionProjectRegistration> page = new Page<AnnualCompetitionProjectRegistration>(pageNo, pageSize); Page<AnnualCompetitionProjectRegistration> page = new Page<AnnualCompetitionProjectRegistration>(pageNo, pageSize);
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
//根据登录信息查询负责比赛
List<Comp> compList =compService.query().eq("comp_admin",loginUser.getUsername()).list();
//判空
if (compList.isEmpty()){
return Result.error("未绑定比赛");
}
//将比赛的id放进一个list里面
List<String> compIds = compList.stream()
.map(Comp::getId) // 使用方法引用获取每个Comp对象的id
.collect(Collectors.toList()); // 收集到List中
//根据比赛的id查询年度比赛id,这里没有去卡年度
List<AnnualComp> annualCompList = annualCompService.query().in("compid",compIds).list();
//判空
if (annualCompList.isEmpty()){
return Result.error("未创建年度比赛");
}
//将年度比赛id存放到一个list里面
List<String> anncompIds = annualCompList.stream()
.map(AnnualComp::getId) // 使用方法引用获取每个Comp对象的id
.collect(Collectors.toList()); // 收集到List中
List<AnnualCompPoint> annualCompPointList = annualCompPointService.query().in("annual_comp_id", anncompIds).list();
//判空
if (annualCompPointList.isEmpty()){
return Result.error("未创建年度比赛项目");
}
//将年度比赛项目id存放到一个list里面
List<String> anncomppointIds = annualCompPointList.stream()
.map(AnnualCompPoint::getId) // 使用方法引用获取每个Comp对象的id
.collect(Collectors.toList()); // 收集到List中
//根据用户角色决定查询信息 //根据用户角色决定查询信息
queryWrapperAddRoleInfo(queryWrapper); queryWrapper.in("annual_compid",anncomppointIds);
/* queryWrapperAddRoleInfo(queryWrapper);*/
queryWrapper.eq("enroll_static", "2"); queryWrapper.eq("enroll_static", "2");
//查询 //查询
IPage<AnnualCompetitionProjectRegistration> pageList = annualCompetitionProjectRegistrationService.page(page, queryWrapper); IPage<AnnualCompetitionProjectRegistration> pageList = annualCompetitionProjectRegistrationService.page(page, queryWrapper);
@ -184,8 +248,40 @@ public class AnnualCompetitionProjectRegistrationController {
//处理查询信息 //处理查询信息
QueryWrapper<AnnualCompetitionProjectRegistration> queryWrapper = QueryGenerator.initQueryWrapper(annualCompetitionProjectRegistration, req.getParameterMap()); QueryWrapper<AnnualCompetitionProjectRegistration> queryWrapper = QueryGenerator.initQueryWrapper(annualCompetitionProjectRegistration, req.getParameterMap());
Page<AnnualCompetitionProjectRegistration> page = new Page<AnnualCompetitionProjectRegistration>(pageNo, pageSize); Page<AnnualCompetitionProjectRegistration> page = new Page<AnnualCompetitionProjectRegistration>(pageNo, pageSize);
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
//根据登录信息查询负责比赛
List<Comp> compList =compService.query().eq("comp_admin",loginUser.getUsername()).list();
//判空
if (compList.isEmpty()){
return Result.error("未绑定比赛");
}
//将比赛的id放进一个list里面
List<String> compIds = compList.stream()
.map(Comp::getId) // 使用方法引用获取每个Comp对象的id
.collect(Collectors.toList()); // 收集到List中
//根据比赛的id查询年度比赛id,这里没有去卡年度
List<AnnualComp> annualCompList = annualCompService.query().in("compid",compIds).list();
//判空
if (annualCompList.isEmpty()){
return Result.error("未创建年度比赛");
}
//将年度比赛id存放到一个list里面
List<String> anncompIds = annualCompList.stream()
.map(AnnualComp::getId) // 使用方法引用获取每个Comp对象的id
.collect(Collectors.toList()); // 收集到List中
List<AnnualCompPoint> annualCompPointList = annualCompPointService.query().in("annual_comp_id", anncompIds).list();
//判空
if (annualCompPointList.isEmpty()){
return Result.error("未创建年度比赛项目");
}
//将年度比赛项目id存放到一个list里面
List<String> anncomppointIds = annualCompPointList.stream()
.map(AnnualCompPoint::getId) // 使用方法引用获取每个Comp对象的id
.collect(Collectors.toList()); // 收集到List中
//根据用户角色决定查询信息 //根据用户角色决定查询信息
queryWrapperAddRoleInfo(queryWrapper); queryWrapper.in("annual_compid",anncomppointIds);
/* queryWrapperAddRoleInfo(queryWrapper);*/
queryWrapper.eq("enroll_static", "4"); queryWrapper.eq("enroll_static", "4");
//查询 //查询
IPage<AnnualCompetitionProjectRegistration> pageList = annualCompetitionProjectRegistrationService.page(page, queryWrapper); IPage<AnnualCompetitionProjectRegistration> pageList = annualCompetitionProjectRegistrationService.page(page, queryWrapper);
@ -206,8 +302,40 @@ public class AnnualCompetitionProjectRegistrationController {
//处理查询信息 //处理查询信息
QueryWrapper<AnnualCompetitionProjectRegistration> queryWrapper = QueryGenerator.initQueryWrapper(annualCompetitionProjectRegistration, req.getParameterMap()); QueryWrapper<AnnualCompetitionProjectRegistration> queryWrapper = QueryGenerator.initQueryWrapper(annualCompetitionProjectRegistration, req.getParameterMap());
Page<AnnualCompetitionProjectRegistration> page = new Page<AnnualCompetitionProjectRegistration>(pageNo, pageSize); Page<AnnualCompetitionProjectRegistration> page = new Page<AnnualCompetitionProjectRegistration>(pageNo, pageSize);
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
//根据登录信息查询负责比赛
List<Comp> compList =compService.query().eq("comp_admin",loginUser.getUsername()).list();
//判空
if (compList.isEmpty()){
return Result.error("未绑定比赛");
}
//将比赛的id放进一个list里面
List<String> compIds = compList.stream()
.map(Comp::getId) // 使用方法引用获取每个Comp对象的id
.collect(Collectors.toList()); // 收集到List中
//根据比赛的id查询年度比赛id,这里没有去卡年度
List<AnnualComp> annualCompList = annualCompService.query().in("compid",compIds).list();
//判空
if (annualCompList.isEmpty()){
return Result.error("未创建年度比赛");
}
//将年度比赛id存放到一个list里面
List<String> anncompIds = annualCompList.stream()
.map(AnnualComp::getId) // 使用方法引用获取每个Comp对象的id
.collect(Collectors.toList()); // 收集到List中
List<AnnualCompPoint> annualCompPointList = annualCompPointService.query().in("annual_comp_id", anncompIds).list();
//判空
if (annualCompPointList.isEmpty()){
return Result.error("未创建年度比赛项目");
}
//将年度比赛项目id存放到一个list里面
List<String> anncomppointIds = annualCompPointList.stream()
.map(AnnualCompPoint::getId) // 使用方法引用获取每个Comp对象的id
.collect(Collectors.toList()); // 收集到List中
//根据用户角色决定查询信息 //根据用户角色决定查询信息
queryWrapperAddRoleInfo(queryWrapper); queryWrapper.in("annual_compid",anncomppointIds);
/* queryWrapperAddRoleInfo(queryWrapper);*/
queryWrapper.eq("enroll_static", "1"); queryWrapper.eq("enroll_static", "1");
//查询 //查询
IPage<AnnualCompetitionProjectRegistration> pageList = annualCompetitionProjectRegistrationService.page(page, queryWrapper); IPage<AnnualCompetitionProjectRegistration> pageList = annualCompetitionProjectRegistrationService.page(page, queryWrapper);
@ -227,8 +355,40 @@ public class AnnualCompetitionProjectRegistrationController {
//处理查询信息 //处理查询信息
QueryWrapper<AnnualCompetitionProjectRegistration> queryWrapper = QueryGenerator.initQueryWrapper(annualCompetitionProjectRegistration, req.getParameterMap()); QueryWrapper<AnnualCompetitionProjectRegistration> queryWrapper = QueryGenerator.initQueryWrapper(annualCompetitionProjectRegistration, req.getParameterMap());
Page<AnnualCompetitionProjectRegistration> page = new Page<AnnualCompetitionProjectRegistration>(pageNo, pageSize); Page<AnnualCompetitionProjectRegistration> page = new Page<AnnualCompetitionProjectRegistration>(pageNo, pageSize);
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
//根据登录信息查询负责比赛
List<Comp> compList =compService.query().eq("comp_admin",loginUser.getUsername()).list();
//判空
if (compList.isEmpty()){
return Result.error("未绑定比赛");
}
//将比赛的id放进一个list里面
List<String> compIds = compList.stream()
.map(Comp::getId) // 使用方法引用获取每个Comp对象的id
.collect(Collectors.toList()); // 收集到List中
//根据比赛的id查询年度比赛id,这里没有去卡年度
List<AnnualComp> annualCompList = annualCompService.query().in("compid",compIds).list();
//判空
if (annualCompList.isEmpty()){
return Result.error("未创建年度比赛");
}
//将年度比赛id存放到一个list里面
List<String> anncompIds = annualCompList.stream()
.map(AnnualComp::getId) // 使用方法引用获取每个Comp对象的id
.collect(Collectors.toList()); // 收集到List中
List<AnnualCompPoint> annualCompPointList = annualCompPointService.query().in("annual_comp_id", anncompIds).list();
//判空
if (annualCompPointList.isEmpty()){
return Result.error("未创建年度比赛项目");
}
//将年度比赛项目id存放到一个list里面
List<String> anncomppointIds = annualCompPointList.stream()
.map(AnnualCompPoint::getId) // 使用方法引用获取每个Comp对象的id
.collect(Collectors.toList()); // 收集到List中
//根据用户角色决定查询信息 //根据用户角色决定查询信息
queryWrapperAddRoleInfo(queryWrapper); queryWrapper.in("annual_compid",anncomppointIds);
/* queryWrapperAddRoleInfo(queryWrapper);*/
queryWrapper.eq("enroll_static", "0"); queryWrapper.eq("enroll_static", "0");
//查询 //查询
IPage<AnnualCompetitionProjectRegistration> pageList = annualCompetitionProjectRegistrationService.page(page, queryWrapper); IPage<AnnualCompetitionProjectRegistration> pageList = annualCompetitionProjectRegistrationService.page(page, queryWrapper);
@ -248,8 +408,40 @@ public class AnnualCompetitionProjectRegistrationController {
//处理查询信息 //处理查询信息
QueryWrapper<AnnualCompetitionProjectRegistration> queryWrapper = QueryGenerator.initQueryWrapper(annualCompetitionProjectRegistration, req.getParameterMap()); QueryWrapper<AnnualCompetitionProjectRegistration> queryWrapper = QueryGenerator.initQueryWrapper(annualCompetitionProjectRegistration, req.getParameterMap());
Page<AnnualCompetitionProjectRegistration> page = new Page<AnnualCompetitionProjectRegistration>(pageNo, pageSize); Page<AnnualCompetitionProjectRegistration> page = new Page<AnnualCompetitionProjectRegistration>(pageNo, pageSize);
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
//根据登录信息查询负责比赛
List<Comp> compList =compService.query().eq("comp_admin",loginUser.getUsername()).list();
//判空
if (compList.isEmpty()){
return Result.error("未绑定比赛");
}
//将比赛的id放进一个list里面
List<String> compIds = compList.stream()
.map(Comp::getId) // 使用方法引用获取每个Comp对象的id
.collect(Collectors.toList()); // 收集到List中
//根据比赛的id查询年度比赛id,这里没有去卡年度
List<AnnualComp> annualCompList = annualCompService.query().in("compid",compIds).list();
//判空
if (annualCompList.isEmpty()){
return Result.error("未创建年度比赛");
}
//将年度比赛id存放到一个list里面
List<String> anncompIds = annualCompList.stream()
.map(AnnualComp::getId) // 使用方法引用获取每个Comp对象的id
.collect(Collectors.toList()); // 收集到List中
List<AnnualCompPoint> annualCompPointList = annualCompPointService.query().in("annual_comp_id", anncompIds).list();
//判空
if (annualCompPointList.isEmpty()){
return Result.error("未创建年度比赛项目");
}
//将年度比赛项目id存放到一个list里面
List<String> anncomppointIds = annualCompPointList.stream()
.map(AnnualCompPoint::getId) // 使用方法引用获取每个Comp对象的id
.collect(Collectors.toList()); // 收集到List中
//根据用户角色决定查询信息 //根据用户角色决定查询信息
queryWrapperAddRoleInfo(queryWrapper); queryWrapper.in("annual_compid",anncomppointIds);
/* queryWrapperAddRoleInfo(queryWrapper);*/
queryWrapper.eq("enroll_static", "3"); queryWrapper.eq("enroll_static", "3");
//查询 //查询
IPage<AnnualCompetitionProjectRegistration> pageList = annualCompetitionProjectRegistrationService.page(page, queryWrapper); IPage<AnnualCompetitionProjectRegistration> pageList = annualCompetitionProjectRegistrationService.page(page, queryWrapper);
@ -273,6 +465,9 @@ public class AnnualCompetitionProjectRegistrationController {
} else if (role.equals("committee")) { } else if (role.equals("committee")) {
//首先获取负责的比赛 //首先获取负责的比赛
List<Comp> compList = compService.query().eq("comp_admin",loginUser.getUsername()).list(); List<Comp> compList = compService.query().eq("comp_admin",loginUser.getUsername()).list();
if(compList.isEmpty()){
return ;
}
//将比赛的id放进一个list里面 //将比赛的id放进一个list里面
List<String> compIds = compList.stream() List<String> compIds = compList.stream()
.map(Comp::getId) // 使用方法引用获取每个Comp对象的id .map(Comp::getId) // 使用方法引用获取每个Comp对象的id

Loading…
Cancel
Save