|
|
@@ -1,5 +1,7 @@
|
|
|
package com.izouma.nineth.web;
|
|
|
+
|
|
|
import com.izouma.nineth.domain.MetaQuestion;
|
|
|
+import com.izouma.nineth.dto.MetaRestResult;
|
|
|
import com.izouma.nineth.dto.PageQuery;
|
|
|
import com.izouma.nineth.exception.BusinessException;
|
|
|
import com.izouma.nineth.repo.MetaQuestionRepo;
|
|
|
@@ -12,6 +14,7 @@ import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.IOException;
|
|
|
+import java.util.Collections;
|
|
|
import java.util.List;
|
|
|
|
|
|
@RestController
|
|
|
@@ -56,5 +59,12 @@ public class MetaQuestionController extends BaseController {
|
|
|
ExcelUtils.export(response, data);
|
|
|
}
|
|
|
|
|
|
+ @GetMapping("/purpose/{purpose}/{num}")
|
|
|
+ public MetaRestResult<List<MetaQuestion>> purpose(@PathVariable Long purpose, @PathVariable int num){
|
|
|
+ List<MetaQuestion> metaQuestions = metaQuestionRepo.findAllByPurpose(purpose);
|
|
|
+ Collections.shuffle(metaQuestions);
|
|
|
+ List<MetaQuestion> ometaQuestions = metaQuestions.subList(0,num);
|
|
|
+ return MetaRestResult.returnSuccess(ometaQuestions);
|
|
|
+ }
|
|
|
}
|
|
|
|