#
Junjie
2023-12-21 24d684de6602ce1b142e5be01d9e5b357df32799
zy-asrs-common/src/main/java/com/zy/asrs/common/utils/TreeUtils.java
@@ -1,8 +1,8 @@
package com.zy.asrs.common.utils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zy.asrs.common.wms.entity.ManTag;
import com.zy.asrs.common.wms.service.ManTagService;
import com.zy.asrs.common.wms.entity.Tag;
import com.zy.asrs.common.wms.service.TagService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Component;
@@ -17,7 +17,7 @@
public class TreeUtils {
    @Autowired
    private ManTagService tagService;
    private TagService tagService;
    /******************************** 归类树 *********************************/
@@ -27,7 +27,7 @@
    @Cacheable(cacheNames="tagTree",key="#id")
    public ArrayList<Map> getTree(String id){
        ArrayList<Map> result = new ArrayList<>();
        ManTag tag = tagService.getById(id);
        Tag tag = tagService.getById(id);
        // 主节点
        Map<String, Object> map = new HashMap<>();
        map.put("title", tag.getName());
@@ -45,12 +45,12 @@
    /**
     * 递归获取子节点数据
     */
    public void dealTag(ManTag parent, List<Map> list) {
        List<ManTag> tags = tagService.list(
                new LambdaQueryWrapper<ManTag>()
                        .eq(ManTag::getParentId, parent.getId())
                        .eq(ManTag::getStatus, "1"));
        for (ManTag tag : tags) {
    public void dealTag(Tag parent, List<Map> list) {
        List<Tag> tags = tagService.list(
                new LambdaQueryWrapper<Tag>()
                        .eq(Tag::getParentId, parent.getId())
                        .eq(Tag::getStatus, "1"));
        for (Tag tag : tags) {
            Map<String, Object> map = new HashMap<>();
            map.put("title", tag.getName());
            map.put("id", tag.getId());