|
@@ -15,6 +15,8 @@ import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.data.domain.Example;
|
|
import org.springframework.data.domain.Example;
|
|
|
|
+import org.springframework.data.domain.Page;
|
|
|
|
+import org.springframework.data.domain.PageImpl;
|
|
import org.springframework.http.HttpStatus;
|
|
import org.springframework.http.HttpStatus;
|
|
import org.springframework.http.ResponseEntity;
|
|
import org.springframework.http.ResponseEntity;
|
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
@@ -446,14 +448,21 @@ public class PaperController {
|
|
@ApiOperation(value = "查询用于选题的试题列表", notes = "查询用于选题的试题列表")
|
|
@ApiOperation(value = "查询用于选题的试题列表", notes = "查询用于选题的试题列表")
|
|
@Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
|
|
@Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
|
|
@GetMapping(value = "/paper/listQuestion/{paperId}/{curPage}/{pageSize}")
|
|
@GetMapping(value = "/paper/listQuestion/{paperId}/{curPage}/{pageSize}")
|
|
- public ResponseEntity listQuestionforSelect(@PathVariable String paperId, @PathVariable int curPage,
|
|
|
|
- @PathVariable int pageSize, @RequestParam(name = "quesType") String quesType) {
|
|
|
|
|
|
+ public ResponseEntity listQuestionforSelect(HttpServletRequest request,
|
|
|
|
+ @PathVariable String paperId,
|
|
|
|
+ @PathVariable int curPage,
|
|
|
|
+ @PathVariable int pageSize,
|
|
|
|
+ @RequestParam(name = "quesType") String quesType) {
|
|
|
|
+ AccessUser accessUser = (AccessUser) request.getAttribute("accessUser");
|
|
|
|
+ if(accessUser == null){
|
|
|
|
+ return new ResponseEntity(new PageImpl<Question>(new ArrayList<Question>()),HttpStatus.OK);
|
|
|
|
+ }
|
|
if (StringUtils.isNotEmpty(quesType)) {
|
|
if (StringUtils.isNotEmpty(quesType)) {
|
|
return new ResponseEntity(
|
|
return new ResponseEntity(
|
|
- paperService.listQuestionforSelect(paperId, curPage, pageSize, QuesStructType.valueOf(quesType)),
|
|
|
|
|
|
+ paperService.listQuestionforSelect(paperId, curPage, pageSize, QuesStructType.valueOf(quesType),accessUser),
|
|
HttpStatus.OK);
|
|
HttpStatus.OK);
|
|
} else {
|
|
} else {
|
|
- return new ResponseEntity(paperService.listQuestionforSelect(paperId, curPage, pageSize, null),
|
|
|
|
|
|
+ return new ResponseEntity(paperService.listQuestionforSelect(paperId, curPage, pageSize, null,accessUser),
|
|
HttpStatus.OK);
|
|
HttpStatus.OK);
|
|
}
|
|
}
|
|
|
|
|