{/n/'title/': /'Java 代码简化 - 优化查询结果并添加缺失项/',/n/'description/': /'本文介绍如何简化一段 Java 代码,优化查询结果并添加缺失项。代码使用 Spring Boot 和 MyBatis,包括对查询结果进行过滤、排序和添加缺失项的逻辑。/',/n/'keywords/': /'Java, 代码简化, 查询结果优化, 缺失项, Spring Boot, MyBatis/',/n/'content/': /'///'StringUtils.isNotBlank(proCode) && (proCode = proCode.split(/'-/')[0]);//nPage<Map<String, String>> page1 = new Page<>(page, size);//nString reldictId = examTreatMapper.queryValueId(dictId);//nIPage<Map<String, String>> iPage = examTreatMapper.queryItemClassDict(page1, queryString, dictValueId, reldictId, dictValueIdOfBigClass, proCode, cityCode);//nif (iPage != null && ListUtils.isNotBlank(iPage.getRecords())) {//n List list = iPage.getRecords().stream().map(o -> o.get(/'dictValueCode/')).collect(Collectors.toList());//n if (ListUtils.isNotBlank(list) && !list.contains(queryString) && StringUtils.isNotBlank(queryString)) {//n Map<String, String> map = new HashMap<>();//n map.put(/'dictValueCode/', queryString);//n map.put(/'dictValueName/', /'/');//n map.put(/'dictValueId/', queryString);//n map.put(/'sortId/', /'0/');//n iPage.getRecords().add(map);//n }//n iPage.getRecords().sort(Comparator.comparing((Map<String, String> i) -> i.get(/'sorted/')));//n}//nreturn ResultGenerator.genOkResult(iPage);/


原文地址: https://www.cveoy.top/t/topic/pFZt 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录