|
@@ -35,7 +35,7 @@ import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
|
|
|
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.constants.Consts;
|
|
|
-import cn.com.qmth.examcloud.core.basic.dao.entity.Student;
|
|
|
+import cn.com.qmth.examcloud.core.basic.dao.entity.StudentEntity;
|
|
|
import cn.com.qmth.examcloud.core.basic.service.bean.StudentInfo;
|
|
|
import cn.com.qmth.examcloud.core.basic.service.impl.StudentServiceImpl;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
@@ -70,12 +70,12 @@ public class StudentController extends ControllerSupport {
|
|
|
*/
|
|
|
@ApiOperation(value = "查询所有学生", notes = "分页")
|
|
|
@GetMapping("/{curPage}/{pageSize}")
|
|
|
- public Page<Student> getAllStudent(@RequestParam String name, @RequestParam String studentCode,
|
|
|
+ public Page<StudentEntity> getAllStudent(@RequestParam String name, @RequestParam String studentCode,
|
|
|
@RequestParam String identityNumber, @PathVariable Integer curPage,
|
|
|
@PathVariable Integer pageSize) {
|
|
|
User accessUser = getAccessUser();
|
|
|
|
|
|
- Specification<Student> specification = (root, query, cb) -> {
|
|
|
+ Specification<StudentEntity> specification = (root, query, cb) -> {
|
|
|
List<Predicate> predicates = new ArrayList<>();
|
|
|
predicates.add(cb.equal(root.get("rootOrgId"), accessUser.getRootOrgId()));
|
|
|
|
|
@@ -95,14 +95,14 @@ public class StudentController extends ControllerSupport {
|
|
|
PageRequest pageRequest = new PageRequest(curPage, pageSize,
|
|
|
new Sort(Direction.DESC, "updateTime"));
|
|
|
|
|
|
- Page<Student> studentList = studentRepo.findAll(specification, pageRequest);
|
|
|
+ Page<StudentEntity> studentList = studentRepo.findAll(specification, pageRequest);
|
|
|
return studentList;
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "查询所有学生", notes = "不分页")
|
|
|
@GetMapping
|
|
|
public ResponseEntity getAllStudent(HttpServletRequest request,
|
|
|
- @ModelAttribute Student studentCriteria) {
|
|
|
+ @ModelAttribute StudentEntity studentCriteria) {
|
|
|
cn.com.qmth.examcloud.commons.web.security.bean.User accessUser = getAccessUser();
|
|
|
if (accessUser != null) {
|
|
|
if (accessUser.getRootOrgId().longValue() == accessUser.getOrgId().longValue()) {
|
|
@@ -123,8 +123,8 @@ public class StudentController extends ControllerSupport {
|
|
|
*/
|
|
|
@ApiOperation(value = "按ID查询学生", notes = "ID查询")
|
|
|
@GetMapping("/{id}")
|
|
|
- public Student getStudentById(@PathVariable Long id) {
|
|
|
- Student s = studentRepo.findOne(id);
|
|
|
+ public StudentEntity getStudentById(@PathVariable Long id) {
|
|
|
+ StudentEntity s = studentRepo.findOne(id);
|
|
|
return s;
|
|
|
}
|
|
|
|
|
@@ -156,7 +156,7 @@ public class StudentController extends ControllerSupport {
|
|
|
.collect(Collectors.toList());
|
|
|
List<String> ret = Lists.newArrayList();
|
|
|
for (Long cur : studentIds) {
|
|
|
- Student s = studentRepo.findOne(cur);
|
|
|
+ StudentEntity s = studentRepo.findOne(cur);
|
|
|
s.setEnable(true);
|
|
|
studentRepo.save(s);
|
|
|
ret.add(s.getId() + ":" + s.getName());
|
|
@@ -178,7 +178,7 @@ public class StudentController extends ControllerSupport {
|
|
|
.collect(Collectors.toList());
|
|
|
List<String> ret = Lists.newArrayList();
|
|
|
for (Long cur : studentIds) {
|
|
|
- Student s = studentRepo.findOne(cur);
|
|
|
+ StudentEntity s = studentRepo.findOne(cur);
|
|
|
s.setEnable(false);
|
|
|
studentRepo.save(s);
|
|
|
ret.add(s.getId() + ":" + s.getName());
|
|
@@ -192,7 +192,7 @@ public class StudentController extends ControllerSupport {
|
|
|
List<Long> studentIds = Stream.of(ids.split(",")).map(s -> Long.parseLong(s.trim()))
|
|
|
.collect(Collectors.toList());
|
|
|
for (Long cur : studentIds) {
|
|
|
- Student s = studentRepo.findOne(cur);
|
|
|
+ StudentEntity s = studentRepo.findOne(cur);
|
|
|
if (null == s) {
|
|
|
throw new StatusException("B-450110", "学生不存在");
|
|
|
}
|
|
@@ -231,7 +231,7 @@ public class StudentController extends ControllerSupport {
|
|
|
throw new StatusException("B-450111", "密码必须是6至18位字母或数字");
|
|
|
}
|
|
|
|
|
|
- Student s = studentRepo.findOne(accessUser.getStudentId());
|
|
|
+ StudentEntity s = studentRepo.findOne(accessUser.getStudentId());
|
|
|
|
|
|
if (StringUtils.isNotBlank(s.getPassword()) && !s.getPassword().equals(password)) {
|
|
|
throw new StatusException("B-450111", "当前密码错误");
|