|
@@ -1,6 +1,7 @@
|
|
package cn.com.qmth.examcloud.core.basic.api.controller;
|
|
package cn.com.qmth.examcloud.core.basic.api.controller;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
|
+import java.util.Iterator;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Stream;
|
|
import java.util.stream.Stream;
|
|
@@ -27,11 +28,15 @@ import org.springframework.web.bind.annotation.RestController;
|
|
import com.google.common.collect.Lists;
|
|
import com.google.common.collect.Lists;
|
|
|
|
|
|
import cn.com.qmth.examcloud.commons.base.exception.StatusException;
|
|
import cn.com.qmth.examcloud.commons.base.exception.StatusException;
|
|
|
|
+import cn.com.qmth.examcloud.commons.web.helpers.page.PageInfo;
|
|
import cn.com.qmth.examcloud.commons.web.security.bean.User;
|
|
import cn.com.qmth.examcloud.commons.web.security.bean.User;
|
|
import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
|
|
import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
|
|
|
|
+import cn.com.qmth.examcloud.core.basic.api.controller.bean.StudentDomain;
|
|
import cn.com.qmth.examcloud.core.basic.base.constants.BasicConsts;
|
|
import cn.com.qmth.examcloud.core.basic.base.constants.BasicConsts;
|
|
|
|
+import cn.com.qmth.examcloud.core.basic.dao.OrgRepo;
|
|
import cn.com.qmth.examcloud.core.basic.dao.StudentRepo;
|
|
import cn.com.qmth.examcloud.core.basic.dao.StudentRepo;
|
|
import cn.com.qmth.examcloud.core.basic.dao.UserRepo;
|
|
import cn.com.qmth.examcloud.core.basic.dao.UserRepo;
|
|
|
|
+import cn.com.qmth.examcloud.core.basic.dao.entity.OrgEntity;
|
|
import cn.com.qmth.examcloud.core.basic.dao.entity.StudentEntity;
|
|
import cn.com.qmth.examcloud.core.basic.dao.entity.StudentEntity;
|
|
import cn.com.qmth.examcloud.core.basic.service.StudentService;
|
|
import cn.com.qmth.examcloud.core.basic.service.StudentService;
|
|
import cn.com.qmth.examcloud.core.basic.service.bean.StudentInfo;
|
|
import cn.com.qmth.examcloud.core.basic.service.bean.StudentInfo;
|
|
@@ -54,6 +59,9 @@ public class StudentController extends ControllerSupport {
|
|
@Autowired
|
|
@Autowired
|
|
UserRepo userRepo;
|
|
UserRepo userRepo;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ OrgRepo orgRepo;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 方法注释
|
|
* 方法注释
|
|
*
|
|
*
|
|
@@ -67,7 +75,7 @@ public class StudentController extends ControllerSupport {
|
|
*/
|
|
*/
|
|
@ApiOperation(value = "查询学生分页数据", notes = "分页")
|
|
@ApiOperation(value = "查询学生分页数据", notes = "分页")
|
|
@GetMapping("studentPage/{curPage}/{pageSize}")
|
|
@GetMapping("studentPage/{curPage}/{pageSize}")
|
|
- public Page<StudentEntity> getStudentPage(@PathVariable Integer curPage,
|
|
|
|
|
|
+ public PageInfo<StudentDomain> getStudentPage(@PathVariable Integer curPage,
|
|
@PathVariable Integer pageSize, @RequestParam String name,
|
|
@PathVariable Integer pageSize, @RequestParam String name,
|
|
@RequestParam String studentCode, @RequestParam String identityNumber,
|
|
@RequestParam String studentCode, @RequestParam String identityNumber,
|
|
@RequestParam(required = false) Long rootOrgId) {
|
|
@RequestParam(required = false) Long rootOrgId) {
|
|
@@ -102,7 +110,43 @@ public class StudentController extends ControllerSupport {
|
|
new Sort(Direction.DESC, "updateTime"));
|
|
new Sort(Direction.DESC, "updateTime"));
|
|
|
|
|
|
Page<StudentEntity> studentList = studentRepo.findAll(specification, pageRequest);
|
|
Page<StudentEntity> studentList = studentRepo.findAll(specification, pageRequest);
|
|
- return studentList;
|
|
|
|
|
|
+
|
|
|
|
+ Iterator<StudentEntity> iterator = studentList.iterator();
|
|
|
|
+
|
|
|
|
+ List<StudentDomain> studentDomainList = Lists.newArrayList();
|
|
|
|
+
|
|
|
|
+ while (iterator.hasNext()) {
|
|
|
|
+ StudentEntity next = iterator.next();
|
|
|
|
+ StudentDomain bean = new StudentDomain();
|
|
|
|
+ bean.setId(next.getId());
|
|
|
|
+ bean.setName(next.getName());
|
|
|
|
+ bean.setRootOrgId(next.getRootOrgId());
|
|
|
|
+ bean.setUpdateTime(next.getUpdateTime());
|
|
|
|
+ bean.setCreationTime(next.getCreationTime());
|
|
|
|
+ bean.setEnable(next.getEnable());
|
|
|
|
+ bean.setStudentCode(next.getStudentCode());
|
|
|
|
+ bean.setIdentityNumber(next.getIdentityNumber());
|
|
|
|
+ bean.setPhotoPath(next.getPhotoPath());
|
|
|
|
+ bean.setPhoneNumber(next.getPhoneNumber());
|
|
|
|
+ bean.setSecurityPhone(next.getSecurityPhone());
|
|
|
|
+ bean.setRemark(next.getRemark());
|
|
|
|
+
|
|
|
|
+ bean.setOrgId(next.getOrgId());
|
|
|
|
+ if (null != bean.getOrgId()) {
|
|
|
|
+ OrgEntity org = orgRepo.findOne(Long.valueOf(bean.getOrgId()));
|
|
|
|
+ if (null != org) {
|
|
|
|
+ bean.setOrgName(org.getName());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ studentDomainList.add(bean);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ PageInfo<StudentDomain> ret = new PageInfo<StudentDomain>();
|
|
|
|
+ ret.setList(studentDomainList);
|
|
|
|
+ ret.setTotal(studentList.getTotalElements());
|
|
|
|
+ return ret;
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|