From f2c9aed30f0956ba0caa2aaa6eabb5e092bc893f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=AE=B6=E4=B8=9C?= <1654135867@qq.com> Date: Tue, 30 Jul 2024 17:57:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=AF=94=E8=B5=9B=E6=8A=A5=E5=90=8D=E5=87=BA?= =?UTF-8?q?=E7=8E=B0=E5=85=A8=E9=83=A8=E6=95=B0=E6=8D=AE=E4=BB=A5=E5=8F=8A?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E5=88=A4=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...petitionProjectRegistrationController.java | 207 +++++++++++++++++- 1 file changed, 201 insertions(+), 6 deletions(-) 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