From 2b8e00cb578da2495950e5e4bd8594034be935e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E9=B9=8F?= Date: Wed, 26 Feb 2025 14:56:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=81=E4=B8=9A=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../enterprise/EnterpriseController.java | 3 ++ .../admin/enterprise/vo/EnterpriseRespVO.java | 3 ++ .../service/taglibrary/TagLibraryService.java | 2 ++ .../taglibrary/TagLibraryServiceImpl.java | 28 +++++++++++++++++-- .../mapper/enterprise/EnterpriseMapper.xml | 3 ++ 5 files changed, 37 insertions(+), 2 deletions(-) diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/EnterpriseController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/EnterpriseController.java index 4d4e645..ca8f944 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/EnterpriseController.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/EnterpriseController.java @@ -144,9 +144,12 @@ public class EnterpriseController { } + // 获取标签 List tagLibraryDOS = tagLibraryService.listByEnterpriseId(enterprise.getId()); if (tagLibraryDOS != null) { + List tagLibraryDOS1 = tagLibraryService.listSetParentId(tagLibraryDOS); + enterprise.setTagObjList(tagLibraryDOS1); enterprise.setTagList(tagLibraryDOS.stream() .map(TagLibraryDO::getTagName) .collect(Collectors.toList())); diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterpriseRespVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterpriseRespVO.java index f0e8e7f..146fd3e 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterpriseRespVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterpriseRespVO.java @@ -111,6 +111,9 @@ public class EnterpriseRespVO { @Schema(description = "企业标签", example = "26433") private List tagList; + @Schema(description = "企业标签", example = "26433") + private List tagObjList; + @Schema(description = "邀请人") @ExcelProperty("邀请人") private String inviterName; diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taglibrary/TagLibraryService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taglibrary/TagLibraryService.java index 3fc2657..29aa413 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taglibrary/TagLibraryService.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taglibrary/TagLibraryService.java @@ -62,4 +62,6 @@ public interface TagLibraryService { //根据企业id标签查标签 List listByEnterpriseId(Long enterpriseId); + + List listSetParentId(List tagLibraryDOS); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taglibrary/TagLibraryServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taglibrary/TagLibraryServiceImpl.java index bd9f0b5..fcbfa94 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taglibrary/TagLibraryServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taglibrary/TagLibraryServiceImpl.java @@ -1,17 +1,16 @@ package cn.iocoder.yudao.module.system.service.taglibrary; +import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; import cn.iocoder.yudao.module.system.dal.dataobject.enterprisetag.EnterpriseTagDO; import cn.iocoder.yudao.module.system.dal.dataobject.tasktag.TaskTagDO; import cn.iocoder.yudao.module.system.dal.mysql.enterprisetag.EnterpriseTagMapper; import cn.iocoder.yudao.module.system.dal.mysql.tasktag.TaskTagMapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import org.apache.poi.ss.formula.functions.T; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; import cn.iocoder.yudao.module.system.controller.admin.taglibrary.vo.*; import cn.iocoder.yudao.module.system.dal.dataobject.taglibrary.TagLibraryDO; -import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.module.system.dal.mysql.taglibrary.TagLibraryMapper; @@ -20,6 +19,7 @@ import javax.annotation.Resource; import java.util.ArrayList; import java.util.List; +import java.util.Map; import java.util.stream.Collectors; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; @@ -142,6 +142,30 @@ public class TagLibraryServiceImpl implements TagLibraryService { return null; } + + @Override + public List listSetParentId(List tagLibraryDOS) { + List tagLibraryDOSAll = tagLibraryMapper.selectList(); + Map integerTagLibraryDOMap = CollectionUtils.convertMap(tagLibraryDOSAll, TagLibraryDO::getId); + + for (TagLibraryDO tagLibraryDO : tagLibraryDOS) { + TagLibraryDO topTag = findTopTag(integerTagLibraryDOMap, tagLibraryDO); + if (topTag != null) { + tagLibraryDO.setTagCode(topTag.getTagCode()); + } + } + return tagLibraryDOS; + + } + + public TagLibraryDO findTopTag(Map integerTagLibraryDOMap,TagLibraryDO tagLibraryDOBot) { + if(tagLibraryDOBot.getParentId() == 0) + return tagLibraryDOBot; + TagLibraryDO tagLibraryDO = integerTagLibraryDOMap.get(tagLibraryDOBot.getParentId()); + + return findTopTag(integerTagLibraryDOMap,tagLibraryDO); + } + // 递归构建树 private List buildTree(List tags, Integer parentId) { List tree = new ArrayList<>(); diff --git a/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/enterprise/EnterpriseMapper.xml b/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/enterprise/EnterpriseMapper.xml index 433e850..0071d79 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/enterprise/EnterpriseMapper.xml +++ b/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/enterprise/EnterpriseMapper.xml @@ -27,6 +27,9 @@ and department_id = #{params.departmentId} + + and enterprises_name like '%${params.enterprisesName}%' + and tl.id in