You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.5 KiB

<%@ page import="java.sql.*,oracle.jdbc.driver.OracleDriver"%>
<%@ page trimDirectiveWhitespaces="true" %>
<%
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","admin");
Statement stmt = conn.createStatement();
int index=request.getRequestURI().lastIndexOf('/');
String asset_id = request.getRequestURI().substring(index, request.getRequestURI().length());
asset_id = asset_id.replace("/", "");
//out.println("repair"+ asset_id);
String school_unique_id = request.getParameter("school_unique_id");
String asset_no = request.getParameter("asset_no");
String comp_date = request.getParameter("comp_date");
Integer count = 0;
String comp_id = "";
String remarks = "";
String sql = "select c.* from SCHOOL_ASSET sa JOIN school_dtl s on s.dep_id = sa.dept_id AND s.sec_id = sa.sec_id join comp_reg c on c.dept_id = sa.dept_id AND sa.sec_id = c.sect_id where sa.asset_id='"+asset_id+"' and sa.sec_id="+school_unique_id +" and asset_no='"+asset_no+"' and c.comp_date='"+comp_date+"'";
//out.println(sql);
ResultSet rs = stmt.executeQuery(sql);
while(rs.next()){
count = count + 1;
comp_id = rs.getString("comp_id");
remarks = rs.getString("remarks");
}
if( count == 0) {
%>{'reference_number': false, 'status': 'do not found'}<%
}else {
%>{'reference_number': <%=comp_id %>, 'status': 'Complaint found', 'Description': <%=remarks %>}<%
}
// Returns all employees (active and terminated) as json.
response.setContentType("application/json");
%>