Browse Source

。。。

wangwei 6 years ago
parent
commit
7623c374f9

+ 9 - 9
examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/StudentController.java

@@ -32,8 +32,8 @@ import cn.com.qmth.examcloud.core.basic.base.constants.BasicConsts;
 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.entity.StudentEntity;
+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.impl.StudentServiceImpl;
 import io.swagger.annotations.ApiOperation;
 
 /**
@@ -48,7 +48,7 @@ public class StudentController extends ControllerSupport {
 	StudentRepo studentRepo;
 
 	@Autowired
-	StudentServiceImpl studentService;
+	StudentService studentService;
 
 	@Autowired
 	UserRepo userRepo;
@@ -65,8 +65,8 @@ public class StudentController extends ControllerSupport {
 	 * @return
 	 */
 	@ApiOperation(value = "查询所有学生", notes = "分页")
-	@GetMapping("/{curPage}/{pageSize}")
-	public Page<StudentEntity> getAllStudent(@RequestParam String name,
+	@GetMapping("studentPage/{curPage}/{pageSize}")
+	public Page<StudentEntity> getStudentPage(@RequestParam String name,
 			@RequestParam String studentCode, @RequestParam String identityNumber,
 			@PathVariable Integer curPage, @PathVariable Integer pageSize) {
 		User accessUser = getAccessUser();
@@ -103,7 +103,7 @@ public class StudentController extends ControllerSupport {
 	 * @return
 	 */
 	@ApiOperation(value = "按ID查询学生", notes = "ID查询")
-	@GetMapping("/{id}")
+	@GetMapping("{id}")
 	public StudentEntity getStudentById(@PathVariable Long id) {
 		StudentEntity s = studentRepo.findOne(id);
 		return s;
@@ -117,7 +117,7 @@ public class StudentController extends ControllerSupport {
 	 * @return
 	 */
 	@ApiOperation(value = "按ID删除学生", notes = "删除")
-	@DeleteMapping("/{id}")
+	@DeleteMapping("{id}")
 	public Long deleteStudent(@PathVariable Long id) {
 		studentRepo.delete(id);
 		return id;
@@ -131,7 +131,7 @@ public class StudentController extends ControllerSupport {
 	 * @return
 	 */
 	@ApiOperation(value = "启用学生")
-	@PutMapping("/enable/{ids}")
+	@PutMapping("enable/{ids}")
 	public List<String> enableStudent(@PathVariable String ids) {
 		List<Long> studentIds = Stream.of(ids.split(",")).map(s -> Long.parseLong(s.trim()))
 				.collect(Collectors.toList());
@@ -153,7 +153,7 @@ public class StudentController extends ControllerSupport {
 	 * @return
 	 */
 	@ApiOperation(value = "禁用学生")
-	@PutMapping("/disable/{ids}")
+	@PutMapping("disable/{ids}")
 	public List<String> disableStudent(@PathVariable String ids) {
 		List<Long> studentIds = Stream.of(ids.split(",")).map(s -> Long.parseLong(s.trim()))
 				.collect(Collectors.toList());
@@ -168,7 +168,7 @@ public class StudentController extends ControllerSupport {
 	}
 
 	@ApiOperation(value = "重置用户密码", notes = "重置密码")
-	@PutMapping("/resetPass/{ids}")
+	@PutMapping("resetPass/{ids}")
 	public void resetPassword(@PathVariable String ids) {
 		List<Long> studentIds = Stream.of(ids.split(",")).map(s -> Long.parseLong(s.trim()))
 				.collect(Collectors.toList());

+ 0 - 35
examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/impl/StudentServiceImpl.java

@@ -1,17 +1,9 @@
 package cn.com.qmth.examcloud.core.basic.service.impl;
 
-import static org.springframework.data.domain.ExampleMatcher.GenericPropertyMatchers.contains;
-
-import java.util.List;
-
 import javax.transaction.Transactional;
 
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.Example;
-import org.springframework.data.domain.ExampleMatcher;
-import org.springframework.data.domain.Page;
-import org.springframework.data.domain.Pageable;
 import org.springframework.stereotype.Service;
 
 import cn.com.qmth.examcloud.commons.base.exception.StatusException;
@@ -48,33 +40,6 @@ public class StudentServiceImpl implements StudentService {
 	@Autowired
 	OrgServiceImpl orgService;
 
-	/**
-	 * 获取所有学生(分页)
-	 *
-	 * @param studentCriteria
-	 * @param pageable
-	 * @return
-	 */
-	public Page<StudentEntity> getAllStudent(StudentEntity studentCriteria, Pageable pageable) {
-		ExampleMatcher exampleMatcher = ExampleMatcher.matching().withMatcher("name", contains())
-				.withMatcher("studentCode", contains()).withMatcher("identityNumber", contains())
-				.withIgnoreNullValues();
-		Example<StudentEntity> studentExample = Example.of(studentCriteria, exampleMatcher);
-		return studentRepo.findAll(studentExample, pageable);
-	}
-
-	/**
-	 * 获取所有学生
-	 *
-	 * @param studentCriteria
-	 * @return
-	 */
-	public List<StudentEntity> getAllStudent(StudentEntity studentCriteria) {
-		ExampleMatcher exampleMatcher = ExampleMatcher.matching();
-		Example<StudentEntity> studentExample = Example.of(studentCriteria, exampleMatcher);
-		return studentRepo.findAll(studentExample);
-	}
-
 	/*
 	 * 实现
 	 *