Kaynağa Gözat

修复获取课程接口bug

宋悦 8 yıl önce
ebeveyn
işleme
33dd7ec816

+ 3 - 3
core-api/src/main/java/cn/com/qmth/examcloud/service/core/api/CourseApi.java

@@ -60,7 +60,7 @@ public class CourseApi {
     		AccessUser accessUser = (AccessUser) request.getAttribute("accessUser");
     		course.setOrgId(accessUser.getRootOrgId());
     	}
-    	return new ResponseEntity(courseService.findAlL(course,new PageRequest(curPage - 1,pageSize)), HttpStatus.OK);
+    	return new ResponseEntity(courseService.findAll(course,new PageRequest(curPage - 1,pageSize)), HttpStatus.OK);
     }
     
     @ApiOperation(value="查询课程不分页带查询",notes = "不分页带查询")
@@ -70,7 +70,7 @@ public class CourseApi {
     		AccessUser accessUser = (AccessUser) request.getAttribute("accessUser");
     		course.setOrgId(accessUser.getRootOrgId());
     	}
-        return new ResponseEntity(courseService.findAlL(course), HttpStatus.OK);
+        return new ResponseEntity(courseService.findAll(course), HttpStatus.OK);
     }
     
     @ApiOperation(value="按ID查询课程",notes="ID查询")
@@ -122,7 +122,7 @@ public class CourseApi {
     @GetMapping("/export")
     public void exportCourse(@ModelAttribute Course orgCriteria,HttpServletResponse response){
     	List<CourseDTO> list = new ArrayList<CourseDTO>();
-    	courseService.findAlL(orgCriteria).forEach(c -> {
+    	courseService.findAll(orgCriteria).forEach(c -> {
     		list.add(courseAssembler.toDTO(c));
         });
     	ExportUtils.exportEXCEL("课程列表", CourseDTO.class, list, response);

+ 6 - 5
core-api/src/main/java/cn/com/qmth/examcloud/service/core/service/CourseService.java

@@ -64,21 +64,22 @@ public class CourseService {
 		return null;
 	}
 	
-	public Page<Course> findAlL(Course orgCriteria, Pageable pageable) {
+	public Page<Course> findAll(Course orgCriteria, Pageable pageable) {
 		ExampleMatcher exampleMatcher = ExampleMatcher.matching()
 				.withMatcher("name", startsWith())
-				.withMatcher("code", startsWith());
+				.withMatcher("code", startsWith()).withIgnoreNullValues();
 		Example<Course> examExamStudentple = Example.of(orgCriteria,
 				exampleMatcher);
 		return courseRepo.findAll(examExamStudentple, pageable);
 	}
 
-	public List<Course> findAlL(Course orgCriteria) {
+	public List<Course> findAll(Course orgCriteria) {
 		ExampleMatcher exampleMatcher = ExampleMatcher.matching()
 				.withMatcher("name", startsWith())
-				.withMatcher("code", startsWith());
+				.withMatcher("code", startsWith()).withIgnoreNullValues();
         Example<Course> examExample = Example.of(orgCriteria,exampleMatcher);
-        return courseRepo.findAll(examExample);
+		List<Course> courseList = courseRepo.findAll(examExample);
+        return courseList;
 	}
 
 }