lyh
2026-03-12 e5bd30e774dba285e0e22bbfa5e4e0d936d88e6b
src/main/java/com/lxzn/nc/service/impl/DeviceGroupServiceImpl.java
@@ -14,6 +14,7 @@
import com.lxzn.nc.dao.DeviceGroupMapper;
import com.lxzn.nc.service.*;
import com.lxzn.ucenter.service.IDepartmentService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -128,6 +129,48 @@
    }
    @Override
    public List<String> findListParentTreeAll(String groupId) {
        if ( StringUtils.isEmpty(groupId)) {
            return null;
        }
        List<String> strings = new ArrayList<>();
        DeviceGroup en = super.getById(groupId);
        if (en == null) {
            return null;
        }
        strings.add(en.getGroupName());
        if (StringUtils.isEmpty(en.getParentId())) {
            return strings;
        } else {
            return findListParentTree(en.getParentId(),strings);
        }
    }
    @Override
    public List<String> findListParentTree(String parentId,List<String> stringList){
        if (StringUtils.isEmpty(parentId)) {
            return null;
        }
        if (stringList == null || stringList.isEmpty()) {
            stringList = new ArrayList<>();
        }
        boolean p = true;
        if (p) {
            DeviceGroup en = super.getById(parentId);
            if (en != null) {
                stringList.add(0,en.getGroupName());
            }
            if (StringUtils.isNotBlank(en.getParentId())) {
                parentId = en.getParentId();
                findListParentTree(parentId,stringList);
            } else {
                p = false;
                return stringList;
            }
        }
        return stringList;
    }
    @Override
    @Transactional(rollbackFor = {Exception.class})
    public boolean deleteDeviceGroup(String id) {
        if(!ValidateUtil.validateString(id))