From 2225ca7a31e48d4858ac5d94be33569d1013d641 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 18:24:04 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=84=E5=A7=94=E4=BC=9A=E8=A7=92=E8=89=B2?= =?UTF-8?q?=E5=87=BA=E7=8E=B0=E5=85=A8=E9=83=A8=E6=95=B0=E6=8D=AE=E4=BB=A5?= =?UTF-8?q?=E5=8F=8A=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 --- .../ChaoseTopicPersionController.java | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/chooseTopicPersion/controller/ChaoseTopicPersionController.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/chooseTopicPersion/controller/ChaoseTopicPersionController.java index ee96092f..16260830 100644 --- a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/chooseTopicPersion/controller/ChaoseTopicPersionController.java +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/chooseTopicPersion/controller/ChaoseTopicPersionController.java @@ -11,16 +11,21 @@ import java.net.URLDecoder; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.apache.shiro.SecurityUtils; import org.jeecg.common.api.CommonAPI; import org.jeecg.common.api.vo.Result; import org.jeecg.common.system.query.QueryGenerator; import org.jeecg.common.system.vo.DictModel; +import org.jeecg.common.system.vo.LoginUser; import org.jeecg.common.util.oConvertUtils; import org.jeecg.modules.demo.anncomgrotop.entity.AnnComGroTop; import org.jeecg.modules.demo.anncomgrotop.service.IAnnComGroTopService; import org.jeecg.modules.demo.anncomgrotopp.entity.AnnComGroTopP; import org.jeecg.modules.demo.anncomgrotopp.service.IAnnComGroTopPService; +import org.jeecg.modules.demo.annualCompPoint.entity.AnnualCompPoint; import org.jeecg.modules.demo.annualCompPoint.service.IAnnualCompPointService; +import org.jeecg.modules.demo.annualcomp.entity.AnnualComp; +import org.jeecg.modules.demo.annualcomp.service.IAnnualCompService; import org.jeecg.modules.demo.annualcompetitionprojectregistration.entity.AnnualCompetitionProjectRegistration; import org.jeecg.modules.demo.annualcompetitionprojectregistration.service.IAnnualCompetitionProjectRegistrationService; import org.jeecg.modules.demo.chooseTopicPersion.entity.ChaoseTopicPersion; @@ -33,6 +38,9 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import lombok.extern.slf4j.Slf4j; +import org.jeecg.modules.demo.comp.entity.Comp; +import org.jeecg.modules.demo.comp.service.ICompService; +import org.jeecg.modules.demo.topic.entity.Topic; import org.jeecg.modules.demo.topic.service.ITopicService; import org.jeecg.modules.demo.upfile_persion.entity.UpfilePersion; import org.jeecg.modules.demo.upfile_persion.service.IUpfilePersionService; @@ -80,6 +88,10 @@ public class ChaoseTopicPersionController extends JeecgController queryWrapper = QueryGenerator.initQueryWrapper(chaoseTopicPersion, req.getParameterMap()); + //根据当前登录信息查询题目id,用list去接受 + List topicid =gettopicid(); + if (topicid.isEmpty()){ + return Result.error("请检查比赛流程,未发现选题信息。"); + } + queryWrapper.in("timul",topicid); Page page = new Page<>(pageNo, pageSize); IPage pageList = chaoseTopicPersionService.page(page, queryWrapper); List chooseDtos = new ArrayList<>(); @@ -131,6 +149,53 @@ public class ChaoseTopicPersionController extends JeecgController gettopicid() { + List topicids = new ArrayList<>(); + LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + //根据登录信息查询负责比赛 + List compList =compService.query().eq("comp_admin",loginUser.getUsername()).list(); + //判空 + if (compList.isEmpty()){ + return topicids; + } + //将比赛的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 topicids; + } + //将年度比赛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 topicids; + } + //将年度比赛项目id存放到一个list里面 + List anncomppointIds = annualCompPointList.stream() + .map(AnnualCompPoint::getId) // 使用方法引用获取每个Comp对象的id + .collect(Collectors.toList()); // 收集到List中 + + //根据年度比赛项目id查询题目 + List topicList = topicService.query().in("annual_compid",anncomppointIds).list(); + if (topicList.isEmpty()){ + return topicids; + } + topicids =topicList.stream() + .map(Topic::getId) // 使用方法引用获取每个Comp对象的id + .collect(Collectors.toList()); // 收集到List中 + + return topicids; + + } + @GetMapping(value = "/watch") public Result watch(String enrollCode) { QueryWrapper queryWrapper = new QueryWrapper<>();