Merge remote-tracking branch 'origin/master'

# Conflicts:
#	ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwDeviceModeFunctionMapper.java
dev
Wen JY 1 year ago
commit b4b02d9763

@ -52,7 +52,9 @@ public class HwMonitorPlatformController extends BaseController {
* @throws
* */
@GetMapping("/treeList")
public TableDataInfo treeList(@RequestBody List<HwMonitorUnit> hwMonitorUnits){
public TableDataInfo treeList(){
HwMonitorUnit hwMonitorUnit = new HwMonitorUnit();
List<HwMonitorUnit> hwMonitorUnits = hwMonitorUnitService.selectHwMonitorUnitList(hwMonitorUnit);
List<HwMonitorUnit> list = hwMonitorUnitService.selectTreeList(hwMonitorUnits);
return getDataTable(list);

@ -12,7 +12,7 @@ import com.ruoyi.business.domain.HwDeviceModeFunction;
public interface HwDeviceModeFunctionMapper
{
/**
*
*
*
* @param modeFunctionId
* @return

@ -280,14 +280,18 @@ public class HwMonitorUnitServiceImpl implements IHwMonitorUnitService
public List<HwMonitorUnit> selectTreeList(List<HwMonitorUnit> hwMonitorUnits) {
List<HwMonitorUnit> returnList = new ArrayList<>();
List<Long> tempList = hwMonitorUnits.stream().map(HwMonitorUnit::getMonitorUnitId).collect(Collectors.toList());
List<HwMonitorUnit> treeList = new ArrayList<>();
for (HwMonitorUnit hwMonitorUnit:hwMonitorUnits){
if (!tempList.contains(hwMonitorUnit.getParentId()))
recursionFn(hwMonitorUnits,hwMonitorUnit);
returnList.add(hwMonitorUnit);
}
return returnList;
for (int i = 0; i < returnList.size(); i++){
if (returnList.get(i).getParentId()==null){
treeList.add(returnList.get(i));
}
}
return treeList;
}
private void recursionFn(List<HwMonitorUnit> list, HwMonitorUnit t)
{

Loading…
Cancel
Save