瀏覽代碼

文件上传部分功能调整

user5 1 年之前
父節點
當前提交
0d91a6eb3c

+ 6 - 1
jeeplus-modules/jeeplus-public-modules/src/main/java/com/jeeplus/pubmodules/oss/mapper/OssServiceMapper.java

@@ -16,12 +16,15 @@ import java.util.List;
 public interface OssServiceMapper extends BaseMapper<WorkAttachment> {
 
     @InterceptorIgnore(tenantLine = "true")
-    void deleteById(String id);
+    Integer deleteById(String id);
 
+    @InterceptorIgnore(tenantLine = "true")
     Integer selectSaveById(String id);
 
+    @InterceptorIgnore(tenantLine = "true")
     void updateProjectRecord(String id);
 
+    @InterceptorIgnore(tenantLine = "true")
     List<AttachmentDTO> findList(@Param(Constants.WRAPPER) QueryWrapper queryWrapper);
 
     @InterceptorIgnore(tenantLine = "true")
@@ -55,7 +58,9 @@ public interface OssServiceMapper extends BaseMapper<WorkAttachment> {
      * @param attachmentId
      * @return
      */
+    @InterceptorIgnore(tenantLine = "true")
     List<WorkAttachmentInfo> selectListByAttachmentId(String attachmentId);
 
+    @InterceptorIgnore(tenantLine = "true")
     void deleteByAttachmentIdNotInIds(@Param("attachmentId")String attachmentId, @Param("delIds")List<String> delIds);
 }

+ 3 - 0
jeeplus-modules/jeeplus-public-modules/src/main/java/com/jeeplus/pubmodules/oss/mapper/xml/OssServiceMapper.xml

@@ -104,6 +104,9 @@
              <if test="attachmentFlag != null and attachmentFlag != ''">
                  and a.attachment_flag = #{attachmentFlag}
              </if>
+             <if test="url != null and url != ''">
+                 and a.url = #{url}
+             </if>
          </where>
     </select>
 

+ 9 - 4
jeeplus-modules/jeeplus-public-modules/src/main/java/com/jeeplus/pubmodules/oss/service/OssService.java

@@ -92,10 +92,13 @@ public class OssService extends ServiceImpl<OssServiceMapper, WorkAttachment> {
             int i = 1;
             for (WorkAttachment workAttachment : workAttachments) {
                 //判断文件是否存在
-                LambdaQueryWrapper<WorkAttachment> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+                /*LambdaQueryWrapper<WorkAttachment> lambdaQueryWrapper = new LambdaQueryWrapper<>();
                 lambdaQueryWrapper.eq(WorkAttachment::getUrl, workAttachment.getUrl());
-                lambdaQueryWrapper.eq(WorkAttachment::getAttachmentId, workAttachment.getAttachmentId());
-                List<WorkAttachment> list = ossServiceMapper.selectList(lambdaQueryWrapper);
+                lambdaQueryWrapper.eq(WorkAttachment::getAttachmentId, workAttachment.getAttachmentId());*/
+                WorkAttachmentInfo workAttachmentInfo = new WorkAttachmentInfo();
+                workAttachmentInfo.setUrl(workAttachment.getUrl());
+                workAttachmentInfo.setAttachmentId(workAttachment.getAttachmentId());
+                List<WorkAttachmentInfo> list = ossServiceMapper.getByAttachmentIdAndUrlAndAttachmentFlag(workAttachmentInfo);
                 if (CollectionUtil.isNotEmpty(list)) {
                     i++;
                     continue;
@@ -118,6 +121,8 @@ public class OssService extends ServiceImpl<OssServiceMapper, WorkAttachment> {
                 UserDTO userDTO = SpringUtil.getBean ( IUserApi.class ).getByToken (currentToken);
                 ossServiceMapper.insertWorkAttachment(workAttachment, userDTO);
             }
+
+
             log.info("保存操作执行完成");
         }
     }
@@ -142,7 +147,7 @@ public class OssService extends ServiceImpl<OssServiceMapper, WorkAttachment> {
         log.info("开始执行删除操作,入参:{}" , id);
         Map<String,Object> map = new HashMap<>();
         map.put("id", id);
-        int i = ossServiceMapper.deleteByMap(map);
+        int i = ossServiceMapper.deleteById(id);
         //项目文件删除后处理项目文件状态
         Integer num = ossServiceMapper.selectSaveById(id);
         if (num == 0) {