Browse Source

分页, 目录id

wuweihao 2 years ago
parent
commit
09e8585232

+ 4 - 1
720yun_fd_manage/gis_domain/src/main/java/com/gis/domain/dto/FodderPageDto.java

@@ -3,13 +3,16 @@ package com.gis.domain.dto;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
+import javax.validation.constraints.NotBlank;
+
 /**
  * Created by owen on 2021/1/8 0008 16:31
  */
 @Data
 public class FodderPageDto extends PageDto {
 
-    @ApiModelProperty(value = "类型, 全景图:pano, 图片:image, 音频:audio, 视频:video")
+    @NotBlank(message = "类型不能为空")
+    @ApiModelProperty(value = "类型, 全景图:pano, 图片:image, 音频:audio, 视频:video", required = true)
     private String type;
 
     @ApiModelProperty(value = "目录id, 不传:或者跟目录")

+ 9 - 1
720yun_fd_manage/gis_service/src/main/java/com/gis/service/impl/FodderServiceImpl.java

@@ -403,12 +403,16 @@ public class FodderServiceImpl extends IBaseServiceImpl<FodderEntity, Long> impl
         String userName = getUserNameForToken();
         String type = param.getType();
         String searchKey = param.getSearchKey();
+        Long dirId = param.getDirId();
         StringBuilder builder = new StringBuilder();
         builder.append("( ");
         builder.append("select id,create_time,update_time,name, null as status, IFNULL(null,'dir') as type,user_id, null as icon,null as preview_icon, " +
-                "null as file_name, null as file_size,null as scene_code,null as dpi,null as temp_id,null as dir_id, null as dirName from tb_dir where is_delete=0") ;
+                "null as file_name, null as file_size,null as scene_code,null as dpi,null as temp_id,parent_id as dir_id, null as dirName from tb_dir where is_delete=0") ;
         builder.append(" and user_id='").append(userName).append("'");
         builder.append(" and type='").append(type).append("'");
+        if (dirId != null){
+            builder.append(" and parent_id=").append(dirId);
+        }
 
         if (StrUtil.isNotBlank(searchKey)){
             searchKey = RegexUtil.sqlReplaceSpecialStr(searchKey);
@@ -425,6 +429,10 @@ public class FodderServiceImpl extends IBaseServiceImpl<FodderEntity, Long> impl
         builder.append(" and a.user_id='").append(userName).append("'");
         builder.append(" and a.type='").append(type).append("'");
 
+        if (dirId != null){
+            builder.append(" and a.dir_id=").append(dirId);
+        }
+
         if (StrUtil.isNotBlank(searchKey)){
             searchKey = RegexUtil.sqlReplaceSpecialStr(searchKey);
             builder.append(" and a.name like '%").append(searchKey).append("%'");