Merge remote-tracking branch 'remotes/origin/master' into zgl

zgl
zgl 6 years ago
commit 0cdb2e654c

@ -0,0 +1,16 @@
<component name="ArtifactManager">
<artifact type="exploded-war" name="gdms:Web exploded">
<output-path>$PROJECT_DIR$/out/artifacts/gdms_Web_exploded</output-path>
<root id="root">
<element id="javaee-facet-resources" facet="gdms/web/Web" />
<element id="directory" name="WEB-INF">
<element id="directory" name="classes">
<element id="module-output" name="gdms" />
</element>
<element id="directory" name="lib">
<element id="file-copy" path="C:/Program Files/Apache Software Foundation/Tomcat 9.0/lib/tomcat-jdbc.jar" />
</element>
</element>
</root>
</artifact>
</component>

@ -36,6 +36,25 @@ public class C_StudentSearchTeacher extends TempProcess{
TeacherInfo.put("phone_number",s[4]); TeacherInfo.put("phone_number",s[4]);
return TeacherInfo; return TeacherInfo;
} }
public List<Map<String,String>> _search() throws Exception{
if(!check()) throw new GExcptInit("teacherId Attrs init error!");
Search search = new Search() ;
search.setOptions(new HashMap<>());
search.addOptions("table",table);
List<String> fields = new ArrayList<>();
fields.add("*");
search.addOptions("field",fields);
Map<String,String> limits = new HashMap<>();
limits.put("id",this.getTeacherID());
search.addOptions("limits",limits);
search.addOptions("start",0);
search.addOptions("end",10);
Map<String, Object> options = search.execute(null);
List<String[]> result = (List<String[]>) options.get("result");
List<Map<String,String>> teachersInfo = new ArrayList<>();
core.process.Utils.formatResult(result, teachersInfo);
return teachersInfo;
}
protected boolean check() { protected boolean check() {
if(this.getTeacherID()==null) if(this.getTeacherID()==null)

@ -1,5 +1,6 @@
package core.process; package core.process;
import core.operation.Search;
import core.operation.Select; import core.operation.Select;
import error.GExcptInit; import error.GExcptInit;
@ -22,6 +23,24 @@ public class C_StudentSelectTeacher extends TempProcess {
select.addOptions("teacher_id",this.getTeacherId()); select.addOptions("teacher_id",this.getTeacherId());
Map<String,Object> options=select.execute(null); Map<String,Object> options=select.execute(null);
} }
public List<Map<String,String>> search(String teacherId) throws Exception{
Search search = new Search() ;
search.setOptions(new HashMap<>());
search.addOptions("table","teacher");
List<String> fields = new ArrayList<>();
fields.add("*");
search.addOptions("field",fields);
Map<String,String> limits = new HashMap<>();
limits.put("id",teacherId);
search.addOptions("limits",limits);
search.addOptions("start",0);
search.addOptions("end",10);
Map<String, Object> options = search.execute(null);
List<String[]> result = (List<String[]>) options.get("result");
List<Map<String,String>> teachersInfo = new ArrayList<>();
core.process.Utils.formatResult(result, teachersInfo);
return teachersInfo;
}
protected boolean check() { protected boolean check() {
if(this.getStudentId()==null||this.getTeacherId()==null) if(this.getStudentId()==null||this.getTeacherId()==null)
return false; return false;

@ -48,18 +48,11 @@ public class C_TeacherSearchStudent extends TempProcess {
limits.put("id",this.getStudentId()); limits.put("id",this.getStudentId());
search.addOptions("limits",limits); search.addOptions("limits",limits);
search.addOptions("start",0); search.addOptions("start",0);
search.addOptions("end",1); search.addOptions("end",10);
Map<String, Object> options = search.execute(null); Map<String, Object> options = search.execute(null);
List<String[]> result = (List<String[]>) options.get("result"); List<String[]> result = (List<String[]>) options.get("result");
List<Map<String,String>> studentsInfo = new ArrayList<>(); List<Map<String,String>> studentsInfo = new ArrayList<>();
for(String[] s:result){ core.process.Utils.formatResult(result, studentsInfo);
Map<String,String> 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; return studentsInfo;
} }
protected boolean check() { protected boolean check() {

@ -1,5 +1,6 @@
package core.process; package core.process;
import core.operation.Search;
import core.operation.Select; import core.operation.Select;
import error.GExcptInit; import error.GExcptInit;
@ -22,6 +23,24 @@ public class C_TeacherSelectStudent extends TempProcess {
select.addOptions("student_id",this.getStudentId()); select.addOptions("student_id",this.getStudentId());
Map<String,Object> options=select.execute(null); Map<String,Object> options=select.execute(null);
} }
public List<Map<String,String>> search(String studentId) throws Exception{
Search search = new Search() ;
search.setOptions(new HashMap<>());
search.addOptions("table","student");
List<String> fields = new ArrayList<>();
fields.add("*");
search.addOptions("field",fields);
Map<String,String> limits = new HashMap<>();
limits.put("id",studentId);
search.addOptions("limits",limits);
search.addOptions("start",0);
search.addOptions("end",10);
Map<String, Object> options = search.execute(null);
List<String[]> result = (List<String[]>) options.get("result");
List<Map<String,String>> studentsInfo = new ArrayList<>();
core.process.Utils.formatResult(result, studentsInfo);
return studentsInfo;
}
protected boolean check() { protected boolean check() {
if(this.getStudentId()==null||this.getTeacherId()==null) if(this.getStudentId()==null||this.getTeacherId()==null)
return false; return false;

@ -3,7 +3,7 @@ package core.process;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
public class Condition {//条件 public class Condition {
public List<Process> getProcesses() { public List<Process> getProcesses() {
return processes; return processes;
} }

@ -0,0 +1,18 @@
package core.process;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public interface Utils {
static void formatResult(List<String[]> result, List<Map<String, String>> studentsInfo) {
for(String[] s:result){
Map<String,String> 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);
}
}
}

@ -6,7 +6,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
@WebFilter(filterName = "OnlineCheck",urlPatterns = "/home.jsp") @WebFilter(filterName = "OnlineCheck",urlPatterns = "/home*")
public class OnlineCheck implements Filter { public class OnlineCheck implements Filter {
public void destroy() { public void destroy() {
} }

@ -2,7 +2,7 @@ package gdms;
public interface Configuration { public interface Configuration {
//file //file
String filePath = "/"; String filePath = "C:/Users/zhai_/Desktop/";
//database //database
String dbUrl="jdbc:mariadb://localhost:3306/gdms"; String dbUrl="jdbc:mariadb://localhost:3306/gdms";
String dbUsername="gdms"; String dbUsername="gdms";

@ -26,4 +26,5 @@ public class S_StudentSelectTeacher extends HttpServlet {
response.sendRedirect("/op_fail.jsp"); response.sendRedirect("/op_fail.jsp");
} }
} }
} }

@ -13,17 +13,14 @@ import java.io.IOException;
public class S_StudentUploadFinishedProduct extends HttpServlet { public class S_StudentUploadFinishedProduct extends HttpServlet {
static String fileType = "graduation_design_finished_product"; static String fileType = "graduation_design_finished_product";
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String id = "000"; String id = request.getParameter("id");
//String files = request.getParameter("file"); String fileURL;
System.out.print("123");
System.out.print( request.getPart("file"));
System.out.print("123");
try { try {
String fileURL = servlet.Utils.saveFile(request, fileType); fileURL = servlet.Utils.saveFile(request, fileType);
}catch (Exception e) }catch (Exception e)
{ {
System.out.print(e); System.out.print(e);
response.sendRedirect("/op_fail.jsp");
} }
System.out.print("222");
} }
} }

@ -36,7 +36,7 @@
String type=user.getType(); String type=user.getType();
pageContext.setAttribute("userType",type); pageContext.setAttribute("userType",type);
Condition condition=user.getCondition(); Condition condition=user.getCondition();
//List<Process> pList=condition.getProcesses(); /*List<Process> pList=condition.getProcesses();*/
int length=0; int length=0;
int index=0; int index=0;
%> %>

@ -7,19 +7,17 @@
--%> --%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %> <%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%String a=request.getParameter("id"); <%
String b[][]=new String[3][3]; String id=request.getParameter("id");
for(int i=0;i<3;i++) String searchType=request.getParameter("searchType");
for(int j=0;j<3;j++)
b[i][j]="hello";
%> %>
<%%> <%%>
<div class="list-child"> <div class="list-child">
<div class="name"><span class="the-name"><%=a%></span></div> <div class="name"><span class="the-name"><%=searchType%></span></div>
<div class="other-msgs"> <div class="other-msgs">
<%for(int k=0;k<2;k++) <%for(int k=0;k<2;k++)
for (int n=0;n<2;n++) for (int n=0;n<2;n++)
out.print(" <div class=\"one-msg\">电话号码:"+b[k][n]+"</div>"); out.print(" <div class=\"one-msg\">电话号码:"+k+n+"</div>");
%> %>
<div class="one-msg">电话号码18711191679</div> <div class="one-msg">电话号码18711191679</div>
</div> </div>

@ -54,7 +54,7 @@
</div> </div>
<div class="search-frame"> <div class="search-frame">
<input class="search-input" type="text" name="id" value="" placeholder="输入学号查找"> <input class="search-input" type="text" name="id" value="" placeholder="输入学号查找">
<div class="search-button"></div> <div class="search-button ${type}"></div>
</div> </div>
</div> </div>
<div class="count-select"> <div class="count-select">

@ -1,10 +1,12 @@
$(document).ready(function () { $(document).ready(function () {
$(document).off('click',searchmsg).on('click','.search-button',searchmsg); $(document).off('click',searchStuMsg).on('click','.search-button.teacher',searchStuMsg);
$(document).off('keydown',searchmsg).on('keydown','.search-input',KDsearchmsg); $(document).off('click',searchTeaMsg).on('click','.search-button.student',searchTeaMsg);
$(document).off('keydown',KDsearchSmsg).on('keydown','.search-button.teacher',KDsearchSmsg);
$(document).off('keydown',KDsearchTmsg).on('keydown','.search-button.student',KDsearchTmsg);
$(document).off('click',teacherSelect).on('click','.select-it.teacher',teacherSelect); $(document).off('click',teacherSelect).on('click','.select-it.teacher',teacherSelect);
$(document).off('click',studentSelect).on('click','.select-it.student',studentSelect); $(document).off('click',studentSelect).on('click','.select-it.student',studentSelect);
}) })
function searchmsg(e) { function searchStuMsg(e) {
if($('.search-input').val()=='') if($('.search-input').val()=='')
{ {
e.preventDefault(); e.preventDefault();
@ -12,15 +14,36 @@ function searchmsg(e) {
} }
else { else {
var id=$('.search-input').val(); var id=$('.search-input').val();
var rqDate={"id":id}; var searchType='teacher';
var rqDate={"id":id,"searchType":searchType};
var Url1='result_list.jsp'; var Url1='result_list.jsp';
$('.list-frame').load(Url1,rqDate); $('.list-frame').load(Url1,rqDate);
} }
} }
function KDsearchmsg(e) { function searchTeaMsg(e) {
if($('.search-input').val()=='')
{
e.preventDefault();
alert('请输入学号');
}
else {
var id=$('.search-input').val();
var searchType='student';
var rqDate={"id":id,"searchType":searchType};
var Url1='result_list.jsp';
$('.list-frame').load(Url1,rqDate);
}
}
function KDsearchSmsg(e) {
if(e.keyCode==13)
{
searchStuMsg(e);
}
}
function KDsearchTmsg(e) {
if(e.keyCode==13) if(e.keyCode==13)
{ {
searchmsg(e); searchTeaMsg(e);
} }
} }
function select_one(Url2,button) { function select_one(Url2,button) {

@ -5,7 +5,7 @@ $(document).ready(function () {
}) })
function sendFile() { function sendFile() {
var fileData =new FormData(); var fileData =new FormData();
var Url4='student-upload-finished-product'; var Url4='/student-upload-finished-product';
var file=$('#select')[0].files[0]; var file=$('#select')[0].files[0];
if($('.true-select').val()=='') if($('.true-select').val()=='')
{ {

Loading…
Cancel
Save