From e7a01b236a9f6bee3616ddf2d1d88ada738490a9 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@63.com>
Date: 星期二, 08 十一月 2022 10:15:28 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/crm/manager/controller/CstmrController.java |   24 +++++++++++++++++++++++-
 1 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/src/main/java/com/zy/crm/manager/controller/CstmrController.java b/src/main/java/com/zy/crm/manager/controller/CstmrController.java
index d14761f..e732e7c 100644
--- a/src/main/java/com/zy/crm/manager/controller/CstmrController.java
+++ b/src/main/java/com/zy/crm/manager/controller/CstmrController.java
@@ -30,6 +30,7 @@
 import org.apache.poi.ss.usermodel.Workbook;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
@@ -304,7 +305,7 @@
 
     @RequestMapping(value = "/cstmr/followers/table/auth")
     @ManagerAuth
-    public R get(@RequestParam("cstmrId") Long cstmrId) {
+    public R cstmrFollowersTable(@RequestParam("cstmrId") Long cstmrId) {
         List<CstmrFoll> cstmrFolls = cstmrFollService.selectList(new EntityWrapper<CstmrFoll>().eq("cstmr_id", cstmrId));
         List<CstmrFollowerTableVo> result = new ArrayList<>();
         for (CstmrFoll cstmrFoll : cstmrFolls) {
@@ -317,5 +318,26 @@
         return R.ok().add(result);
     }
 
+    @RequestMapping(value = "/cstmr/followers/add/auth")
+    @ManagerAuth
+    @Transactional
+    public R cstmrFollowersAdd(@RequestParam("cstmrId") Long cstmrId,
+                               @RequestParam("followerIds[]") Long[] followerIds) {
+        if (Cools.isEmpty(cstmrId, followerIds)) {
+            return R.parse(BaseRes.PARAM);
+        }
+        for (Long userId : followerIds) {
+            if (cstmrFollService.selectCount(new EntityWrapper<CstmrFoll>().eq("cstmr_id", cstmrId).eq("user_id", userId)) == 0) {
+                CstmrFoll cstmrFoll = new CstmrFoll();
+                cstmrFoll.setCstmrId(cstmrId);
+                cstmrFoll.setUserId(userId);
+                if (!cstmrFollService.insert(cstmrFoll)) {
+                    throw new CoolException("娣诲姞澶辫触锛岃鑱旂郴绠$悊鍛�");
+                }
+            }
+        }
+        return R.ok("娣诲姞鎴愬姛");
+    }
+
 
 }

--
Gitblit v1.9.1