|
@@ -1,5 +1,6 @@
|
|
|
package org.jeecg.modules.base.controller;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
@@ -13,6 +14,7 @@ import org.jeecg.common.api.vo.Result;
|
|
|
import org.jeecg.common.system.query.QueryGenerator;
|
|
|
import org.jeecg.common.util.oConvertUtils;
|
|
|
import org.jeecg.common.system.vo.SelectTreeModel;
|
|
|
+import org.jeecg.modules.base.convert.InterlockBaseConvert;
|
|
|
import org.jeecg.modules.base.entity.InterlockBase;
|
|
|
import org.jeecg.modules.base.service.IInterlockBaseService;
|
|
|
|
|
@@ -21,6 +23,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
|
+import org.jeecg.modules.base.vo.InterlockBaseTreeVO;
|
|
|
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
|
|
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
|
|
import org.jeecgframework.poi.excel.entity.ExportParams;
|
|
@@ -51,6 +54,39 @@ public class InterlockBaseController extends JeecgController<InterlockBase, IInt
|
|
|
@Autowired
|
|
|
private IInterlockBaseService interlockBaseService;
|
|
|
|
|
|
+ /**查一二级树形结构*/
|
|
|
+ @ApiOperation("一二级树形结构")
|
|
|
+ @GetMapping(value = "/lever12")
|
|
|
+ public List<InterlockBaseTreeVO> getTree12(){
|
|
|
+ InterlockBase interlockBase = new InterlockBase();
|
|
|
+ interlockBase.setInterlockType("0");//0装置1系统2联锁
|
|
|
+ QueryWrapper<InterlockBase> zzqueryWrapper = new QueryWrapper<>(interlockBase);
|
|
|
+ List<InterlockBase> zzlist = interlockBaseService.list(zzqueryWrapper);
|
|
|
+
|
|
|
+ interlockBase.setInterlockType("1");//0装置1系统2联锁
|
|
|
+ QueryWrapper<InterlockBase> xtqueryWrapper = new QueryWrapper<>(interlockBase);
|
|
|
+ List<InterlockBase> xtlist = interlockBaseService.list(xtqueryWrapper);
|
|
|
+
|
|
|
+ List<InterlockBaseTreeVO> list = new ArrayList<>();
|
|
|
+
|
|
|
+ for (InterlockBase interlockBase1 : zzlist){
|
|
|
+ //1是0否
|
|
|
+ List<InterlockBaseTreeVO> children = new ArrayList<>();
|
|
|
+ if(interlockBase1.getHasChild()!=null && interlockBase1.getHasChild().equals("1")){
|
|
|
+ for (InterlockBase interlockBase2 : xtlist){
|
|
|
+ if(interlockBase2.getPid().equals(interlockBase1.getId())){
|
|
|
+ InterlockBaseTreeVO vo = InterlockBaseConvert.INSTANCE.convertToInterlockBaseTreeVO2(interlockBase2,null);
|
|
|
+ children.add(vo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ InterlockBaseTreeVO vo = InterlockBaseConvert.INSTANCE.convertToInterlockBaseTreeVO2(interlockBase1,children);
|
|
|
+ list.add(vo);
|
|
|
+ }
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 分页列表查询
|
|
|
*
|
|
@@ -191,7 +227,7 @@ public class InterlockBaseController extends JeecgController<InterlockBase, IInt
|
|
|
return Result.error("批量查询子节点失败:" + e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 添加
|
|
|
*
|
|
@@ -206,7 +242,7 @@ public class InterlockBaseController extends JeecgController<InterlockBase, IInt
|
|
|
interlockBaseService.addInterlockBase(interlockBase);
|
|
|
return Result.OK("添加成功!");
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 编辑
|
|
|
*
|
|
@@ -221,7 +257,7 @@ public class InterlockBaseController extends JeecgController<InterlockBase, IInt
|
|
|
interlockBaseService.updateInterlockBase(interlockBase);
|
|
|
return Result.OK("编辑成功!");
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 通过id删除
|
|
|
*
|
|
@@ -236,7 +272,7 @@ public class InterlockBaseController extends JeecgController<InterlockBase, IInt
|
|
|
interlockBaseService.deleteInterlockBase(id);
|
|
|
return Result.OK("删除成功!");
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 批量删除
|
|
|
*
|
|
@@ -251,7 +287,7 @@ public class InterlockBaseController extends JeecgController<InterlockBase, IInt
|
|
|
this.interlockBaseService.removeByIds(Arrays.asList(ids.split(",")));
|
|
|
return Result.OK("批量删除成功!");
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 通过id查询
|
|
|
*
|