瀏覽代碼

判定重复逻辑

Signed-off-by: hamjin <335908093@qq.com>
hamjin 2 年之前
父節點
當前提交
0ab709474b
共有 1 個文件被更改,包括 6 次插入10 次删除
  1. 6 10
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/PoCollectionServiceImpl.java

+ 6 - 10
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/PoCollectionServiceImpl.java

@@ -41,8 +41,7 @@ public class PoCollectionServiceImpl implements IPoCollectionService {
      * @return
      */
     @Override
-    public List<PoCollection> selectPoCollectionList(PoCollection poCollection)
-    {
+    public List<PoCollection> selectPoCollectionList(PoCollection poCollection) {
         return poCollectionMapper.selectPoCollectionList(poCollection);
     }
 
@@ -68,7 +67,7 @@ public class PoCollectionServiceImpl implements IPoCollectionService {
     @Override
     public int insertCollection(PoCollection collection) {
         List<PoCollection> poCollection = poCollectionMapper.selectPoCollectionList(collection);
-        if (poCollection != null)
+        if (poCollection != null && !poCollection.isEmpty())
             return -1;
         return poCollectionMapper.insertPoCollection(collection);
     }
@@ -83,9 +82,8 @@ public class PoCollectionServiceImpl implements IPoCollectionService {
     public int batchInsertCollection(List<PoCollection> collection) {
         for (PoCollection collection1 : collection) {
             List<PoCollection> list = poCollectionMapper.selectPoCollectionList(collection1);
-            if (list == null || list.isEmpty())
-                continue;
-            return -1;
+            if (list != null && !list.isEmpty())
+                return -1;
         }
         return poCollectionMapper.batchInsertPoCollection(collection);
     }
@@ -108,8 +106,7 @@ public class PoCollectionServiceImpl implements IPoCollectionService {
      * @return
      */
     @Override
-    public int deletePoCollectionByCollectionIds(Long[] collectionIds)
-    {
+    public int deletePoCollectionByCollectionIds(Long[] collectionIds) {
         return poCollectionMapper.deletePoCollectionByCollectionIds(collectionIds);
     }
 
@@ -120,8 +117,7 @@ public class PoCollectionServiceImpl implements IPoCollectionService {
      * @return
      */
     @Override
-    public int deletePoCollectionByCollectionId(Long collectionId)
-    {
+    public int deletePoCollectionByCollectionId(Long collectionId) {
         return poCollectionMapper.deletePoCollectionByCollectionId(collectionId);
     }
 }