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