| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.mapper.SqlRunner; |
| | | import com.fasterxml.jackson.core.type.TypeReference; |
| | | import com.ruili.wcp.common.CustomConfigUtil; |
| | | import com.ruili.wcp.common.JSONUtil; |
| | |
| | | import com.ruili.wcp.web.model.easyui.PagedAndFilteredInputDto; |
| | | import com.ruili.wcp.web.model.easyui.PagedSortedAndFilteredInputDto; |
| | | import com.zbooksoft.gdmis.config.ArchivesCustomConfig; |
| | | import com.zbooksoft.gdmis.data.entity.CatAjjxx; |
| | | import com.zbooksoft.gdmis.data.entity.CatCgwjxx; |
| | | import com.zbooksoft.gdmis.data.entity.CatSwajxx; |
| | | import com.zbooksoft.gdmis.data.entity.CatYswjxx; |
| | | import com.zbooksoft.gdmis.data.entity.*; |
| | | import com.zbooksoft.gdmis.service.CatAjjxxService; |
| | | import com.zbooksoft.gdmis.service.CatCgwjxxService; |
| | | import com.zbooksoft.gdmis.service.CatSwajxxService; |
| | |
| | | JdbcTemplate jdbcTemplate; |
| | | @Autowired |
| | | RestHighLevelClient restHighLevelClient; |
| | | |
| | | |
| | | private static final Logger logger = LoggerFactory.getLogger(SearchController.class); |
| | | |
| | |
| | | SearchSourceBuilder sourceBuilder = new SearchSourceBuilder(); |
| | | // 从全文内容和标题中检索关键字 |
| | | MultiMatchQueryBuilder matchQueryBuilder = QueryBuilders.multiMatchQuery(input.getSearchText(), "fullText", "WJM") |
| | | .minimumShouldMatch("50%").operator(Operator.AND); |
| | | .minimumShouldMatch("50%").operator(Operator.OR); |
| | | boolBuilder.must(matchQueryBuilder); |
| | | |
| | | if (filterMapStr != null && !filterMapStr.equals("")) { |
| | |
| | | } |
| | | } |
| | | } |
| | | List<Map<String, Object>> rows = jdbcTemplate.queryForList(selSql); |
| | | return rows; |
| | | |
| | | // 添加分页支持 |
| | | String countSql = "SELECT COUNT(*) FROM (" + selSql + ") tmp_count"; |
| | | Integer total = jdbcTemplate.queryForObject(countSql, Integer.class); |
| | | |
| | | // 添加分页查询 |
| | | String pageSql = selSql + " LIMIT " + (pageInput.getPage() - 1) * pageInput.getRows() + ", " + pageInput.getRows(); |
| | | List<Map<String, Object>> rows = jdbcTemplate.queryForList(pageSql); |
| | | |
| | | // 构造分页结果 |
| | | Map<String, Object> result = new HashMap<>(); |
| | | result.put("total", total); |
| | | result.put("rows", rows); |
| | | return result; |
| | | } catch (Exception e) { |
| | | logger.error(e.getMessage(), e); |
| | | return new AjaxResponse(new ErrorInfo(e.getMessage()), false); |
| | |
| | | @ResponseBody |
| | | @RequiresUser |
| | | public Object getSuperSearchData(@RequestParam String keywordMapStr, PagedSortedAndFilteredInputDto pageInput) { |
| | | |
| | | keywordMapStr = StringEscapeUtils.unescapeHtml4(keywordMapStr); |
| | | |
| | | try { |
| | | Page<CatAjjxx> page = new Page(pageInput.getPage(), pageInput.getRows()); |
| | | QueryWrapper<CatAjjxx> catAjjxxQueryWrapper = new QueryWrapper<>(); |
| | | catAjjxxQueryWrapper.eq("fbzt", "1"); |
| | | String selSql = "select * from view_all_utlization where 1=1"; |
| | | |
| | | if (keywordMapStr != null && !keywordMapStr.equals("")) { |
| | | Map<String, String> filterMap = JSONUtil.string2Obj(keywordMapStr, new TypeReference<Map<String, String>>() { |
| | | }); |
| | | for (Map.Entry<String, String> entry : filterMap.entrySet()) { |
| | | if ("startXCSJ".equals(entry.getKey()) && !"".equals(entry.getValue())) { |
| | | catAjjxxQueryWrapper.gt("XCSJ", entry.getValue()); |
| | | } else if ("endXCSJ".equals(entry.getKey()) && !"".equals(entry.getValue())) { |
| | | catAjjxxQueryWrapper.lt("XCSJ", entry.getValue()); |
| | | } else if (!"".equals(entry.getKey()) && !"".equals(entry.getValue())) { |
| | | catAjjxxQueryWrapper.like(entry.getKey(), entry.getValue()); |
| | | } |
| | | } |
| | | String customSql = getAdvancedConditionsSql(keywordMapStr, 1984044085226344449l); |
| | | selSql += " and" + customSql; |
| | | } |
| | | String customSql = getAdvancedConditionsSql(null, null); |
| | | IPage<CatAjjxx> logPage = catAjjxxService.page(page, catAjjxxQueryWrapper); |
| | | DataTableVO<CatAjjxx> dataTable = new DataTableVO(); |
| | | dataTable.setTotal(logPage.getTotal()); |
| | | dataTable.setRows(logPage.getRecords()); |
| | | // 添加分页支持 |
| | | String countSql = "SELECT COUNT(*) FROM (" + selSql + ") tmp_count"; |
| | | Integer total = jdbcTemplate.queryForObject(countSql, Integer.class); |
| | | |
| | | // 添加分页查询 |
| | | String pageSql = selSql + " LIMIT " + (pageInput.getPage() - 1) * pageInput.getRows() + ", " + pageInput.getRows(); |
| | | List<Map<String, Object>> rows = jdbcTemplate.queryForList(pageSql); |
| | | |
| | | return dataTable; |
| | | // 构造分页结果 |
| | | Map<String, Object> result = new HashMap<>(); |
| | | result.put("total", total); |
| | | result.put("rows", rows); |
| | | return result; |
| | | } catch (Exception e) { |
| | | logger.error(e.getMessage(), e); |
| | | return new AjaxResponse(new ErrorInfo(e.getMessage()), false); |