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

4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <%@ page import="java.sql.*,oracle.jdbc.driver.OracleDriver"%>
  2. <%@ page trimDirectiveWhitespaces="true" %>
  3. <%
  4. Class.forName("oracle.jdbc.driver.OracleDriver");
  5. Connection conn=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","admin");
  6. Statement stmt = conn.createStatement();
  7. int index=request.getRequestURI().lastIndexOf('/');
  8. String asset_id = request.getRequestURI().substring(index, request.getRequestURI().length());
  9. asset_id = asset_id.replace("/", "");
  10. //out.println("repair"+ asset_id);
  11. String school_unique_id = request.getParameter("school_unique_id");
  12. String asset_no = request.getParameter("asset_no");
  13. String comp_date = request.getParameter("comp_date");
  14. Integer count = 0;
  15. String comp_id = "";
  16. String remarks = "";
  17. 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+"'";
  18. //out.println(sql);
  19. ResultSet rs = stmt.executeQuery(sql);
  20. while(rs.next()){
  21. count = count + 1;
  22. comp_id = rs.getString("comp_id");
  23. remarks = rs.getString("remarks");
  24. }
  25. if( count == 0) {
  26. %>{'reference_number': false, 'status': 'do not found'}<%
  27. }else {
  28. %>{'reference_number': <%=comp_id %>, 'status': 'Complaint found', 'Description': <%=remarks %>}<%
  29. }
  30. // Returns all employees (active and terminated) as json.
  31. response.setContentType("application/json");
  32. %>