|
@@ -7,6 +7,7 @@ import java.util.stream.Stream;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.data.domain.Page;
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
@@ -45,31 +46,39 @@ public class PaperStructController {
|
|
|
|
|
|
/**
|
|
|
* 获取所有试卷结构
|
|
|
- *
|
|
|
* @param
|
|
|
* @return
|
|
|
*/
|
|
|
@ApiOperation(value = "获取试卷结构带分页", notes = "获取试卷结构带分页")
|
|
|
@Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
|
|
|
@GetMapping(value = "/paperStruct/{curPage}/{pageSize}")
|
|
|
- public ResponseEntity getPaperStructs(HttpServletRequest request, @ModelAttribute PaperStructSearchInfo searchInfo,
|
|
|
- @PathVariable int curPage, @PathVariable int pageSize) {
|
|
|
- AccessUser user = (AccessUser) request.getAttribute("accessUser");
|
|
|
- return new ResponseEntity(paperStructService.getPaperStructs(searchInfo, curPage, pageSize, user),
|
|
|
- HttpStatus.OK);
|
|
|
+ public ResponseEntity getPaperStructs(HttpServletRequest request,
|
|
|
+ @ModelAttribute PaperStructSearchInfo searchInfo,
|
|
|
+ @PathVariable int curPage,
|
|
|
+ @PathVariable int pageSize) {
|
|
|
+ AccessUser accessUser = (AccessUser) request.getAttribute("accessUser");
|
|
|
+ if(accessUser != null){
|
|
|
+ searchInfo.setOrgId(String.valueOf(accessUser.getRootOrgId()));
|
|
|
+ }
|
|
|
+ Page<PaperStruct> paperStructs= paperStructService.getPaperStructs(searchInfo, curPage, pageSize);
|
|
|
+ return new ResponseEntity(paperStructs, HttpStatus.OK);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取所有试卷结构
|
|
|
- *
|
|
|
* @param
|
|
|
* @return
|
|
|
*/
|
|
|
- @ApiOperation(value = "获取试卷结构", notes = "获取试卷结构")
|
|
|
+ @ApiOperation(value = "获取试卷结构不带分页", notes = "获取试卷结构不带分页")
|
|
|
@GetMapping(value = "/paperStruct")
|
|
|
@Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
|
|
|
- public ResponseEntity findAll() {
|
|
|
- return new ResponseEntity(paperStructRepo.findAll(), HttpStatus.OK);
|
|
|
+ public ResponseEntity getPaperStructs(HttpServletRequest request,@ModelAttribute PaperStructSearchInfo searchInfo) {
|
|
|
+ AccessUser accessUser = (AccessUser) request.getAttribute("accessUser");
|
|
|
+ if(accessUser != null){
|
|
|
+ searchInfo.setOrgId(String.valueOf(accessUser.getRootOrgId()));
|
|
|
+ }
|
|
|
+ List<PaperStruct> paperStructs = paperStructService.getPaperStructs(searchInfo);
|
|
|
+ return new ResponseEntity(paperStructs, HttpStatus.OK);
|
|
|
}
|
|
|
|
|
|
/**
|