排行页面
@ -1,9 +1,8 @@
|
||||
import request from '@/utils/request'
|
||||
let baseUrl = '/api/competition/'
|
||||
export function getList(query) {
|
||||
export function getList(pageNO,type) {
|
||||
return request({
|
||||
url: baseUrl+'list',
|
||||
method: 'post',
|
||||
data: query
|
||||
url: baseUrl+'list'+"/"+type+"/"+pageNO,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
After Width: | Height: | Size: 8.6 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 404 B |
After Width: | Height: | Size: 482 B |
After Width: | Height: | Size: 447 B |
After Width: | Height: | Size: 551 B |
After Width: | Height: | Size: 384 B |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 37 KiB |
@ -1,17 +1,36 @@
|
||||
package com.tz.platform.competitiion.api.biz;
|
||||
|
||||
import com.tz.platform.common.core.base.Result;
|
||||
import com.tz.platform.common.core.tools.BeanUtils;
|
||||
import com.tz.platform.competitiion.api.dto.IndexCompetitionDTO;
|
||||
import com.tz.platform.competitiion.api.dto.IndexListCompetitionDTO;
|
||||
import com.tz.platform.entity.Competition;
|
||||
import com.tz.platform.repository.CompetitionDao;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
public class CompetitionIndexBiz {
|
||||
@Autowired
|
||||
private CompetitionDao competitionDao;
|
||||
|
||||
public Result<IndexListCompetitionDTO> list(int pageNo){
|
||||
return Result.error("");
|
||||
public Result<IndexListCompetitionDTO> list(int pageNo,int type){
|
||||
int pageSize = 20;
|
||||
if(pageNo<0){
|
||||
pageNo = 0;
|
||||
}
|
||||
pageNo =pageNo* pageSize;
|
||||
Pageable pageable = PageRequest.of(pageNo,pageSize);
|
||||
Page<Competition> competitionList = competitionDao.findAllByStatus(type,pageable);
|
||||
System.out.println(competitionList.getContent());
|
||||
IndexListCompetitionDTO dto = new IndexListCompetitionDTO();
|
||||
List<IndexCompetitionDTO> competitionDTOList = BeanUtils.copyProperties(competitionList.getContent(),IndexCompetitionDTO.class);
|
||||
dto.setList(competitionDTOList);
|
||||
return Result.success(dto);
|
||||
}
|
||||
}
|
||||
|
@ -1,17 +1,24 @@
|
||||
package com.tz.platform.competitiion.api.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class IndexCompetitionDTO implements Serializable {
|
||||
private Integer id;
|
||||
private String name;
|
||||
private String sponsor;
|
||||
private String supporter;
|
||||
private String thumbnail;
|
||||
private Date startTime;
|
||||
private Date endTime;
|
||||
private Date sinUpStartTime;
|
||||
private Date sinUpEndTime;
|
||||
private Boolean enableSignup;
|
||||
}
|
||||
|
@ -1,4 +1,17 @@
|
||||
package com.tz.platform.api;
|
||||
|
||||
public class ExamApiController {
|
||||
import com.tz.platform.api.dto.ListExamQuestionDTO;
|
||||
import com.tz.platform.common.core.base.BaseController;
|
||||
import com.tz.platform.common.core.base.Result;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "/api/exam")
|
||||
public class ExamApiController extends BaseController {
|
||||
|
||||
|
||||
public Result<ListExamQuestionDTO> listExam(){
|
||||
return Result.error("failed");
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,23 @@
|
||||
package com.tz.platform.api.dto;
|
||||
|
||||
import com.tz.platform.common.core.bo.Answer;
|
||||
import com.tz.platform.common.core.bo.SubQuestionVO;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class ExamQuestionDTO {
|
||||
private Long id;
|
||||
private Integer levelId;
|
||||
private String levelName;
|
||||
private Integer questionType;
|
||||
private Long score;
|
||||
private Integer type;
|
||||
private String stem;
|
||||
private String content;
|
||||
private String stemImg;
|
||||
private Integer status;
|
||||
List<Answer> answerList;
|
||||
private List<SubQuestionVO> children;
|
||||
}
|
||||
|
@ -1,4 +1,11 @@
|
||||
package com.tz.platform.api.dto;
|
||||
|
||||
public class ListExamQuestionDTO {
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class ListExamQuestionDTO implements Serializable {
|
||||
List<ExamQuestionDTO> list;
|
||||
}
|
||||
|
@ -1,4 +1,34 @@
|
||||
package com.tz.platform.config;
|
||||
|
||||
|
||||
import org.springframework.amqp.core.Binding;
|
||||
import org.springframework.amqp.core.BindingBuilder;
|
||||
import org.springframework.amqp.core.DirectExchange;
|
||||
import org.springframework.amqp.core.Queue;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class TzRabbitConfig {
|
||||
|
||||
@Bean
|
||||
public Queue examQueue(){
|
||||
return new Queue("ExamQueue",true);
|
||||
}
|
||||
|
||||
@Bean
|
||||
DirectExchange examExchange(){
|
||||
return new DirectExchange("ExamExchange",true,false);
|
||||
}
|
||||
|
||||
@Bean
|
||||
Binding bindingExam(){
|
||||
return BindingBuilder.bind(examQueue()).to(examExchange()).with("ExamRouting");
|
||||
}
|
||||
|
||||
@Bean
|
||||
DirectExchange lonelyExchange(){
|
||||
return new DirectExchange("lonelyDirectExchange");
|
||||
}
|
||||
|
||||
}
|
||||
|