DocumentDTO document = searchParam.getDocument(); Page<DocumentDTO> page = new Page<>(searchParam.getPageQuery().getCurrent(), searchParam.getPageQuery().getSize()); QueryWrapper<DocumentDTO> queryWrapper = new QueryWrapper(); //字符串转数组再转List List<String> collectionTypeCodes = new ArrayList<String>(); List<String> collectionCodes = new ArrayList<String>(); if(StringUtils.isNotEmpty(document.getCode())){ collectionCodes = Arrays.asList(document.getCode().split(",")); } if(StringUtils.isNotEmpty(document.getTypeCode())){ collectionTypeCodes = Arrays.asList(document.getTypeCode().split(",")); } queryWrapper.in(collectionTypeCodes.size()>0,"type_code",collectionTypeCodes) .in(collectionCodes.size()>0,"code", collectionCodes) .eq(StringUtils.isNotEmpty(document.getTypeCodeParent()),"type_code_parent", document.getTypeCodeParent()) if(StringUtils.isNotEmpty(document.getName())){ queryWrapper.and(wrapper -> wrapper.like( "code", document.getName()) .or().like( "name", document.getName()) ); } return fileSearchMapper.searchDoc(page, queryWrapper);
记录,MybatisPlus实际使用
最新推荐文章于 2024-08-18 21:36:31 发布