From 91b7d154e71a4ba5222ecfef6b95ff2ea26b6291 Mon Sep 17 00:00:00 2001
From: zxl <763096477@qq.com>
Date: 星期一, 09 六月 2025 11:19:53 +0800
Subject: [PATCH] 客户管理,客户权限管理(会员分页)

---
 framework/src/main/java/cn/lili/modules/lmk/service/impl/CustomerServiceImpl.java |   14 ++++
 buyer-api/src/main/java/cn/lili/controller/lmk/CustomerController.java            |  100 +++++++++++++++++++++++++++++++++
 framework/src/main/java/cn/lili/modules/lmk/service/CustomerService.java          |    8 ++
 3 files changed, 121 insertions(+), 1 deletions(-)

diff --git a/buyer-api/src/main/java/cn/lili/controller/lmk/CustomerController.java b/buyer-api/src/main/java/cn/lili/controller/lmk/CustomerController.java
new file mode 100644
index 0000000..1478a62
--- /dev/null
+++ b/buyer-api/src/main/java/cn/lili/controller/lmk/CustomerController.java
@@ -0,0 +1,100 @@
+package cn.lili.controller.lmk;
+
+import cn.lili.base.Result;
+import cn.lili.group.Add;
+import cn.lili.group.Update;
+import cn.lili.modules.lmk.domain.form.CustomerTagForm;
+import cn.lili.modules.lmk.domain.form.CustomerTagRefForm;
+import cn.lili.modules.lmk.domain.query.CustomerQuery;
+import cn.lili.modules.lmk.domain.query.CustomerTagQuery;
+import cn.lili.modules.lmk.service.CustomerService;
+import cn.lili.modules.lmk.service.CustomerTagRefService;
+import cn.lili.modules.lmk.service.CustomerTagService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * 灏忕▼搴� 瀹㈡埛绠$悊(鍟嗘埛)
+ */
+@Validated
+@RequiredArgsConstructor
+@Api(value = "灏忕▼搴忕瀹㈡埛绠$悊", tags = "灏忕▼搴忕瀹㈡埛绠$悊")
+@RestController
+@RequestMapping("/buyer/lmk/customer")
+public class CustomerController {
+
+    private final CustomerService customerService;
+    private final CustomerTagService customerTagService;
+    private final CustomerTagRefService customerTagRefService;
+
+    @ApiOperation(value = "鍟嗛摵涓嬫媺鍒楄〃")
+    @GetMapping("/store/selectOption")
+    public Result getStoreSelectOptions(){
+        return customerService.getStoreSelectOptions();
+    }
+
+
+    @ApiOperation(value = "瀹㈡埛鍒嗛〉鍒楄〃")
+    @GetMapping
+    public Result getByPage(CustomerQuery customerQuery) {
+        return customerService.getMemberPageByWX(customerQuery);
+    }
+
+    @PostMapping("/addTag")
+    @ApiOperation(value = "娣诲姞鏍囩", notes = "娣诲姞鏍囩")
+    public Result add(@RequestBody @Validated(Add.class) CustomerTagForm form) {
+        return customerTagService.add(form);
+    }
+
+    @PutMapping("/editTag")
+    @ApiOperation(value = "淇敼鏍囩", notes = "淇敼鏍囩")
+    public Result update(@RequestBody @Validated(Update.class) CustomerTagForm form) {
+        return customerTagService.update(form);
+    }
+
+    @DeleteMapping("/tag/{id}")
+    @ApiOperation(value = "ID鍒犻櫎鏍囩", notes = "ID鍒犻櫎")
+    public Result removeById(@PathVariable("id") String id) {
+        return customerTagService.removeById(id);
+    }
+
+
+    @GetMapping("/tagList")
+    @ApiOperation(value = "鏍囩鍒楄〃", notes = "鏍囩鍒楄〃")
+    public Result list() {
+        return customerTagService.all();
+    }
+    @GetMapping("/pageTagList")
+    @ApiOperation(value = "鍒嗛〉鏍囩鍒楄〃", notes = "鏍囩鍒楄〃")
+    public Result pageList(CustomerTagQuery query) {
+        return customerTagService.page(query);
+    }
+
+
+    @PostMapping("/customerAddTag")
+    @ApiOperation(value = "娣诲姞瀹㈡埛鏍囩鏍囪瘑", notes = "娣诲姞瀹㈡埛鏍囩鏍囪瘑")
+    public Result addCustomerTag(@RequestBody @Validated(Add.class) CustomerTagForm form) {
+        return customerTagService.addCustomerTag(form);
+    }
+
+//    @PostMapping("/customerAddTag")
+//    @ApiOperation(value = "娣诲姞瀹㈡埛鏍囩鏍囪瘑", notes = "娣诲姞瀹㈡埛鏍囩鏍囪瘑")
+//    public Result add(@RequestBody @Validated(Add.class) CustomerTagRefForm form) {
+//        return customerTagRefService.add(form);
+//    }
+
+    @PutMapping("/customerEditTag")
+    @ApiOperation(value = "淇敼瀹㈡埛鏍囩鏍囪瘑", notes = "淇敼瀹㈡埛鏍囩鏍囪瘑")
+    public Result update(@RequestBody @Validated(Update.class) CustomerTagRefForm form) {
+        return customerTagRefService.update(form);
+    }
+
+    @DeleteMapping("/customerDelTag/{id}")
+    @ApiOperation(value = "鍒犻櫎瀹㈡埛鏍囩鏍囪瘑ID鍒犻櫎", notes = "鍒犻櫎瀹㈡埛鏍囩鏍囪瘑ID鍒犻櫎")
+    public Result removeCustomerTagById(@PathVariable("id") String id) {
+        return customerTagRefService.removeById(id);
+    }
+}
diff --git a/framework/src/main/java/cn/lili/modules/lmk/service/CustomerService.java b/framework/src/main/java/cn/lili/modules/lmk/service/CustomerService.java
index b648e66..1f6eb4e 100644
--- a/framework/src/main/java/cn/lili/modules/lmk/service/CustomerService.java
+++ b/framework/src/main/java/cn/lili/modules/lmk/service/CustomerService.java
@@ -13,7 +13,13 @@
 import com.baomidou.mybatisplus.extension.service.IService;
 
 public interface CustomerService extends IService<Member> {
-
+    /**
+     * 鑾峰彇浼氬憳鍒嗛〉 澶嶇敤浜庤妗嗘灦寮�婧恆pi WX绔�
+     *
+     * @param customerQuery 浼氬憳鎼滅储
+     * @return 浼氬憳鍒嗛〉
+     */
+    Result getMemberPageByWX(CustomerQuery customerQuery);
     /**
      * 鑾峰彇浼氬憳鍒嗛〉 澶嶇敤浜庤妗嗘灦寮�婧恆pi
      *
diff --git a/framework/src/main/java/cn/lili/modules/lmk/service/impl/CustomerServiceImpl.java b/framework/src/main/java/cn/lili/modules/lmk/service/impl/CustomerServiceImpl.java
index a52ce67..2e198b1 100644
--- a/framework/src/main/java/cn/lili/modules/lmk/service/impl/CustomerServiceImpl.java
+++ b/framework/src/main/java/cn/lili/modules/lmk/service/impl/CustomerServiceImpl.java
@@ -2,6 +2,7 @@
 
 
 import cn.lili.base.Result;
+import cn.lili.common.security.context.UserContext;
 import cn.lili.modules.lmk.domain.query.CustomerQuery;
 import cn.lili.modules.lmk.mapper.CustomerMapper;
 import cn.lili.modules.lmk.mapper.LmkStoreMapper;
@@ -20,6 +21,8 @@
 import lombok.RequiredArgsConstructor;
 import org.springframework.stereotype.Service;
 
+import java.util.Objects;
+
 @Service
 @RequiredArgsConstructor
 public class CustomerServiceImpl extends ServiceImpl<MemberMapper, Member> implements CustomerService {
@@ -37,6 +40,17 @@
     }
 
     @Override
+    public Result getMemberPageByWX(CustomerQuery customerQuery) {
+        String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
+        if ( storeId == null) {
+            return Result.error("璇ヨ处鍙锋病鏈夋敞鍐屽簵閾�");
+        }
+        return getMemberPage(customerQuery);
+
+    }
+
+
+    @Override
     public MemberVO getMember(String id) {
         return null;
     }

--
Gitblit v1.8.0