diff --git a/src/core/process/C_TeacherSearchStudent.java b/src/core/process/C_TeacherSearchStudent.java index 4c1be5d..c915c93 100644 --- a/src/core/process/C_TeacherSearchStudent.java +++ b/src/core/process/C_TeacherSearchStudent.java @@ -13,9 +13,9 @@ public class C_TeacherSearchStudent extends TempProcess { static String table="student"; - Map StudentInfo=new HashMap(); public Map search() throws Exception{ if(!check()) throw new GExcptInit("studentId Attrs init error!"); + Map studentInfo =new HashMap<>(); Search search = new Search() ; search.setOptions(new HashMap<>()); search.addOptions("table",table); @@ -30,11 +30,37 @@ public class C_TeacherSearchStudent extends TempProcess { Map options = search.execute(null); List result = (List) options.get("result"); String[] s = result.get(0); - StudentInfo.put("id",s[0]); - StudentInfo.put("name",s[2]); - StudentInfo.put("e_mail_location",s[3]); - StudentInfo.put("phone_number",s[4]); - return StudentInfo; + studentInfo.put("id",s[0]); + studentInfo.put("name",s[2]); + studentInfo.put("e_mail_location",s[3]); + studentInfo.put("phone_number",s[4]); + return studentInfo; + } + public List> _search() throws Exception{ + if(!check()) throw new GExcptInit("studentId Attrs init error!"); + Search search = new Search() ; + search.setOptions(new HashMap<>()); + search.addOptions("table",table); + List fields = new ArrayList<>(); + fields.add("*"); + search.addOptions("field",fields); + Map limits = new HashMap<>(); + limits.put("id",this.getStudentId()); + search.addOptions("limits",limits); + search.addOptions("start",0); + search.addOptions("end",1); + Map options = search.execute(null); + List result = (List) options.get("result"); + List> studentsInfo = new ArrayList<>(); + for(String[] s:result){ + Map studentInfo = new HashMap<>(); + studentInfo.put("id",s[0]); + studentInfo.put("name",s[2]); + studentInfo.put("e_mail_location",s[3]); + studentInfo.put("phone_number",s[4]); + studentsInfo.add(studentInfo); + } + return studentsInfo; } protected boolean check() { if(this.getStudentId()==null)