Browse Source

作者:张哲
时间:2023/03/07
类型:优化
描述:里程碑(2)处理专辑分类模糊查询失效问题

ZizgZh 2 years ago
parent
commit
26e777290b

+ 5 - 4
src/main/java/com/redxun/knowledge/album/service/AlbumCategoryServiceImpl.java

@@ -85,19 +85,20 @@ public class AlbumCategoryServiceImpl extends SuperServiceImpl<AlbumCategoryMapp
         if (param.containsKey("name")){
             //一级分类信息
             List<AlbumCategoryVo> allAlbumCategory1 = albumCategoryMapper.findAllAlbumCategory1(queryFilter.getParams(), params);
-            if (CollectionUtils.isEmpty(allAlbumCategory1)){
-                return page;
-            }
             List<String> childIdList = findChild(allAlbumCategory1, true);
             //查询符合条件的二级分类
             List<AlbumCategoryVo> allAlbumCategory2 = albumCategoryMapper.findAllAlbumCategory2(queryFilter.getParams(), params);
             if (CollectionUtils.isNotEmpty(allAlbumCategory2)){
                 allAlbumCategory2.forEach(albumCategoryVo2 -> {
-                    if (CollectionUtils.isNotEmpty(childIdList) && !childIdList.contains(albumCategoryVo2.getPkId())){
+                    if (!childIdList.contains(albumCategoryVo2.getPkId())){
+                        albumCategoryVo2.setOperator(userService.queryUser(albumCategoryVo2.getUpdateBy()).getFullName());
                         allAlbumCategory1.add(albumCategoryVo2);
                     }
                 });
             }
+            if (CollectionUtils.isEmpty(allAlbumCategory1)){
+                return page;
+            }
             return PageListUtils.getPages(queryFilter.getPage().getCurrent(), queryFilter.getPage().getSize(),allAlbumCategory1);
         } else {
             //查询一级分类下的二级分类

+ 1 - 1
src/main/resources/mapper/knowledge/album/AlbumCategoryMapper.xml

@@ -82,7 +82,7 @@
             <if test="@rx.Ognl@isNotEmpty(params.name)">
                 and instr(NAME,#{params.name}) > 0
             </if>
-            and IS_DEL = 0 and PARENT != '0'
+            and IS_DEL = 0 and PARENT != '0' and GRADE = 2
         </where>
         ORDER BY SORT
     </select>