wangliang 4 年 前
コミット
088c7f252e

+ 3 - 2
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/TBTaskService.java

@@ -11,6 +11,7 @@ import com.qmth.distributed.print.business.enums.TaskStatusEnum;
 import com.qmth.distributed.print.business.enums.TaskTypeEnum;
 import org.springframework.web.multipart.MultipartFile;
 
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -134,8 +135,8 @@ public interface TBTaskService extends IService<TBTask> {
      *
      * @param schoolId
      * @param printPlanId
-     * @param entityId
+     * @param entityIds
      * @return
      */
-    public int countByPrintPlanIdAndEntityId(Long schoolId, Long printPlanId, Long entityId);
+    public boolean countByPrintPlanIdAndEntityId(Long schoolId, Long printPlanId, List<Long> entityIds);
 }

+ 6 - 5
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/TBTaskServiceImpl.java

@@ -27,6 +27,7 @@ import org.springframework.web.multipart.MultipartFile;
 
 import javax.annotation.Resource;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.Objects;
 
@@ -273,11 +274,11 @@ public class TBTaskServiceImpl extends ServiceImpl<TBTaskMapper, TBTask> impleme
      *
      * @param schoolId
      * @param printPlanId
-     * @param entityId
+     * @param entityIds
      * @return
      */
     @Override
-    public int countByPrintPlanIdAndEntityId(Long schoolId, Long printPlanId, Long entityId) {
+    public boolean countByPrintPlanIdAndEntityId(Long schoolId, Long printPlanId, List<Long> entityIds) {
         QueryWrapper<TBTask> tbTaskQueryWrapper = new QueryWrapper<>();
         tbTaskQueryWrapper.lambda().ne(TBTask::getStatus, TaskStatusEnum.FINISH).isNotNull(TBTask::getStatus)
                 .eq(TBTask::getType, TaskTypeEnum.CREATE_PDF);
@@ -287,10 +288,10 @@ public class TBTaskServiceImpl extends ServiceImpl<TBTaskMapper, TBTask> impleme
         if (Objects.nonNull(printPlanId)) {
             tbTaskQueryWrapper.lambda().eq(TBTask::getPrintPlanId, printPlanId);
         }
-        if (Objects.nonNull(entityId)) {
-            tbTaskQueryWrapper.lambda().eq(TBTask::getEntityId, entityId);
+        if (Objects.nonNull(entityIds)) {
+            tbTaskQueryWrapper.lambda().in(TBTask::getEntityId, entityIds);
         }
-        return this.count(tbTaskQueryWrapper);
+        return this.count(tbTaskQueryWrapper) == 0 ? true : false;
     }
 
     /**