From c35d9c6311b6f9ef75b49559a5c6db75e0a43ac6 Mon Sep 17 00:00:00 2001
From: zqy <2522236926@qq.com>
Date: 星期二, 30 七月 2024 20:06:50 +0800
Subject: [PATCH] 修改bug&分享

---
 zhang-content/src/main/java/com/ruoyi/service/impl/ZfAncestorServiceImpl.java |   23 ++++++++++++++++++-----
 1 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfAncestorServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfAncestorServiceImpl.java
index f0f1aa5..39214c0 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfAncestorServiceImpl.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfAncestorServiceImpl.java
@@ -203,22 +203,35 @@
     }
 
     @Override
-    public void update(ZfAncestor zfAncestor) {
+    public ZfAncestor update(ZfAncestor zfAncestor) {
         LambdaQueryWrapper<ZfAncestor> lqw = uniqueCondition(zfAncestor);
         List<ZfAncestor> list = list(lqw);
-        System.out.println(list);
+//        System.out.println(list);
         ZInfoUser updateDate =zInfoUserService.getInfoBysysId(zfAncestor.getSysId());
         ZfAncestor zfAncestor1 = new ZfAncestor();
+        ZfAncestor zfAncestor2 = new ZfAncestor();
         zfAncestor1.setId(list.get(0).getId());
         zfAncestor1.setName(zfAncestor.getName());
-        if((updateDate.getSpouseId() != null || updateDate.getSpouseId() != 0) && zfAncestor.getSex() !=null){
+        System.out.println(updateDate);
+        if (zfAncestor.getSex() != null){
+        if(updateDate.getSpouseId() != null && updateDate.getSpouseId() != 0){
             Long spouseId=updateDate.getSpouseId();
             if (zInfoUserService.getById(spouseId).getSex().equals(zfAncestor.getSex())){
-                throw new RuntimeException("绁栧厛涓や綅涓嶈兘涓哄悓鎬�");}
-            zfAncestor.setSex(zfAncestor.getSex());}
+
+                Long spouseSysId = zInfoUserService.getById(spouseId).getSysId();
+                zfAncestor2.setSysId(spouseSysId);
+                Integer spId = list(uniqueCondition(zfAncestor2)).get(0).getId();
+                zfAncestor2.setId(spId);
+                zfAncestor2.setSex(zfAncestor.getSex() == 0? 1: 0);
+                System.out.println(zfAncestor2);
+                zfAncestorService.updateById(zfAncestor2);
+            }}
+            zfAncestor1.setSex(zfAncestor.getSex());}
+//        System.out.println("1841vdndigrrr"+zfAncestor1);
 
             zfAncestorService.updateById(zfAncestor1);
 
+        return zfAncestor2;
     }
 
     /**

--
Gitblit v1.9.1