Explorar o código

标签显示问题调整
标签选择后展示列表数据问题

yfh hai 2 semanas
pai
achega
eaf0c3b647

+ 4 - 0
fs-company-app/src/main/java/com/fs/app/controller/FsUserController.java

@@ -119,6 +119,10 @@ public class FsUserController extends AppBaseController {
         param.setUserId(Long.parseLong(getUserId()));
         PageHelper.startPage(param.getPageNum(), param.getPageSize());
         List<CompanyUserTagListVO> tagList = companyTagUserService.getTagList(param);
+        CompanyUserTagListVO noTag = new CompanyUserTagListVO();
+        noTag.setTagId(0L);
+        noTag.setTagName("无标签");
+        tagList.add(0, noTag);
         PageInfo<CompanyUserTagListVO> pageInfo = new PageInfo<>(tagList);
         return ResponseResult.ok(pageInfo);
     }

+ 4 - 0
fs-service-system/src/main/java/com/fs/store/param/h5/FsUserPageListParam.java

@@ -73,6 +73,10 @@ public class FsUserPageListParam implements Serializable {
     private Long pcLoginUserId;
 
     private Boolean isAdmin;
+    /**
+     * 判断是否选择了无标签
+     */
+    private Boolean isNullTag =false;
 
 
 

+ 7 - 1
fs-service-system/src/main/java/com/fs/store/service/impl/FsUserServiceImpl.java

@@ -482,7 +482,13 @@ public class FsUserServiceImpl implements IFsUserService
         }
 
         PageHelper.startPage(param.getPageNum(), param.getPageSize());
-
+        if (param.getTagIds() != null && param.getTagIds().length > 0) {
+            boolean containsZero = Arrays.asList(param.getTagIds()).contains(0L);
+            // 如果包含 "0",则设置 isNullTag 为 true
+            if (containsZero) {
+                param.setIsNullTag(true);
+            }
+        }
         List<FsUserPageListVO> fsUserPageListVOS = fsUserMapper.selectFsUserPageList(param);
 
         // 获取当前销售所有重粉会员

+ 13 - 1
fs-service-system/src/main/resources/mapper/store/FsUserMapper.xml

@@ -563,7 +563,19 @@
         <if test="registerEndTime != null and registerEndTime !='' ">
             AND fs_user.create_time &lt;= #{registerEndTime}
         </if>
-        <if test="tagIds != null and tagIds.length > 0">
+
+        <if test="isNullTag">
+            and (company_tag_user.tag_ids is null
+            <if test="tagIds != null and tagIds.length > 0">
+                or
+                <foreach collection="tagIds" item="item" index="index" open="(" separator="or" close=")">
+                    CONCAT(',', company_tag_user.tag_ids, ',') LIKE CONCAT('%,', #{item}, ',%')
+                </foreach>
+            </if>
+            )
+        </if>
+
+        <if test="!isNullTag and tagIds != null and tagIds.length > 0">
             AND
             <foreach collection="tagIds" item="item" index="index" open="(" separator="or" close=")">
                 CONCAT(',', company_tag_user.tag_ids, ',') LIKE CONCAT('%,', #{item}, ',%')