| | |
| | | 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; |
| | |
| | | } |
| | | |
| | | @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)) |