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 * @throws
* */ * */
@GetMapping("/treeList") @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); List<HwMonitorUnit> list = hwMonitorUnitService.selectTreeList(hwMonitorUnits);
return getDataTable(list); return getDataTable(list);

@ -1,61 +1,61 @@
package com.ruoyi.business.mapper; package com.ruoyi.business.mapper;
import java.util.List; import java.util.List;
import com.ruoyi.business.domain.HwDeviceModeFunction; import com.ruoyi.business.domain.HwDeviceModeFunction;
/** /**
* Mapper * Mapper
* *
* @author xins * @author xins
* @date 2023-09-05 * @date 2023-09-05
*/ */
public interface HwDeviceModeFunctionMapper public interface HwDeviceModeFunctionMapper
{ {
/** /**
* *
* *
* @param modeFunctionId * @param modeFunctionId
* @return * @return
*/ */
public HwDeviceModeFunction selectHwDeviceModeFunctionByModeFunctionId(Long modeFunctionId); public HwDeviceModeFunction selectHwDeviceModeFunctionByModeFunctionId(Long modeFunctionId);
/** /**
* *
* *
* @param hwDeviceModeFunction * @param hwDeviceModeFunction
* @return * @return
*/ */
public List<HwDeviceModeFunction> selectHwDeviceModeFunctionList(HwDeviceModeFunction hwDeviceModeFunction); public List<HwDeviceModeFunction> selectHwDeviceModeFunctionList(HwDeviceModeFunction hwDeviceModeFunction);
/** /**
* *
* *
* @param hwDeviceModeFunction * @param hwDeviceModeFunction
* @return * @return
*/ */
public int insertHwDeviceModeFunction(HwDeviceModeFunction hwDeviceModeFunction); public int insertHwDeviceModeFunction(HwDeviceModeFunction hwDeviceModeFunction);
/** /**
* *
* *
* @param hwDeviceModeFunction * @param hwDeviceModeFunction
* @return * @return
*/ */
public int updateHwDeviceModeFunction(HwDeviceModeFunction hwDeviceModeFunction); public int updateHwDeviceModeFunction(HwDeviceModeFunction hwDeviceModeFunction);
/** /**
* *
* *
* @param modeFunctionId * @param modeFunctionId
* @return * @return
*/ */
public int deleteHwDeviceModeFunctionByModeFunctionId(Long modeFunctionId); public int deleteHwDeviceModeFunctionByModeFunctionId(Long modeFunctionId);
/** /**
* *
* *
* @param modeFunctionIds * @param modeFunctionIds
* @return * @return
*/ */
public int deleteHwDeviceModeFunctionByModeFunctionIds(Long[] modeFunctionIds); public int deleteHwDeviceModeFunctionByModeFunctionIds(Long[] modeFunctionIds);
} }

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

Loading…
Cancel
Save