@RequestMapping(value = "/foreign_{kind}.html") public String QueryforList( @PathVariable("kind") String kind, HttpServletRequest request, Model model) { foreignServices = (ForeignServices) springContextUtil.getBean("ForeignServices"); PageMybatis page = foreignServices.QueryCount(""); page.setNowpage(Long.parseLong("1")); List<FiForeigner> list = foreignServices.QueryList(page); page.setPageurl(Untils.requestPath(request) + "kind=" + kind); model.addAttribute("foreign_list", list); model.addAttribute("page", page); if (kind.equals("edit")) { return "/foreign/foreign_edit"; } else if (kind.equals("inout")) { return "/foreign/foreign_inout"; } else if (kind.equals("ishere")) { return "/foreign/foreign_ishere"; } else if (kind.equals("extension")) { return "/foreign/foreign_extension"; } else if (kind.equals("query")) { return "/query/queryforeign"; } else if (kind.equals("foreigninoutquery")) { return "/query/queryforeigninout"; } else { return ""; } }
@RequestMapping(value = "/search_list.html") public String QueryList( @RequestParam("kind") String kind, HttpServletRequest request, HttpServletResponse response, Model model) { // @RequestMapping(value = "/AjaxQuery_list.html") // public String AjaxQueryList(HttpServletRequest request, // HttpServletResponse response) { List<FiForeigner> foreignlist = null; // var // url="name:"+name+" id:"+id+" contry:"+contry+" numb:"+numb+" post:"+post; String foreignname = Untils.NotNull(request.getParameter("foreign_name")) ? request.getParameter("foreign_name") : ""; String passport_id = Untils.NotNull(request.getParameter("passport_id_q")) ? request.getParameter("passport_id_q") : ""; String contry_from = Untils.NotNull(request.getParameter("contry_q")) ? request.getParameter("contry_q") : ""; String numb_invitation = Untils.NotNull(request.getParameter("invitation_numb")) ? request.getParameter("invitation_numb") : ""; String post = Untils.NotNull(request.getParameter("post_q")) ? request.getParameter("post_q") : ""; String is_here_ = Untils.NotNull(request.getParameter("is_here_")) ? request.getParameter("is_here_") : ""; String now_page = Untils.NotNull(request.getParameter("nowpage")) ? request.getParameter("nowpage") : ""; String page_size = Untils.NotNull(request.getParameter("pagesize")) ? request.getParameter("pagesize") : ""; String kinds = Untils.NotNull(kind) ? kind : ""; foreignServices = (ForeignServices) springContextUtil.getBean("ForeignServices"); String query_sql = foreignServices.getsql( foreignname, passport_id, contry_from, numb_invitation, post, is_here_); PageMybatis page = foreignServices.QueryCount(query_sql); if (Untils.NotNull(now_page) && now_page != "1") { page.setNowpage(Long.parseLong(now_page)); } else { page.setNowpage(Long.parseLong("1")); } if (Untils.NotNull(page_size) && now_page != "1") { page.setPagesize(Long.parseLong(page_size)); } if (Untils.NotNull(query_sql)) { page.setQuerysql(query_sql); } foreignlist = foreignServices.QueryList(page); model.addAttribute("foreign_list", foreignlist); page.setPageurl(Untils.requestPath(request)); model.addAttribute("page", page); if (kinds.equals("edit")) { return "/foreign/foreign_edit"; } else if (kinds.equals("inout")) { return "/foreign/foreign_inout"; } else if (kinds.equals("ishere")) { return "/foreign/foreign_ishere"; } else if (kinds.equals("extension")) { return "/foreign/foreign_extension"; } else if (kinds.equals("query")) { return "/query/queryforeign"; } else if (kinds.equals("foreigninoutquery")) { return "/query/queryforeigninout"; } else { return ""; } // List list = new ArrayList(); // if (foreignlist != null && foreignlist.size() > 0) { // for (FiForeigner forei : foreignlist) { // JSONObject object = new JSONObject(); // object.put("id", forei.getId()); // object.put("name", forei.getName()); // object.put("sex", forei.getSex()); // object.put("country", forei.getCountry()); // object.put("companydepartment", forei.getCompanyDepartment()); // object.put("passportid", forei.getPassportId()); // object.put("role", forei.getRole()); // object.put("isHere", forei.getIsHere()); // list.add(object); // } // } // response.setContentType("text/Xml;charset=utf-8"); // response.setHeader("Cache-Control", "no-cache"); // response.setHeader("pragma", "no-cache"); // response.setDateHeader("expires", 0); // PrintWriter out = null; // try { // out = response.getWriter(); // out.println(list); // // } catch (IOException ex1) { // ex1.printStackTrace(); // } finally { // out.close(); // } // return null; }