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<>();