diff --git a/src/core/process/C_StudentSearchTeacher.java b/src/core/process/C_StudentSearchTeacher.java index 2bb3080..65931e4 100644 --- a/src/core/process/C_StudentSearchTeacher.java +++ b/src/core/process/C_StudentSearchTeacher.java @@ -1,24 +1,29 @@ package core.process; import core.operation.Search; +import error.GExcptInit; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -public class C_StudentSearchTeacher { +public class C_StudentSearchTeacher extends TempProcess{ + String teacherID; + + static String table = "teacher"; + Map TeacherInfo=new HashMap(); - public Map search(String teacherID) throws Exception { + public Map search() throws Exception { + if(!check()) throw new GExcptInit("teacherID Attrs init error!"); Search search = new Search() ; search.setOptions(new HashMap<>()); - String table = "teacher"; search.addOptions("table",table); List fields = new ArrayList<>(); fields.add("*"); search.addOptions("field",fields); Map limits = new HashMap<>(); - limits.put("id",teacherID); + limits.put("id",this.getTeacherID()); search.addOptions("limits",limits); search.addOptions("start",0); search.addOptions("end",1); @@ -27,6 +32,20 @@ public class C_StudentSearchTeacher { String[] s = result.get(0); TeacherInfo.put("id",s[0]); TeacherInfo.put("name",s[2]); + TeacherInfo.put("e_mail_location",s[3]); + TeacherInfo.put("phone_number",s[4]); return TeacherInfo; } + + protected boolean check() { + if(this.getTeacherID()==null) + return false; + return true; + } + public String getTeacherID(){ + return teacherID; + } + public void setTeacherID(String teacherID){ + this.teacherID=teacherID; + } } diff --git a/src/core/process/C_TeacherSearchStudent.java b/src/core/process/C_TeacherSearchStudent.java index 8fe27b0..4c1be5d 100644 --- a/src/core/process/C_TeacherSearchStudent.java +++ b/src/core/process/C_TeacherSearchStudent.java @@ -1,24 +1,29 @@ package core.process; import core.operation.Search; +import error.GExcptInit; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -public class C_TeacherSearchStudent { - Map StudentInfo=new HashMap(); - public Map search(String studentID) throws Exception{ +public class C_TeacherSearchStudent extends TempProcess { + String studentId; + + static String table="student"; + + Map StudentInfo=new HashMap(); + public Map search() throws Exception{ + if(!check()) throw new GExcptInit("studentId Attrs init error!"); Search search = new Search() ; search.setOptions(new HashMap<>()); - String table = "student"; search.addOptions("table",table); List fields = new ArrayList<>(); fields.add("*"); search.addOptions("field",fields); Map limits = new HashMap<>(); - limits.put("id",studentID); + limits.put("id",this.getStudentId()); search.addOptions("limits",limits); search.addOptions("start",0); search.addOptions("end",1); @@ -27,6 +32,20 @@ public class C_TeacherSearchStudent { 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; } + protected boolean check() { + if(this.getStudentId()==null) + return false; + return true; + } + public String getStudentId(){ + return studentId; + } + public void setStudentId(String studentId){ + this.studentId=studentId; + } + } diff --git a/src/core/process/Process.java b/src/core/process/Process.java index a79f94f..40d1081 100644 --- a/src/core/process/Process.java +++ b/src/core/process/Process.java @@ -11,6 +11,7 @@ public abstract class Process{ private String buttonName; private String info; + protected abstract boolean check(); public String getPermission() { return permission; } diff --git a/web/select.jsp b/web/select.jsp index 7f60717..238b1ed 100644 --- a/web/select.jsp +++ b/web/select.jsp @@ -28,7 +28,7 @@
-
c +
李先生