|
|
|
@ -56,7 +56,7 @@ public class CompetitionIndexBiz {
|
|
|
|
|
@Autowired
|
|
|
|
|
private RedisTemplate<String,Object> template;
|
|
|
|
|
|
|
|
|
|
public Result<IndexListCompetitionDTO> list(int pageNo,int type,Long userNo){
|
|
|
|
|
public Result<IndexListCompetitionDTO> list(int pageNo,int type,Long userNo,String name,String school){
|
|
|
|
|
int pageSize = 100;
|
|
|
|
|
pageNo = pageNo - 1;
|
|
|
|
|
if(pageNo<0){
|
|
|
|
@ -66,8 +66,11 @@ public class CompetitionIndexBiz {
|
|
|
|
|
|
|
|
|
|
// String compListKey = "competition_list_"+type+"_"+pageNo;
|
|
|
|
|
Sort sort = Sort.by(Sort.Direction.DESC, "id");
|
|
|
|
|
List<CompetitionMember> allByNameAndUserName = competitionMemberDao.findAllByNameAndSchool(name, school);
|
|
|
|
|
List<Long> ids = allByNameAndUserName.stream().map(CompetitionMember::getCompetitionId).collect(Collectors.toList());
|
|
|
|
|
Pageable pageable = PageRequest.of(pageNo,pageSize,sort);
|
|
|
|
|
Page<Competition> competitionList = competitionDao.findAllByStatus(type,pageable);
|
|
|
|
|
Page<Competition> competitionList = competitionDao.findByIdInAndStatus(ids,type,pageable);
|
|
|
|
|
Page<Competition> competitionList1 = competitionDao.findAllByStatus(type,pageable);
|
|
|
|
|
List<Competition> rsList = competitionList.getContent();
|
|
|
|
|
if(userNo!=null){
|
|
|
|
|
UserVo userVo = feignUser.getByUserNo(userNo);
|
|
|
|
@ -86,6 +89,36 @@ public class CompetitionIndexBiz {
|
|
|
|
|
return Result.success(dto);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// public Result<IndexListCompetitionDTO> list(int pageNo,int type,Long userNo){
|
|
|
|
|
// int pageSize = 100;
|
|
|
|
|
// pageNo = pageNo - 1;
|
|
|
|
|
// if(pageNo<0){
|
|
|
|
|
// pageNo = 0;
|
|
|
|
|
// }
|
|
|
|
|
// pageNo =pageNo* pageSize;
|
|
|
|
|
//
|
|
|
|
|
//// String compListKey = "competition_list_"+type+"_"+pageNo;
|
|
|
|
|
// Sort sort = Sort.by(Sort.Direction.DESC, "id");
|
|
|
|
|
// Pageable pageable = PageRequest.of(pageNo,pageSize,sort);
|
|
|
|
|
// Page<Competition> competitionList = competitionDao.findAllByStatus(type,pageable);
|
|
|
|
|
// List<Competition> rsList = competitionList.getContent();
|
|
|
|
|
// if(userNo!=null){
|
|
|
|
|
// UserVo userVo = feignUser.getByUserNo(userNo);
|
|
|
|
|
// if(type == 1){
|
|
|
|
|
// System.out.println("stop");
|
|
|
|
|
// }
|
|
|
|
|
// if(userVo!=null&&competitionList.getContent()!=null&&competitionList.getContent().size()>0){
|
|
|
|
|
// List<Competition> list = competitionList.getContent().stream().filter(competition ->competition.getSchoolId()!=null&& competition.getSchoolId().equals(userVo.getSchoolId())).collect(Collectors.toList());
|
|
|
|
|
// rsList =list;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// IndexListCompetitionDTO dto = new IndexListCompetitionDTO();
|
|
|
|
|
// List<IndexCompetitionDTO> competitionDTOList = BeanUtils.copyProperties(rsList,IndexCompetitionDTO.class);
|
|
|
|
|
// dto.setList(competitionDTOList);
|
|
|
|
|
// return Result.success(dto);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
public Result<CompetitionDTO> get(Long compId){
|
|
|
|
|
// String compKey = "competition_"+compId;
|
|
|
|
|
// Object compObj = template.opsForValue().get(compKey);
|
|
|
|
|