|
|
@@ -69,16 +69,16 @@ public class StudentRepositoryTest {
|
|
|
//根据id列表查询多个对象
|
|
|
Iterable<Student> itStu = studentRepository.findAllById(Arrays.asList(new String[]{"001", "002"}));
|
|
|
Iterator<Student> itor = itStu.iterator();
|
|
|
- while (itor.hasNext())
|
|
|
- System.out.println(itor.next());
|
|
|
+// while (itor.hasNext())
|
|
|
+// System.out.println(itor.next());
|
|
|
|
|
|
//查询所有
|
|
|
List<Student> all = studentRepository.findAll();
|
|
|
|
|
|
//查询所有并排序
|
|
|
List<Student> all1 = studentRepository.findAll(Sort.by(Sort.Order.desc("studentId"), Sort.Order.asc("studentName")));
|
|
|
- for (Student stu : all1)
|
|
|
- System.out.println(stu);
|
|
|
+// for (Student stu : all1)
|
|
|
+// System.out.println(stu);
|
|
|
|
|
|
System.out.println("0------------------:"+all1.size());
|
|
|
|
|
|
@@ -86,8 +86,8 @@ public class StudentRepositoryTest {
|
|
|
Student student1 = new Student();
|
|
|
student1.setStudentName("tom");
|
|
|
List<Student> all2 = studentRepository.findAll(Example.of(student1), Sort.by(Sort.Order.desc("studentId"), Sort.Order.asc("studentName")));
|
|
|
- for (Student stu : all2)
|
|
|
- System.out.println(stu);
|
|
|
+// for (Student stu : all2)
|
|
|
+// System.out.println(stu);
|
|
|
|
|
|
|
|
|
|
|
|
@@ -95,8 +95,8 @@ public class StudentRepositoryTest {
|
|
|
Pageable pageable = PageRequest.of(0, 2);
|
|
|
Page<Student> all3 = studentRepository.findAll(pageable);
|
|
|
List<Student> content = all3.getContent();
|
|
|
- for (Student stu : content)
|
|
|
- System.out.println(stu);
|
|
|
+// for (Student stu : content)
|
|
|
+// System.out.println(stu);
|
|
|
|
|
|
System.out.println("1------------------:"+content.size());
|
|
|
Long enttime = System.currentTimeMillis();
|