JAVA-报表模糊搜索简易实现

public JSONObject getReportList(String env, Map<String, Object> request){ string[]keyWords = request. containskey("keyword") ? request.get("keyWord"). tostring().split(" +") : null; // 支持空格符分隔关键字 List<Map<string,Object>> list = 分页后表搜索结果 List<Map<String,Object>>listcount=不分页下的搜索总数 if (keywords != null && keybords.length >θ){ int preCount = request.containskey("count") ? Integer .parseInt(request.get("count").toString()) : 0; // List<Map<String,object>> list2 = null; for (String keyWord : keywords){ System.out,print1n("keyWord = " + keyWord); list = 1ist.stream().fi1ter(s -> s.tostring().contains(keyword)) .collect(Collectors.toList()); } System.out.println("list2 =- + list); int count2 = list.size()+ preCount; System.out.println("count2=" + count2);//不足一页就补数 if (count2<pageSize 8& currentPage * pageSize < count){ request.put("currentPage",currentPage + 1); JSONObject addList = getReportList(env,request); if (addlist != nul1){ list.addAll((Collection<?extends Map<String,Object>>) addList.get("item")); } request.put("list",list); } jsonObject.put("iten", 1ist); jsonObject.put("total", count2); }else { jsonObject,put("iten",list); jsonObject,put("total", count); } return json0bject; }
上一篇:manim边学边做--Matrix


下一篇:Python(集合)