|
@@ -47,6 +47,21 @@ public class RegionTreeInfoServiceImpl extends BaseServiceImpl<RegionTreeInfoMap
|
|
|
*/
|
|
|
@Override
|
|
|
public List<RegionTreeInfoVO> lazyTree(Long projectId, Long id) {
|
|
|
+ if (id == null){
|
|
|
+ //如果是首节点,就去查询当前项目是否存在区域树,如果不存在则自动生成一条根节点
|
|
|
+ List<RegionTreeInfoVO> vos = baseMapper.lazyTree(projectId, 0L);
|
|
|
+ if (vos == null || vos.size() <= 0){
|
|
|
+ RegionTreeInfo info = new RegionTreeInfo();
|
|
|
+ info.setParentId(0L);
|
|
|
+ info.setAncestors("0");
|
|
|
+ info.setProjectId(projectId);
|
|
|
+ info.setAreaName("征拆区域");
|
|
|
+ info.setNodeType(-1);
|
|
|
+ baseMapper.insert(info);
|
|
|
+ vos = baseMapper.lazyTree(projectId, 0L);
|
|
|
+ }
|
|
|
+ return vos;
|
|
|
+ }
|
|
|
List<RegionTreeInfoVO> vos = baseMapper.lazyTree(projectId, id);
|
|
|
return vos;
|
|
|
}
|