Browse Source

目录 id=1

wuweihao 2 years ago
parent
commit
7df7139748

+ 4 - 0
720yun_fd_manage/gis_service/src/main/java/com/gis/service/impl/DirServiceImpl.java

@@ -48,6 +48,10 @@ public class DirServiceImpl extends IBaseServiceImpl<DirEntity, Long> implements
             log.info("该用户:{} 创建了新目录, 名字为:{}", phone, param.getName());
             entity = new DirEntity();
             BeanUtils.copyProperties(param, entity);
+            Long parentId = param.getParentId();
+            if (parentId == null){
+                entity.setParentId(1L);
+            }
             entity.setUserId(phone);
             this.save(entity);
         } else {

+ 4 - 0
720yun_fd_manage/gis_service/src/main/java/com/gis/service/impl/FodderServiceImpl.java

@@ -411,6 +411,8 @@ public class FodderServiceImpl extends IBaseServiceImpl<FodderEntity, Long> impl
         builder.append(" and type='").append(type).append("'");
         if (dirId != null && dirId > 1){
             builder.append(" and parent_id=").append(dirId);
+        } else {
+            builder.append(" and parent_id=1");
         }
 
         if (StrUtil.isNotBlank(searchKey)){
@@ -432,6 +434,8 @@ public class FodderServiceImpl extends IBaseServiceImpl<FodderEntity, Long> impl
         // dirId为空或者为1 :根目录
         if (dirId != null && dirId > 1){
             builder.append(" and a.dir_id=").append(dirId);
+        } else {
+            builder.append(" and (a.dir_id is null or a.dir_id=1)");
         }
 
         if (StrUtil.isNotBlank(searchKey)){