From 6dfd2599d2e52507e018fd4c6b35d38873e48cfb Mon Sep 17 00:00:00 2001
From: wang-hao-jie <1550036656@qq.com>
Date: 星期四, 17 三月 2022 15:52:51 +0800
Subject: [PATCH] 最新版本

---
 xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/FingerprintController.java |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/FingerprintController.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/FingerprintController.java
index d8b960e..26ef18c 100644
--- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/FingerprintController.java
+++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/FingerprintController.java
@@ -174,6 +174,15 @@
     @ApiOperation(value = "缂栬緫鎴栨洿鏂版暟鎹�")
     public Result<Fingerprint> saveOrUpdate(Fingerprint fingerprint) {
         if(StrUtil.isNotEmpty(fingerprint.getUserId())){
+
+            QueryWrapper<Fingerprint> wrapper = new QueryWrapper<Fingerprint>();
+            wrapper.eq("code",fingerprint.getCode());
+            wrapper.isNotNull("user_id");
+            Fingerprint one = iFingerprintService.getOne(wrapper);
+            if(one!=null){
+                return ResultUtil.error("code閲嶅浜嗭紝璇烽噸鏂拌幏鍙�");
+            }
+
             User user = userService.get(fingerprint.getUserId());
             fingerprint.setUsername(user.getUsername());
             fingerprint.setPassword(user.getDescription());
@@ -182,6 +191,15 @@
         if(StrUtil.isNotEmpty(fingerprint.getCustomerId())){
             Customer byId = iCustomerService.getById(fingerprint.getCustomerId());
             fingerprint.setAreaId(byId.getAreaId());
+
+            QueryWrapper<Fingerprint> wrapper = new QueryWrapper<Fingerprint>();
+            wrapper.eq("code",fingerprint.getCode());
+            wrapper.eq("area_id",byId.getAreaId());
+            wrapper.isNotNull("customer_id");
+            Fingerprint one = iFingerprintService.getOne(wrapper);
+            if(one!=null){
+                return ResultUtil.error("code閲嶅浜嗭紝璇烽噸鏂拌幏鍙�");
+            }
         }
 
         if(StrUtil.isNotEmpty(fingerprint.getCustomerReceiveId())){

--
Gitblit v1.9.1