Blizzard 1 жил өмнө
parent
commit
a972a4c487

+ 31 - 0
blade-service-api/wt-okr-api/src/main/java/com/wtkj/dto/SelectFileDTO.java

@@ -0,0 +1,31 @@
+package com.wtkj.dto;
+
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import java.io.Serializable;
+
+/**
+ * @author Blizzard
+ * @create at 2023-09-20 11:44
+ * @describe
+ */
+@Data
+public class SelectFileDTO implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+
+	@NotBlank(message = "projectId不可为空")
+	private String projectId;
+
+	@JsonSerialize(using = ToStringSerializer.class)
+	private Long stageId;
+
+	private Integer isLatest;
+
+	private Integer current;
+
+	private Integer size;
+}

+ 15 - 0
blade-service/wt-okr/src/main/java/com/wtkj/controller/FileAndFolderController.java

@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import com.wtkj.dto.SelectFileDTO;
 import com.wtkj.dto.UploadFileDTO;
 import com.wtkj.entity.FileAndFolder;
 import com.wtkj.entity.FileRead;
@@ -175,4 +176,18 @@ public class FileAndFolderController {
 	}
 
 
+	/**
+	 * 文件选择列表
+	 */
+	@PostMapping("/select-file")
+	@ApiOperationSupport(order = 11)
+	@ApiOperation(value = "选择文件", notes = "")
+	public R selectFile(@RequestBody @Valid SelectFileDTO dto) {
+		Query query = new Query();
+		query.setCurrent(dto.getCurrent());
+		query.setSize(dto.getSize());
+		IPage<FileAndFolder> page = fileAndFolderService.selectPage(dto.getProjectId(), dto.getStageId(), dto.getIsLatest(), Condition.getPage(query));
+		return R.data(FileAndFolderWrapper.build().pageVO(page));
+	}
+
 }

+ 2 - 0
blade-service/wt-okr/src/main/java/com/wtkj/mapper/FileAndFolderMapper.java

@@ -23,4 +23,6 @@ public interface FileAndFolderMapper extends BaseMapper<FileAndFolder> {
 	List<FileAndFolder> getChildrenFileList(Long stageId, Long parentId);
 
 	List<FileAndFolder> getChildren(Long stageId, Long parentId);
+
+	List<FileAndFolder> getPage(String projectId, Long stageId, Integer isLatest, IPage<FileAndFolder> page);
 }

+ 11 - 0
blade-service/wt-okr/src/main/java/com/wtkj/mapper/FileAndFolderMapper.xml

@@ -52,4 +52,15 @@
             and parent_id = #{param2}
         </if>
     </select>
+
+    <select id="getPage" resultType="com.wtkj.entity.FileAndFolder">
+        select * from blade_file_and_folder where is_deleted = 0 and type = 1 and project_id = #{param1}
+        <if test="param2 != null">
+            and stage_id = #{param2}
+        </if>
+        <if test="param3 != null ">
+            and DATE(create_time) >=DATE_SUB(CURDATE(), INTERVAL 15 DAY)
+        </if>
+        order by create_time desc
+    </select>
 </mapper>

+ 2 - 2
blade-service/wt-okr/src/main/java/com/wtkj/mapper/ProjectGroupMapper.xml

@@ -8,7 +8,7 @@
     </select>
 
     <select id="selectUserByBeInvitedDept" resultType="com.wtkj.entity.ProjectGroup">
-        select * from blade_project_group where is_deleted = 0 and project_id = #{param1} and be_invited_dept =
-        #{param2}
+        select * from blade_project_group where is_deleted = 0 and project_id = #{param1} and (invite_dept = #{param2}
+        or be_invited_dept = #{param2})
     </select>
 </mapper>

+ 1 - 1
blade-service/wt-okr/src/main/java/com/wtkj/service/IFileAndFolderService.java

@@ -33,5 +33,5 @@ public interface IFileAndFolderService extends BaseService<FileAndFolder> {
 
 	List<FileAndFolder> getChildren(Long stageId, Long parentId);
 
-
+	IPage<FileAndFolder> selectPage(String projectId, Long stageId, Integer isLatest, IPage<FileAndFolder> page);
 }

+ 6 - 0
blade-service/wt-okr/src/main/java/com/wtkj/service/impl/FileAndFolderServiceImpl.java

@@ -113,6 +113,12 @@ public class FileAndFolderServiceImpl extends BaseServiceImpl<FileAndFolderMappe
 		return getChildrenByFolderId(new ArrayList<>(), stageId, parentId);
 	}
 
+	@Override
+	public IPage<FileAndFolder> selectPage(String projectId, Long stageId, Integer isLatest, IPage<FileAndFolder> page) {
+		List<FileAndFolder> list = baseMapper.getPage(projectId, stageId, isLatest, page);
+		return page.setRecords(list);
+	}
+
 
 	private List<FileAndFolder> getChildrenByFolderId(ArrayList<FileAndFolder> result, Long stageId, Long parentId) {
 		//文件下的文件和文件夹