|
@@ -1,7 +1,10 @@
|
|
package cn.com.qmth.examcloud.task.api.controller;
|
|
package cn.com.qmth.examcloud.task.api.controller;
|
|
|
|
|
|
import java.io.File;
|
|
import java.io.File;
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
+import java.util.List;
|
|
|
|
|
|
|
|
+import javax.persistence.criteria.Predicate;
|
|
import javax.transaction.Transactional;
|
|
import javax.transaction.Transactional;
|
|
|
|
|
|
import org.apache.commons.fileupload.disk.DiskFileItem;
|
|
import org.apache.commons.fileupload.disk.DiskFileItem;
|
|
@@ -12,6 +15,7 @@ import org.springframework.data.domain.Page;
|
|
import org.springframework.data.domain.PageRequest;
|
|
import org.springframework.data.domain.PageRequest;
|
|
import org.springframework.data.domain.Pageable;
|
|
import org.springframework.data.domain.Pageable;
|
|
import org.springframework.data.domain.Sort;
|
|
import org.springframework.data.domain.Sort;
|
|
|
|
+import org.springframework.data.jpa.domain.Specification;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
@@ -104,9 +108,20 @@ public class ExamStudentImportController extends ControllerSupport {
|
|
@GetMapping("/all/{curPage}/{pageSize}")
|
|
@GetMapping("/all/{curPage}/{pageSize}")
|
|
public Page<ExamStudentImportEntity> getExamStudentImportList(@PathVariable Integer curPage,
|
|
public Page<ExamStudentImportEntity> getExamStudentImportList(@PathVariable Integer curPage,
|
|
@PathVariable Integer pageSize) {
|
|
@PathVariable Integer pageSize) {
|
|
|
|
+ User accessUser = getAccessUser();
|
|
|
|
+ Long rootOrgId = accessUser.getRootOrgId();
|
|
|
|
+
|
|
|
|
+ Specification<ExamStudentImportEntity> specification = (root, query, cb) -> {
|
|
|
|
+ List<Predicate> predicates = new ArrayList<>();
|
|
|
|
+ if (!isSuperAdmin()) {
|
|
|
|
+ predicates.add(cb.equal(root.get("rootOrgId"), rootOrgId));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return cb.and(predicates.toArray(new Predicate[predicates.size()]));
|
|
|
|
+ };
|
|
|
|
|
|
Pageable pageable = new PageRequest(curPage, pageSize, Sort.Direction.DESC, "updateTime");
|
|
Pageable pageable = new PageRequest(curPage, pageSize, Sort.Direction.DESC, "updateTime");
|
|
- Page<ExamStudentImportEntity> list = examStudentImportRepo.findAll(pageable);
|
|
|
|
|
|
+ Page<ExamStudentImportEntity> list = examStudentImportRepo.findAll(specification, pageable);
|
|
|
|
|
|
return list;
|
|
return list;
|
|
}
|
|
}
|