From 81995abfa712d65b7f7f1e23b97a97bc4065103d Mon Sep 17 00:00:00 2001
From: feige <791364011@qq.com>
Date: 星期五, 25 十月 2024 23:11:30 +0800
Subject: [PATCH] 修改了bug

---
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfAncestorController.java |   44 +++++++++++++++++++++++++++++++++++++-------
 1 files changed, 37 insertions(+), 7 deletions(-)

diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfAncestorController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfAncestorController.java
index f0c0446..8e276dc 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfAncestorController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfAncestorController.java
@@ -10,7 +10,9 @@
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.ServletUtils;
 import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.domain.*;
+import com.ruoyi.domain.dto.AncestorClan;
 import com.ruoyi.domain.dto.AncestorHelper;
 import com.ruoyi.service.ZInfoUserService;
 import com.ruoyi.service.ZfAncestorService;
@@ -23,12 +25,14 @@
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
+import javax.servlet.http.HttpServletResponse;
 
 import java.util.ArrayList;
 import java.util.List;
 
 import static com.ruoyi.common.core.domain.AjaxResult.error;
 import static com.ruoyi.common.core.page.TableSupport.*;
+//import static jdk.nashorn.internal.runtime.regexp.joni.Config.log;
 
 @RestController
 @RequestMapping("/ZfAncestor")
@@ -140,6 +144,32 @@
 
         zInfoUserService.updateById(infoUser);
     }
+    @Log(title = "瀹跺涵澶т簨浠惰褰�", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, ZfAncestor zfAncestor) {
+        List<AncestorClan> list = new ArrayList<>();
+
+        list = zfAncestorService.selectByCondition(zfAncestor);
+       // log.info("瀵煎嚭璁板綍涓�:{}", list);
+        ExcelUtil<AncestorClan> util = new ExcelUtil<>(AncestorClan.class);
+        util.exportExcel(response, list, "瀹跺涵澶т簨浠惰褰曟暟鎹�");
+
+    }
+    /**
+     * 瀵煎嚭瀵煎嚭绁栧厛淇℃伅璁板綍鍒楄〃
+     */
+//    @PreAuthorize("@ss.hasPermi('system:property:export')")
+    @Log(title = "瀵煎嚭绁栧厛淇℃伅", businessType = BusinessType.EXPORT)
+    @PostMapping("/export1/{ids}")
+    public void export(HttpServletResponse response, @PathVariable Long[] ids)
+    {
+        List<AncestorClan> list = zfAncestorService.selectByIds(ids);
+      //  log.info("瀵煎嚭璁板綍涓�:{}",list);
+        ExcelUtil<AncestorClan> util = new ExcelUtil<>(AncestorClan.class);
+        util.exportExcel(response, list, "淇濇磥鏀剁撼璁板綍鏁版嵁");
+    }
+
+
 
     /**
      * 淇敼绁栧厛淇℃伅
@@ -171,7 +201,7 @@
 
             //鏂板涓�涓粯璁ょ殑瀹跺涵鍙�
             ZfFamily zfFamily = new ZfFamily();
-            zfFamily.setName("榛樿涓�鍙峰搴�");
+            zfFamily.setName("榛樿涓�鍙峰搴�"+ancestorHelper.getClanId());
             zfFamily.setFid(0L);
             zfFamily.setMid(0L);
             zfFamily.setClanId(ancestorHelper.getClanId());
@@ -187,8 +217,8 @@
             us.setPassword("123456");
             us.setUserName(ancestorHelper.getName());
             us.setClanId(ancestorHelper.getClanId());
-            if (!userService.checkUserNameUnique(us)) {
-                return error("鏂板绁栧厛'" + us.getUserName() + "'澶辫触锛岀櫥褰曡处鍙峰凡瀛樺湪");
+            if (!userService.checkNickNameUnique(us)) {
+                return error("鏂板绁栧厛'" + us.getNickName() + "'澶辫触锛岀櫥褰曡处鍙峰凡瀛樺湪");
             }
 
             us.setPassword(SecurityUtils.encryptPassword(us.getPassword()));
@@ -201,8 +231,8 @@
             usa.setPassword("123456");
             usa.setClanId(ancestorHelper.getClanId());
             usa.setUserName(ancestorHelper.getFname());
-            if (!userService.checkUserNameUnique(usa)) {
-                return error("鏂板绁栧厛1'" + usa.getUserName() + "'澶辫触锛岀櫥褰曡处鍙峰凡瀛樺湪");
+            if (!userService.checkNickNameUnique(usa)) {
+                return error("鏂板绁栧厛1'" + usa.getNickName() + "'澶辫触锛岀櫥褰曡处鍙峰凡瀛樺湪");
             }
 
             us.setPassword(SecurityUtils.encryptPassword(usa.getPassword()));
@@ -293,8 +323,8 @@
             us.setClanId(ancestorHelper.getClanId());
             System.out.println(ancestorHelper.getClanId());
             System.out.println("0000_______+++++++++++++999999999999");
-            if (!userService.checkUserNameUnique(us)) {
-                return error("鏂板绁栧厛绠$悊鍛�'" + us.getUserName() + "'澶辫触锛岀櫥褰曡处鍙峰凡瀛樺湪");
+            if (!userService.checkNickNameUnique(us)) {
+                return error("鏂板绁栧厛绠$悊鍛�'" + us.getNickName() + "'澶辫触锛岀櫥褰曡处鍙峰凡瀛樺湪");
             }
 
             us.setPassword(SecurityUtils.encryptPassword(us.getPassword()));

--
Gitblit v1.9.1