From 78694f580367d8825025a0d32beccbd9662764b7 Mon Sep 17 00:00:00 2001
From: whywhyo <1511349576@qq.com>
Date: 星期六, 13 五月 2023 21:33:54 +0800
Subject: [PATCH] 导入模板

---
 zhang-content/src/main/java/com/ruoyi/service/impl/ZfEquipmentServiceImpl.java |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEquipmentServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEquipmentServiceImpl.java
index 052b480..d805402 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEquipmentServiceImpl.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEquipmentServiceImpl.java
@@ -58,6 +58,17 @@
         return lqw;
     }
 
+    private LambdaQueryWrapper<ZfEquipment> uniqueCondition(ZfEquipment zfEquipment) {
+        LambdaQueryWrapper<ZfEquipment> lqw = new LambdaQueryWrapper<>();
+        lqw.eq(StringUtils.isNotEmpty(zfEquipment.getName()), ZfEquipment::getName, zfEquipment.getName());
+        lqw.eq(StringUtils.isNotEmpty(zfEquipment.getBuyer()), ZfEquipment::getBuyer, zfEquipment.getBuyer());
+        lqw.eq(StringUtils.isNotEmpty(zfEquipment.getContent()), ZfEquipment::getContent, zfEquipment.getContent());
+        lqw.eq(StringUtils.isNotEmpty(zfEquipment.getLocation()), ZfEquipment::getLocation, zfEquipment.getLocation());
+        lqw.eq(StringUtils.isNotEmpty(zfEquipment.getRemark()), ZfEquipment::getRemark, zfEquipment.getRemark());
+        lqw.eq(zfEquipment.getHappenTime() != null, ZfEquipment::getHappenTime, zfEquipment.getHappenTime());
+        return lqw;
+    }
+
 
     
     //------------------------------------------------------------------------------------------
@@ -277,6 +288,13 @@
             zfEquipment.setFamilyId(myFamilyId);
         }
 
+        //鍒ゆ柇鏄惁鏈夐噸澶嶆暟鎹�
+        LambdaQueryWrapper<ZfEquipment> lqw = uniqueCondition(zfEquipment);
+        List<ZfEquipment> list = list(lqw);
+        if(list.size()>0){
+            throw new RuntimeException("璇峰嬁鏂板閲嶅鏁版嵁");
+        }
+
         if (save(zfEquipment)) {
             return AjaxResult.success();
         } else {
@@ -285,6 +303,8 @@
     }
 
 
+
+
     @Override
     @Transactional
     public AjaxResult importExcel(MultipartFile file) {

--
Gitblit v1.9.1