From 91038896d296db86b5dc166777dcdbf8ff2ea56f Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期四, 07 五月 2026 16:03:02 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_New_pro' into dev_New_pro

---
 src/main/java/com/ruoyi/sales/pojo/SalesQuotation.java                                   |   35 +-
 src/main/java/com/ruoyi/basic/pojo/Customer.java                                         |    5 
 src/main/resources/mapper/basic/CustomerMapper.xml                                       |   93 +++++
 src/main/java/com/ruoyi/basic/service/impl/CustomerFollowUpServiceImpl.java              |    2 
 src/main/java/com/ruoyi/basic/service/impl/CustomerUserServiceImpl.java                  |   19 +
 src/main/java/com/ruoyi/basic/service/impl/CustomerServiceImpl.java                      |  211 +++++++++++-
 src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java                   |  194 ++++++++---
 src/main/java/com/ruoyi/sales/service/impl/SalesQuotationServiceImpl.java                |   15 
 src/main/java/com/ruoyi/basic/service/impl/CustomerReturnVisitServiceImpl.java           |    6 
 src/main/java/com/ruoyi/approve/service/impl/ApproveProcessServiceImpl.java              |    2 
 src/main/java/com/ruoyi/ai/tools/ApproveTodoTools.java                                   |    1 
 src/main/java/com/ruoyi/basic/pojo/CustomerUser.java                                     |   43 ++
 src/main/java/com/ruoyi/basic/mapper/CustomerMapper.java                                 |    7 
 src/main/java/com/ruoyi/staff/controller/PersonalAttendanceLocationConfigController.java |    9 
 src/main/java/com/ruoyi/basic/task/ReturnVisitReminderTask.java                          |    2 
 src/main/java/com/ruoyi/basic/vo/CustomerVo.java                                         |   28 +
 src/main/java/com/ruoyi/basic/service/ICustomerService.java                              |   25 +
 src/main/java/com/ruoyi/approve/service/impl/ApproveNodeServiceImpl.java                 |    8 
 src/main/java/com/ruoyi/basic/controller/CustomerFollowUpController.java                 |    2 
 /dev/null                                                                                |  101 ------
 src/main/java/com/ruoyi/basic/dto/CustomerDto.java                                       |    6 
 src/main/java/com/ruoyi/basic/mapper/CustomerUserMapper.java                             |   15 
 src/main/java/com/ruoyi/basic/pojo/CustomerFollowUp.java                                 |    2 
 src/main/java/com/ruoyi/basic/pojo/CustomerReturnVisit.java                              |    2 
 src/main/java/com/ruoyi/basic/controller/CustomerController.java                         |   79 +++-
 src/main/java/com/ruoyi/project/system/service/impl/UnipushService.java                  |    2 
 doc/create_table_customer_user.sql                                                       |   10 
 src/main/java/com/ruoyi/basic/service/CustomerUserService.java                           |   13 
 28 files changed, 670 insertions(+), 267 deletions(-)

diff --git a/doc/create_table_customer_user.sql b/doc/create_table_customer_user.sql
new file mode 100644
index 0000000..dacbfb4
--- /dev/null
+++ b/doc/create_table_customer_user.sql
@@ -0,0 +1,10 @@
+drop table if exists customer_user;
+create table customer_user
+(
+    id          bigint auto_increment
+        primary key,
+    customer_id bigint not null default 0 comment '瀹㈡埛id',
+    user_id     bigint not null default 0 comment '鐢ㄦ埛id',
+    create_time datetime null comment '褰曞叆鏃堕棿',
+    tenant_id   bigint not null default 0 comment '绉熸埛id'
+);
diff --git a/src/main/java/com/ruoyi/ai/tools/ApproveTodoTools.java b/src/main/java/com/ruoyi/ai/tools/ApproveTodoTools.java
index 233c459..cd3e933 100644
--- a/src/main/java/com/ruoyi/ai/tools/ApproveTodoTools.java
+++ b/src/main/java/com/ruoyi/ai/tools/ApproveTodoTools.java
@@ -707,6 +707,7 @@
             case 6 -> "鎶ヤ环瀹℃壒";
             case 7 -> "鍙戣揣瀹℃壒";
             case 8 -> "鍗遍櫓浣滀笟瀹℃壒";
+            case 9 -> "鍔炲叕鐢ㄥ搧瀹℃壒";
             default -> "绫诲瀷" + type;
         };
     }
diff --git a/src/main/java/com/ruoyi/approve/service/impl/ApproveNodeServiceImpl.java b/src/main/java/com/ruoyi/approve/service/impl/ApproveNodeServiceImpl.java
index 517f0c8..3caf7cf 100644
--- a/src/main/java/com/ruoyi/approve/service/impl/ApproveNodeServiceImpl.java
+++ b/src/main/java/com/ruoyi/approve/service/impl/ApproveNodeServiceImpl.java
@@ -301,6 +301,8 @@
                 return "鍙戣揣瀹℃壒";
             case 8:
                 return "鍗遍櫓浣滀笟瀹℃壒";
+            case 9:
+                return "鍔炲叕鐢ㄥ搧瀹℃壒";
         }
         return null;
     }
@@ -317,12 +319,12 @@
         qualityInspect.setUnit(saleProduct.getUnit());
         qualityInspect.setQuantity(saleProduct.getQuantity());
         qualityInspectMapper.insert(qualityInspect);
-        List<QualityTestStandard> qualityTestStandard = qualityTestStandardMapper.getQualityTestStandardByProductId(saleProduct.getProductId(), 0,null);
-        if (qualityTestStandard.size()>0){
+        List<QualityTestStandard> qualityTestStandard = qualityTestStandardMapper.getQualityTestStandardByProductId(saleProduct.getProductId(), 0, null);
+        if (qualityTestStandard.size() > 0) {
             qualityInspect.setTestStandardId(qualityTestStandard.get(0).getId());
             qualityInspectMapper.updateById(qualityInspect);
             qualityTestStandardParamMapper.selectList(Wrappers.<QualityTestStandardParam>lambdaQuery()
-                            .eq(QualityTestStandardParam::getTestStandardId,qualityTestStandard.get(0).getId()))
+                            .eq(QualityTestStandardParam::getTestStandardId, qualityTestStandard.get(0).getId()))
                     .forEach(qualityTestStandardParam -> {
                         QualityInspectParam param = new QualityInspectParam();
                         com.ruoyi.common.utils.bean.BeanUtils.copyProperties(qualityTestStandardParam, param);
diff --git a/src/main/java/com/ruoyi/approve/service/impl/ApproveProcessServiceImpl.java b/src/main/java/com/ruoyi/approve/service/impl/ApproveProcessServiceImpl.java
index b27019e..c8c6af0 100644
--- a/src/main/java/com/ruoyi/approve/service/impl/ApproveProcessServiceImpl.java
+++ b/src/main/java/com/ruoyi/approve/service/impl/ApproveProcessServiceImpl.java
@@ -449,6 +449,8 @@
                 return "鍙戣揣瀹℃壒";
             case 8:
                 return "鍗遍櫓浣滀笟瀹℃壒";
+            case 9:
+                return "鍔炲叕鐢ㄥ搧瀹℃壒";
         }
         return null;
     }
diff --git a/src/main/java/com/ruoyi/basic/controller/CustomerController.java b/src/main/java/com/ruoyi/basic/controller/CustomerController.java
index 9aa6570..9090d34 100644
--- a/src/main/java/com/ruoyi/basic/controller/CustomerController.java
+++ b/src/main/java/com/ruoyi/basic/controller/CustomerController.java
@@ -5,17 +5,17 @@
 import com.ruoyi.basic.dto.CustomerDto;
 import com.ruoyi.basic.pojo.Customer;
 import com.ruoyi.basic.service.ICustomerService;
+import com.ruoyi.basic.vo.CustomerVo;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.framework.aspectj.lang.annotation.Log;
 import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
 import com.ruoyi.framework.web.controller.BaseController;
-import com.ruoyi.framework.web.domain.AjaxResult;
 import com.ruoyi.framework.web.domain.R;
+import jakarta.servlet.http.HttpServletResponse;
 import lombok.AllArgsConstructor;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
-import jakarta.servlet.http.HttpServletResponse;
 import java.util.List;
 
 /**
@@ -35,7 +35,7 @@
      */
     @GetMapping("/list")
     public R list(Page<CustomerDto> page, CustomerDto customer) {
-        IPage<CustomerDto> customerDtoIPage = customerService.selectCustomerList(page, customer);
+        IPage<CustomerVo> customerDtoIPage = customerService.selectCustomerList(page, customer);
         return R.ok(customerDtoIPage);
     }
 
@@ -44,16 +44,9 @@
      */
     @Log(title = "瀹㈡埛妗f", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
-    public void export(HttpServletResponse response, Customer customer) {
-        Long[] ids = customer.getIds();
-        List<Customer> list;
-        if (ids != null && ids.length > 0) {
-            list = customerService.selectCustomerListByIds(ids);
-        } else {
-            list = customerService.selectCustomerLists(customer);
-        }
-        ExcelUtil<Customer> util = new ExcelUtil<Customer>(Customer.class);
-        util.exportExcel(response, list, "瀹㈡埛妗f鏁版嵁");
+    public void export(HttpServletResponse response, CustomerDto customer) {
+        ExcelUtil<CustomerVo> util = new ExcelUtil<CustomerVo>(CustomerVo.class);
+        util.exportExcel(response, customerService.selectCustomerLists(customer), "瀹㈡埛妗f鏁版嵁");
     }
 
     @PostMapping("/downloadTemplate")
@@ -69,17 +62,17 @@
      */
     @Log(title = "瀹㈡埛妗f", businessType = BusinessType.IMPORT)
     @PostMapping("/importData")
-    public AjaxResult importData(MultipartFile file) throws Exception {
+    public R importData(MultipartFile file, Integer type) throws Exception {
 
-        return customerService.importData(file);
+        return customerService.importData(file, type);
     }
 
     /**
      * 鑾峰彇瀹㈡埛妗f璇︾粏淇℃伅
      */
     @GetMapping(value = "/{id}")
-    public AjaxResult getInfo(@PathVariable("id") Long id) {
-        return success(customerService.selectCustomerDetailById(id));
+    public R getInfo(@PathVariable("id") Long id) {
+        return R.ok(customerService.selectCustomerDetailById(id));
     }
 
     /**
@@ -87,8 +80,8 @@
      */
     @Log(title = "瀹㈡埛妗f", businessType = BusinessType.INSERT)
     @PostMapping("/addCustomer")
-    public AjaxResult add(@RequestBody Customer customer) {
-        return toAjax(customerService.insertCustomer(customer));
+    public R add(@RequestBody Customer customer) {
+        return R.ok(customerService.insertCustomer(customer));
     }
 
     /**
@@ -96,8 +89,8 @@
      */
     @Log(title = "瀹㈡埛妗f", businessType = BusinessType.UPDATE)
     @PostMapping("/updateCustomer")
-    public AjaxResult edit(@RequestBody Customer customer) {
-        return toAjax(customerService.updateCustomer(customer));
+    public R edit(@RequestBody Customer customer) {
+        return R.ok(customerService.updateCustomer(customer));
     }
 
     /**
@@ -105,11 +98,11 @@
      */
     @Log(title = "瀹㈡埛妗f", businessType = BusinessType.DELETE)
     @DeleteMapping("/delCustomer")
-    public AjaxResult remove(@RequestBody Long[] ids) {
+    public R remove(@RequestBody Long[] ids) {
         if (ids == null || ids.length == 0) {
-            return AjaxResult.error("璇蜂紶鍏ヨ鍒犻櫎鐨処D");
+            return R.fail("璇蜂紶鍏ヨ鍒犻櫎鐨処D");
         }
-        return toAjax(customerService.deleteCustomerByIds(ids));
+        return R.ok(customerService.deleteCustomerByIds(ids));
     }
 
     /**
@@ -121,4 +114,42 @@
     }
 
 
+    /**
+     * 鍒嗛厤瀹㈡埛
+     */
+    @Log(title = "瀹㈡埛妗f", businessType = BusinessType.OTHER)
+    @PostMapping("/assignCustomer")
+    public R assignCustomer(@RequestBody CustomerDto customer) {
+        customerService.assignCustomer(customer);
+        return R.ok();
+    }
+
+    /**
+     * 鍥炴敹瀹㈡埛
+     */
+    @Log(title = "瀹㈡埛妗f", businessType = BusinessType.OTHER)
+    @PostMapping("/recycleCustomer")
+    public R recycleCustomer(@RequestBody CustomerDto customer) {
+        customerService.recycleCustomer(customer);
+        return R.ok();
+    }
+
+    /**
+     * 鍏变韩瀹㈡埛
+     */
+    @Log(title = "瀹㈡埛妗f", businessType = BusinessType.OTHER)
+    @PostMapping("/together")
+    public R together(@RequestBody CustomerDto customer) {
+        customerService.together(customer);
+        return R.ok();
+    }
+
+    /**
+     * 绉佹捣瀹㈡埛娴佸洖鍏捣
+     */
+    @Log(title = "瀹㈡埛妗f", businessType = BusinessType.OTHER)
+    @PostMapping("/back")
+    public R back(Long id) {
+        return R.ok(customerService.back(id));
+    }
 }
diff --git a/src/main/java/com/ruoyi/basic/controller/CustomerFollowUpController.java b/src/main/java/com/ruoyi/basic/controller/CustomerFollowUpController.java
index 70b109e..a5dcc83 100644
--- a/src/main/java/com/ruoyi/basic/controller/CustomerFollowUpController.java
+++ b/src/main/java/com/ruoyi/basic/controller/CustomerFollowUpController.java
@@ -44,7 +44,7 @@
     @Operation(summary = "鏌ヨ瀹㈡埛璺熻繘鍒楄〃")
     public IPage<CustomerFollowUp> list(Page<CustomerFollowUp> page, CustomerFollowUp customerFollowUp) {
         LambdaQueryWrapper<CustomerFollowUp> queryWrapper = new LambdaQueryWrapper<>();
-        queryWrapper.eq(customerFollowUp.getCustomerPrivatePoolId() != null, CustomerFollowUp::getCustomerPrivatePoolId, customerFollowUp.getCustomerPrivatePoolId())
+        queryWrapper.eq(customerFollowUp.getCustomerId() != null, CustomerFollowUp::getCustomerId, customerFollowUp.getCustomerId())
                 .like(customerFollowUp.getFollowerUserName() != null, CustomerFollowUp::getFollowerUserName, customerFollowUp.getFollowerUserName())
                 .orderByDesc(CustomerFollowUp::getFollowUpTime);
         return customerFollowUpService.page(page, queryWrapper);
diff --git a/src/main/java/com/ruoyi/basic/controller/CustomerPrivateController.java b/src/main/java/com/ruoyi/basic/controller/CustomerPrivateController.java
deleted file mode 100644
index 67b1755..0000000
--- a/src/main/java/com/ruoyi/basic/controller/CustomerPrivateController.java
+++ /dev/null
@@ -1,80 +0,0 @@
-package com.ruoyi.basic.controller;
-
-import com.ruoyi.basic.dto.CustomerPrivateDto;
-import com.ruoyi.basic.dto.CustomerPrivatePoolDto;
-import com.ruoyi.basic.service.CustomerPrivatePoolService;
-import com.ruoyi.basic.service.CustomerPrivateService;
-import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.framework.aspectj.lang.annotation.Log;
-import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
-import com.ruoyi.framework.web.domain.R;
-import jakarta.servlet.http.HttpServletResponse;
-import lombok.AllArgsConstructor;
-import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-
-import java.util.List;
-
-/**
- * <p>
- * 瀹㈡埛妗f 鍓嶇鎺у埗鍣�
- * </p>
- *
- * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
- * @since 2026-04-17 10:39:09
- */
-@RestController
-@RequestMapping("/customerPrivate")
-@AllArgsConstructor
-public class CustomerPrivateController {
-    private final CustomerPrivateService customerPrivateService;
-
-    private final CustomerPrivatePoolService customerPrivatePoolService;
-
-
-    @PostMapping("/add")
-    public R add(@RequestBody CustomerPrivateDto customerPrivateDto) {
-        return R.ok(customerPrivateService.add(customerPrivateDto));
-    }
-
-
-    @DeleteMapping("/delete")
-    public R delete(@RequestBody List<Long> ids) {
-        return R.ok(customerPrivateService.delete(ids));
-    }
-
-
-    /**
-     * 瀵煎叆瀹㈡埛妗f
-     */
-    @Log(title = "瀹㈡埛妗f", businessType = BusinessType.IMPORT)
-    @PostMapping("/importData")
-    public R importData(MultipartFile file) throws Exception {
-
-        return customerPrivateService.importData(file);
-    }
-
-    /**
-     * 瀵煎嚭瀹㈡埛妗f鍒楄〃
-     */
-    @Log(title = "瀹㈡埛妗f", businessType = BusinessType.EXPORT)
-    @PostMapping("/export")
-    public void export(HttpServletResponse response, CustomerPrivatePoolDto customerPrivatePoolDto) {
-        List<Long> ids = customerPrivatePoolDto.getIds();
-        List<CustomerPrivatePoolDto> list;
-        if (ids != null && ids.size() > 0) {
-            list = customerPrivatePoolService.selectCustomerPrivatePoolDtoListByIds(ids);
-        } else {
-            list = customerPrivatePoolService.selectCustomerPrivatePoolDtoLists(customerPrivatePoolDto);
-        }
-        ExcelUtil<CustomerPrivatePoolDto> util = new ExcelUtil<CustomerPrivatePoolDto>(CustomerPrivatePoolDto.class);
-        util.exportExcel(response, list, "瀹㈡埛妗f鏁版嵁");
-    }
-
-    @PostMapping("/downloadTemplate")
-    @Log(title = "瀹㈡埛妗f-涓嬭浇妯℃澘", businessType = BusinessType.EXPORT)
-    public void downloadTemplate(HttpServletResponse response) {
-        ExcelUtil<CustomerPrivatePoolDto> util = new ExcelUtil<CustomerPrivatePoolDto>(CustomerPrivatePoolDto.class);
-        util.importTemplateExcel(response, "瀹㈡埛妗f妯℃澘");
-    }
-}
diff --git a/src/main/java/com/ruoyi/basic/controller/CustomerPrivatePoolController.java b/src/main/java/com/ruoyi/basic/controller/CustomerPrivatePoolController.java
deleted file mode 100644
index 83597cf..0000000
--- a/src/main/java/com/ruoyi/basic/controller/CustomerPrivatePoolController.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package com.ruoyi.basic.controller;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.basic.dto.CustomerPrivatePoolDto;
-import com.ruoyi.basic.service.CustomerPrivatePoolService;
-import com.ruoyi.common.utils.SecurityUtils;
-import com.ruoyi.framework.web.domain.R;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import io.swagger.v3.oas.annotations.Operation;
-import lombok.AllArgsConstructor;
-import org.springframework.web.bind.annotation.*;
-
-/**
- * <p>
- *  鍓嶇鎺у埗鍣� 瀹㈡埛锛堢娴凤級
- * </p>
- *
- * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
- * @since 2026-04-16 04:43:00
- */
-@RestController
-@Tag(name = "瀹㈡埛锛堢娴凤級")
-@RequestMapping("/customerPrivatePool")
-@AllArgsConstructor
-public class CustomerPrivatePoolController {
-
-    private final CustomerPrivatePoolService customerPrivatePoolService;
-
-
-    @GetMapping("/listPage")
-    @Operation(summary = "瀹㈡埛锛堢娴凤級鍒楄〃")
-    public R listPage(CustomerPrivatePoolDto customerPrivatePoolDto, Page<CustomerPrivatePoolDto> page){
-        //鏌ヨ褰撳墠鐢ㄦ埛鐨勫鎴蜂俊鎭�
-        customerPrivatePoolDto.setBoundId(SecurityUtils.getUserId());
-        IPage<CustomerPrivatePoolDto> listPage = customerPrivatePoolService.listPage(page, customerPrivatePoolDto);
-        return R.ok(listPage);
-    }
-
-    @PostMapping("/add")
-    @Operation(summary = "鍒嗛厤瀹㈡埛锛堢娴凤級")
-    public R add(@RequestBody CustomerPrivatePoolDto customerPrivatePool){
-        boolean result = customerPrivatePoolService.add(customerPrivatePool);
-        return R.ok(result);
-    }
-
-    @PutMapping("/update")
-    public R update(@RequestBody CustomerPrivatePoolDto customerPrivatePoolDto) {
-        return R.ok(customerPrivatePoolService.updateCustomerPrivatePoolDto(customerPrivatePoolDto));
-    }
-
-
-    @DeleteMapping("/delete/{id}")
-    @Operation(summary = "鍒犻櫎瀹㈡埛锛堢娴凤級")
-    public R delete(@PathVariable Long id){
-        boolean result = customerPrivatePoolService.deleteCustomerPrivatePool(id);
-        return R.ok(result);
-    }
-
-    @PostMapping("/together")
-    @Operation(summary = "鍏变韩")
-    public R together( @RequestBody CustomerPrivatePoolDto customerPrivatePool){
-        boolean result = customerPrivatePoolService.together(customerPrivatePool);
-        return R.ok(result);
-    }
-
-    @GetMapping("/info/{id}")
-    @Operation(summary = "璇︽儏")
-    public R getInfo(@PathVariable Long id){
-        CustomerPrivatePoolDto customerPrivatePool = customerPrivatePoolService.getInfo(id);
-        return R.ok(customerPrivatePool);
-    }
-
-    @GetMapping("/getbyId/{id}")
-    @Operation(summary = "璇︽儏")
-    public R getbyId(@PathVariable Long id){
-        CustomerPrivatePoolDto customerPrivatePool = customerPrivatePoolService.getbyId(id);
-        return R.ok(customerPrivatePool);
-    }
-
-
-
-
-
-}
diff --git a/src/main/java/com/ruoyi/basic/dto/CustomerDto.java b/src/main/java/com/ruoyi/basic/dto/CustomerDto.java
index 630119f..d75de55 100644
--- a/src/main/java/com/ruoyi/basic/dto/CustomerDto.java
+++ b/src/main/java/com/ruoyi/basic/dto/CustomerDto.java
@@ -25,4 +25,8 @@
 
     private String togetherUserNames;
 
-}
+    /**
+     * 鍏变韩鐢ㄦ埛ID鍒楄〃
+     */
+    private List<Long> userIds;
+}
\ No newline at end of file
diff --git a/src/main/java/com/ruoyi/basic/dto/CustomerPrivateDto.java b/src/main/java/com/ruoyi/basic/dto/CustomerPrivateDto.java
deleted file mode 100644
index c06ad62..0000000
--- a/src/main/java/com/ruoyi/basic/dto/CustomerPrivateDto.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.ruoyi.basic.dto;
-
-import com.ruoyi.basic.pojo.CustomerPrivate;
-import lombok.Data;
-
-import java.util.List;
-
-@Data
-public class CustomerPrivateDto extends CustomerPrivate {
-
-    private List<CustomerFollowUpDto> followUpList;
-}
diff --git a/src/main/java/com/ruoyi/basic/dto/CustomerPrivatePoolDto.java b/src/main/java/com/ruoyi/basic/dto/CustomerPrivatePoolDto.java
deleted file mode 100644
index e452a24..0000000
--- a/src/main/java/com/ruoyi/basic/dto/CustomerPrivatePoolDto.java
+++ /dev/null
@@ -1,124 +0,0 @@
-package com.ruoyi.basic.dto;
-
-import com.baomidou.mybatisplus.annotation.FieldFill;
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import com.ruoyi.basic.pojo.CustomerFollowUp;
-import com.ruoyi.basic.pojo.CustomerPrivatePool;
-import com.ruoyi.framework.aspectj.lang.annotation.Excel;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-import org.springframework.format.annotation.DateTimeFormat;
-
-import java.util.Date;
-import java.util.List;
-
-@Data
-public class CustomerPrivatePoolDto extends CustomerPrivatePool {
-
-    /**
-     * 瀹㈡埛鍚嶇О
-     */
-    @Excel(name = "瀹㈡埛鍚嶇О")
-    private String customerName;
-    /** 瀹㈡埛鍒嗙被锛氶浂鍞鎴凤紝杩涢攢鍟嗗鎴� */
-
-    @Schema(description = "瀹㈡埛瑕乮d")
-    private Long customerId;
-
-    /**
-     * 璺熻繘绋嬪害
-     */
-//    @Excel(name = "璺熻繘绋嬪害")
-    @TableField(exist = false)
-    private String followUpLevel;
-
-    /**
-     * 璺熻繘鏃堕棿
-     */
-//    @Excel(name = "璺熻繘鏃堕棿" , width = 30, dateFormat = "yyyy-MM-dd")
-    @TableField(exist = false)
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    private Date followUpTime;
-
-    @Excel(name = "瀹㈡埛鍒嗙被")
-    private String customerType;
-
-
-    private  String addressPhone;
-    /**
-     * 绾崇◣浜鸿瘑鍒彿
-     */
-    @Excel(name = "绾崇◣浜鸿瘑鍒彿")
-    private String taxpayerIdentificationNumber;
-
-    /**
-     * 鍏徃鍦板潃
-     */
-    @Excel(name = "鍏徃鍦板潃")
-    private String companyAddress;
-
-    /**
-     * 鍏徃鐢佃瘽
-     */
-    @Excel(name = "鍏徃鐢佃瘽")
-    private String companyPhone;
-
-    /**
-     * 鑱旂郴浜�
-     */
-    @Excel(name = "鑱旂郴浜�")
-    private String contactPerson;
-
-    /**
-     * 鑱旂郴鐢佃瘽
-     */
-    @Excel(name = "鑱旂郴鐢佃瘽",cellType = Excel.ColumnType.STRING)
-    private String contactPhone;
-
-    /**
-     * 缁存姢浜�
-     */
-    @Excel(name = "缁存姢浜�")
-    private String maintainer;
-
-    /**
-     * 缁存姢鏃堕棿
-     */
-    @JsonFormat(pattern = "yyyy-MM-dd")
-    @Excel(name = "缁存姢鏃堕棿" , width = 30, dateFormat = "yyyy-MM-dd")
-    private Date maintenanceTime;
-
-    @TableField(fill = FieldFill.INSERT)
-    private Long tenantId;
-
-    @Schema(description = "閾惰鍩烘湰鎴�")
-    @Excel(name = "閾惰鍩烘湰鎴�")
-    private String basicBankAccount;
-
-    @Schema(description = "閾惰璐﹀彿")
-    @Excel(name = "閾惰璐﹀彿")
-    private String bankAccount;
-
-    @Schema(description = "寮�鎴疯鍙�")
-    @Excel(name = "寮�鎴疯鍙�")
-    private String bankCode;
-    @Schema(description = "鍒涘缓鐢ㄦ埛")
-    @TableField(fill = FieldFill.INSERT)
-    private Integer createUser;
-
-
-    @Schema(description = "璺熻繘璁板綍")
-    private List<CustomerFollowUpDto> followUpList;
-
-    @Schema(description = "缁戝畾浜篿ds")
-    private List< Long> boundIds;
-
-    @Excel(isExport = false)
-    private List<Long> ids;
-
-
-}
diff --git a/src/main/java/com/ruoyi/basic/mapper/CustomerMapper.java b/src/main/java/com/ruoyi/basic/mapper/CustomerMapper.java
index ac86398..2605737 100644
--- a/src/main/java/com/ruoyi/basic/mapper/CustomerMapper.java
+++ b/src/main/java/com/ruoyi/basic/mapper/CustomerMapper.java
@@ -5,6 +5,7 @@
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ruoyi.basic.dto.CustomerDto;
 import com.ruoyi.basic.pojo.Customer;
+import com.ruoyi.basic.vo.CustomerVo;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -67,5 +68,7 @@
      */
     int deleteCustomerByIds(Long[] ids);
 
-    IPage<CustomerDto> listPage(Page<CustomerDto> page, @Param("c") CustomerDto customer);
-}
+    IPage<CustomerVo> listPage(Page<CustomerDto> page, @Param("c") CustomerDto customer, @Param("loginUserId") Long loginUserId);
+
+    List<CustomerVo> list(@Param("c") CustomerDto customer, @Param("loginUserId") Long loginUserId);
+}
\ No newline at end of file
diff --git a/src/main/java/com/ruoyi/basic/mapper/CustomerPrivateMapper.java b/src/main/java/com/ruoyi/basic/mapper/CustomerPrivateMapper.java
deleted file mode 100644
index 4f1bf6d..0000000
--- a/src/main/java/com/ruoyi/basic/mapper/CustomerPrivateMapper.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.ruoyi.basic.mapper;
-
-import com.ruoyi.basic.pojo.CustomerPrivate;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import org.apache.ibatis.annotations.Mapper;
-
-/**
- * <p>
- * 瀹㈡埛妗f Mapper 鎺ュ彛
- * </p>
- *
- * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
- * @since 2026-04-17 10:39:09
- */
-@Mapper
-public interface CustomerPrivateMapper extends BaseMapper<CustomerPrivate> {
-
-}
diff --git a/src/main/java/com/ruoyi/basic/mapper/CustomerPrivatePoolMapper.java b/src/main/java/com/ruoyi/basic/mapper/CustomerPrivatePoolMapper.java
deleted file mode 100644
index 4c6f325..0000000
--- a/src/main/java/com/ruoyi/basic/mapper/CustomerPrivatePoolMapper.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.ruoyi.basic.mapper;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.ruoyi.basic.dto.CustomerPrivatePoolDto;
-import com.ruoyi.basic.pojo.CustomerPrivatePool;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import org.apache.ibatis.annotations.Mapper;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-
-/**
- * <p>
- *  Mapper 鎺ュ彛
- * </p>
- *
- * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
- * @since 2026-04-16 04:43:00
- */
-@Mapper
-public interface CustomerPrivatePoolMapper extends BaseMapper<CustomerPrivatePool> {
-
-    IPage<CustomerPrivatePoolDto> listPage(IPage<CustomerPrivatePoolDto> page, @Param("c") CustomerPrivatePoolDto customerPrivatePoolDto);
-
-    CustomerPrivatePoolDto selectInfo(Long id);
-
-    List<CustomerPrivatePoolDto> selectInfos();
-
-}
diff --git a/src/main/java/com/ruoyi/basic/mapper/CustomerUserMapper.java b/src/main/java/com/ruoyi/basic/mapper/CustomerUserMapper.java
new file mode 100644
index 0000000..84aebac
--- /dev/null
+++ b/src/main/java/com/ruoyi/basic/mapper/CustomerUserMapper.java
@@ -0,0 +1,15 @@
+package com.ruoyi.basic.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.basic.pojo.CustomerUser;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 瀹㈡埛鍏变韩Mapper鎺ュ彛
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @date 2026-04-29
+ */
+@Mapper
+public interface CustomerUserMapper extends BaseMapper<CustomerUser> {
+}
diff --git a/src/main/java/com/ruoyi/basic/pojo/Customer.java b/src/main/java/com/ruoyi/basic/pojo/Customer.java
index 1b47163..6a8e302 100644
--- a/src/main/java/com/ruoyi/basic/pojo/Customer.java
+++ b/src/main/java/com/ruoyi/basic/pojo/Customer.java
@@ -129,4 +129,9 @@
     @Schema(description = "浣跨敤鐘舵��")
     private Long usageStatus;
 
+    @Schema(description = "绫诲瀷 0 绉佹捣瀹㈡埛 1 鍏捣瀹㈡埛")
+    private Integer type;
+
+    @Schema(description = "鏄惁琚垎閰嶏細0-鏈垎閰嶏紝1-宸插垎閰�")
+    private Integer isAssigned;
 }
diff --git a/src/main/java/com/ruoyi/basic/pojo/CustomerFollowUp.java b/src/main/java/com/ruoyi/basic/pojo/CustomerFollowUp.java
index 9f34f61..5d9dfe3 100644
--- a/src/main/java/com/ruoyi/basic/pojo/CustomerFollowUp.java
+++ b/src/main/java/com/ruoyi/basic/pojo/CustomerFollowUp.java
@@ -37,7 +37,7 @@
     /**
      * 鍏宠仈鐨勭娴穒d
      */
-    private Long customerPrivatePoolId;
+    private Long customerId;
 
     /**
      * 璺熻繘鏂瑰紡
diff --git a/src/main/java/com/ruoyi/basic/pojo/CustomerPrivate.java b/src/main/java/com/ruoyi/basic/pojo/CustomerPrivate.java
deleted file mode 100644
index 87f2cc6..0000000
--- a/src/main/java/com/ruoyi/basic/pojo/CustomerPrivate.java
+++ /dev/null
@@ -1,114 +0,0 @@
-package com.ruoyi.basic.pojo;
-
-import com.baomidou.mybatisplus.annotation.FieldFill;
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import java.io.Serializable;
-import java.time.LocalDate;
-import java.util.Date;
-
-import com.fasterxml.jackson.annotation.JsonFormat;
-import com.ruoyi.framework.aspectj.lang.annotation.Excel;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Getter;
-import lombok.Setter;
-
-/**
- * <p>
- * 瀹㈡埛妗f
- * </p>
- *
- * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
- * @since 2026-04-17 10:39:09
- */
-@Getter
-@Setter
-@TableName("customer_private")
-@Schema(name = "CustomerPrivate瀵硅薄", description = "瀹㈡埛妗f")
-public class CustomerPrivate implements Serializable {
-
-    private static final long serialVersionUID = 1L;
-
-    @TableId(value = "id", type = IdType.AUTO)
-    private Long id;
-
-    @Schema(description = "瀹㈡埛鍚嶇О")
-    @Excel(name = "瀹㈡埛鍚嶇О")
-    private String customerName;
-
-    @Schema(description = "绾崇◣浜鸿瘑鍒彿")
-    @Excel(name = "绾崇◣浜鸿瘑鍒彿")
-    private String taxpayerIdentificationNumber;
-
-    @Schema(description = "鍏徃鍦板潃")
-    @Excel(name = "鍏徃鍦板潃")
-    private String companyAddress;
-
-    @Schema(description = "鍏徃鐢佃瘽")
-    @Excel(name = "鍏徃鐢佃瘽")
-    private String companyPhone;
-
-    @Schema(description = "鑱旂郴浜�")
-    @Excel(name = "鑱旂郴浜�")
-    private String contactPerson;
-
-    @Schema(description = "鑱旂郴鐢佃瘽")
-    @Excel(name = "鑱旂郴鐢佃瘽", cellType = Excel.ColumnType.STRING)
-    private String contactPhone;
-
-    @Schema(description = "缁存姢浜�")
-    @Excel(name = "缁存姢浜�")
-    private String maintainer;
-
-    @Schema(description = "缁存姢鏃堕棿")
-    @JsonFormat(pattern = "yyyy-MM-dd")
-    @Excel(name = "缁存姢鏃堕棿", width = 30, dateFormat = "yyyy-MM-dd")
-    private Date maintenanceTime;
-
-    @Schema(description = "绉熸埛ID")
-    @TableField(fill = FieldFill.INSERT)
-    private Long tenantId;
-
-    @Schema(description = "閾惰鍩烘湰鎴�")
-    @Excel(name = "閾惰鍩烘湰鎴�")
-    private String basicBankAccount;
-
-    @Schema(description = "閾惰璐﹀彿")
-    @Excel(name = "閾惰璐﹀彿")
-    private String bankAccount;
-
-    @Schema(description = "寮�鎴疯鍙�")
-    @Excel(name = "寮�鎴疯鍙�")
-    private String bankCode;
-
-    @Schema(description = "瀹㈡埛鍒嗙被锛氶浂鍞鎴凤紝杩涢攢鍟嗗鎴�")
-    @Excel(name = "瀹㈡埛鍒嗙被")
-    private String customerType;
-
-    @Schema(description = "鍒涘缓浜篒D")
-    @TableField(fill = FieldFill.INSERT)
-    private Long createUser;
-
-    @Schema(description = "閮ㄩ棬ID")
-    @TableField(fill = FieldFill.INSERT)
-    private Long deptId;
-
-
-    @Schema(description = "璺熻繘绋嬪害")
-    @TableField(exist = false)
-    private String followUpLevel;
-
-    @Schema(description = "璺熻繘鏃堕棿")
-    @TableField(exist = false)
-    private Date followUpTime;
-
-
-    @TableField(exist = false)
-    private Long[] ids;
-
-    @TableField(exist = false)
-    private String addressPhone;
-
-}
diff --git a/src/main/java/com/ruoyi/basic/pojo/CustomerPrivatePool.java b/src/main/java/com/ruoyi/basic/pojo/CustomerPrivatePool.java
deleted file mode 100644
index 86dfc5a..0000000
--- a/src/main/java/com/ruoyi/basic/pojo/CustomerPrivatePool.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package com.ruoyi.basic.pojo;
-
-import com.baomidou.mybatisplus.annotation.FieldFill;
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import java.io.Serializable;
-import java.time.LocalDateTime;
-
-import com.ruoyi.framework.aspectj.lang.annotation.Excel;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-import lombok.Getter;
-import lombok.Setter;
-
-/**
- * <p>
- * 
- * </p>
- *
- * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
- * @since 2026-04-16 04:43:00
- */
-@Data
-@TableName("customer_private_pool")
-@Schema(name = "CustomerPrivatePool瀵硅薄", description = "")
-public class CustomerPrivatePool implements Serializable {
-
-    private static final long serialVersionUID = 1L;
-
-    @Schema(description = "涓婚敭id")
-    @TableId(value = "id", type = IdType.AUTO)
-    private Long id;
-
-    @Schema(description = "瀹㈡埛id")
-    private Long customerId;
-
-    @Schema(description = "缁戝畾浜篿d")
-    private Long boundId;
-
-    @Schema(description = "鍒涘缓浜�")
-    @TableField(fill = FieldFill.INSERT)
-    private Integer createUser;
-
-    @Schema(description = "鏇存柊浜�")
-    @TableField(fill = FieldFill.INSERT_UPDATE)
-    private Integer updateUser;
-
-    @Schema(description = "鍒涘缓鏃堕棿")
-    @TableField(fill = FieldFill.INSERT)
-    private LocalDateTime createTime;
-
-    @Schema(description = "鏇存柊鏃堕棿")
-    @TableField(fill = FieldFill.INSERT_UPDATE)
-    private LocalDateTime updateTime;
-
-    @Schema(description = "绫诲瀷鍖哄垎鍏捣瀹㈡埛鍜岀娴峰鎴� 榛樿鏄娴峰鎴�0 鍏捣1")
-    private Long type;
-
-    @Schema(description = "閮ㄩ棬id")
-    @TableField(fill = FieldFill.INSERT)
-    private Long deptId;
-
-    @Schema(description = "鍒犻櫎鏍囪瘑 榛樿0 1宸茬粡鍒犻櫎")
-    private Integer DeleteFlag;
-}
diff --git a/src/main/java/com/ruoyi/basic/pojo/CustomerReturnVisit.java b/src/main/java/com/ruoyi/basic/pojo/CustomerReturnVisit.java
index f2edcc5..ddd3d4b 100644
--- a/src/main/java/com/ruoyi/basic/pojo/CustomerReturnVisit.java
+++ b/src/main/java/com/ruoyi/basic/pojo/CustomerReturnVisit.java
@@ -36,7 +36,7 @@
     /**
      * 鍏宠仈瀹㈡埛ID
      */
-    private Integer customerPrivatePoolId;
+    private Long customerId;
 
     /**
      * 鎻愰啋寮�鍏� (0:鍏抽棴, 1:寮�鍚�)
diff --git a/src/main/java/com/ruoyi/basic/pojo/CustomerUser.java b/src/main/java/com/ruoyi/basic/pojo/CustomerUser.java
new file mode 100644
index 0000000..901b0ce
--- /dev/null
+++ b/src/main/java/com/ruoyi/basic/pojo/CustomerUser.java
@@ -0,0 +1,43 @@
+package com.ruoyi.basic.pojo;
+
+import com.baomidou.mybatisplus.annotation.*;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+@TableName(value = "customer_user")
+@Data
+public class CustomerUser implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 搴忓彿
+     */
+    @TableId(type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 瀹㈡埛id
+     */
+    private Long customerId;
+
+    /**
+     * 鐢ㄦ埛id
+     */
+    private Long userId;
+
+    /**
+     * 绉熸埛id
+     */
+    @TableField(fill = FieldFill.INSERT)
+    private Long tenantId;
+
+    /**
+     * 褰曞叆鏃堕棿
+     */
+    @ApiModelProperty(value = "鍒涘缓鏃堕棿")
+    @TableField(fill = FieldFill.INSERT)
+    private LocalDateTime createTime;
+}
diff --git a/src/main/java/com/ruoyi/basic/service/CustomerPrivatePoolService.java b/src/main/java/com/ruoyi/basic/service/CustomerPrivatePoolService.java
deleted file mode 100644
index 18ca371..0000000
--- a/src/main/java/com/ruoyi/basic/service/CustomerPrivatePoolService.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package com.ruoyi.basic.service;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.basic.dto.CustomerPrivatePoolDto;
-import com.ruoyi.basic.pojo.Customer;
-import com.ruoyi.basic.pojo.CustomerPrivatePool;
-import com.baomidou.mybatisplus.extension.service.IService;
-
-import java.util.List;
-
-/**
- * <p>
- *  鏈嶅姟绫�
- * </p>
- *
- * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
- * @since 2026-04-16 04:43:00
- */
-public interface CustomerPrivatePoolService extends IService<CustomerPrivatePool> {
-
-    IPage<CustomerPrivatePoolDto> listPage(Page<CustomerPrivatePoolDto> page, CustomerPrivatePoolDto customerPrivatePoolDto);
-
-    boolean deleteCustomerPrivatePool(Long id);
-
-    boolean together(CustomerPrivatePoolDto customerPrivatePool);
-
-    boolean add(CustomerPrivatePoolDto customerPrivatePool);
-
-    CustomerPrivatePoolDto getInfo(Long id);
-
-    Boolean updateCustomerPrivatePoolDto(CustomerPrivatePoolDto customerPrivatePoolDto);
-
-    CustomerPrivatePoolDto getbyId(Long id);
-
-    List<CustomerPrivatePoolDto> selectCustomerPrivatePoolDtoListByIds(List<Long> ids);
-
-    List<CustomerPrivatePoolDto> selectCustomerPrivatePoolDtoLists(CustomerPrivatePoolDto customerPrivatePoolDto);
-}
diff --git a/src/main/java/com/ruoyi/basic/service/CustomerPrivateService.java b/src/main/java/com/ruoyi/basic/service/CustomerPrivateService.java
deleted file mode 100644
index e758157..0000000
--- a/src/main/java/com/ruoyi/basic/service/CustomerPrivateService.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.ruoyi.basic.service;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.basic.dto.CustomerPrivateDto;
-import com.ruoyi.basic.dto.CustomerPrivatePoolDto;
-import com.ruoyi.basic.pojo.Customer;
-import com.ruoyi.basic.pojo.CustomerPrivate;
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.ruoyi.framework.web.domain.AjaxResult;
-import com.ruoyi.framework.web.domain.R;
-import org.springframework.web.multipart.MultipartFile;
-
-import java.util.List;
-
-/**
- * <p>
- * 瀹㈡埛妗f 鏈嶅姟绫�
- * </p>
- *
- * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
- * @since 2026-04-17 10:39:09
- */
-public interface CustomerPrivateService extends IService<CustomerPrivate> {
-
-
-    Boolean add(CustomerPrivateDto customerPrivateDto);
-
-
-    Integer delete(List<Long> id);
-
-    R importData(MultipartFile file);
-}
diff --git a/src/main/java/com/ruoyi/basic/service/CustomerUserService.java b/src/main/java/com/ruoyi/basic/service/CustomerUserService.java
new file mode 100644
index 0000000..eda5f8e
--- /dev/null
+++ b/src/main/java/com/ruoyi/basic/service/CustomerUserService.java
@@ -0,0 +1,13 @@
+package com.ruoyi.basic.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.basic.pojo.CustomerUser;
+
+/**
+ * 瀹㈡埛鍏变韩Service鎺ュ彛
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @date 2026-04-29
+ */
+public interface CustomerUserService extends IService<CustomerUser> {
+}
\ No newline at end of file
diff --git a/src/main/java/com/ruoyi/basic/service/ICustomerService.java b/src/main/java/com/ruoyi/basic/service/ICustomerService.java
index c27dd92..b725216 100644
--- a/src/main/java/com/ruoyi/basic/service/ICustomerService.java
+++ b/src/main/java/com/ruoyi/basic/service/ICustomerService.java
@@ -4,9 +4,9 @@
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.ruoyi.basic.dto.CustomerDto;
-import com.ruoyi.basic.dto.CustomerPrivatePoolDto;
 import com.ruoyi.basic.pojo.Customer;
-import com.ruoyi.framework.web.domain.AjaxResult;
+import com.ruoyi.basic.vo.CustomerVo;
+import com.ruoyi.framework.web.domain.R;
 import org.springframework.web.multipart.MultipartFile;
 
 import java.util.List;
@@ -33,7 +33,7 @@
      * @param id 瀹㈡埛妗f涓婚敭
      * @return 瀹㈡埛璇︽儏DTO
      */
-    Customer selectCustomerDetailById(Long id);
+    CustomerVo selectCustomerDetailById(Long id);
 
     /**
      * 鏌ヨ瀹㈡埛妗f鍒楄〃
@@ -75,9 +75,22 @@
      */
     List<Map<String, Object>> customerList(Customer customer);
 
-    List<Customer> selectCustomerLists(Customer customer);
+    List<CustomerVo> selectCustomerLists(CustomerDto customer);
 
-    AjaxResult importData(MultipartFile file);
+    R importData(MultipartFile file, Integer type);
 
-    IPage<CustomerDto> selectCustomerList(Page<CustomerDto> page, CustomerDto customer);
+    IPage<CustomerVo> selectCustomerList(Page<CustomerDto> page, CustomerDto customer);
+
+    void assignCustomer(CustomerDto customer);
+
+    void recycleCustomer(CustomerDto customer);
+
+    /**
+     * 鍏变韩瀹㈡埛缁欏叾浠栫敤鎴�
+     *
+     * @param customerDto 瀹㈡埛DTO锛堝寘鍚鎴稩D鍜屽叡浜敤鎴稩D鍒楄〃锛�
+     */
+    void together(CustomerDto customerDto);
+
+    Boolean back(Long id);
 }
diff --git a/src/main/java/com/ruoyi/basic/service/impl/CustomerFollowUpServiceImpl.java b/src/main/java/com/ruoyi/basic/service/impl/CustomerFollowUpServiceImpl.java
index 29013d3..7946753 100644
--- a/src/main/java/com/ruoyi/basic/service/impl/CustomerFollowUpServiceImpl.java
+++ b/src/main/java/com/ruoyi/basic/service/impl/CustomerFollowUpServiceImpl.java
@@ -130,7 +130,7 @@
         }
 
         List<CustomerFollowUp> followUps = list(new LambdaQueryWrapper<CustomerFollowUp>()
-                .eq(CustomerFollowUp::getCustomerPrivatePoolId, customerId));
+                .eq(CustomerFollowUp::getCustomerId, customerId));
 
         if (followUps != null && !followUps.isEmpty()) {
             for (CustomerFollowUp followUp : followUps) {
diff --git a/src/main/java/com/ruoyi/basic/service/impl/CustomerPrivatePoolServiceImpl.java b/src/main/java/com/ruoyi/basic/service/impl/CustomerPrivatePoolServiceImpl.java
deleted file mode 100644
index 0b14ee9..0000000
--- a/src/main/java/com/ruoyi/basic/service/impl/CustomerPrivatePoolServiceImpl.java
+++ /dev/null
@@ -1,225 +0,0 @@
-package com.ruoyi.basic.service.impl;
-
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.basic.dto.CustomerFollowUpDto;
-import com.ruoyi.basic.dto.CustomerPrivatePoolDto;
-import com.ruoyi.basic.mapper.CustomerPrivateMapper;
-import com.ruoyi.basic.mapper.CustomerPrivatePoolMapper;
-import com.ruoyi.basic.pojo.*;
-import com.ruoyi.basic.service.*;
-import com.ruoyi.common.utils.StringUtils;
-import lombok.RequiredArgsConstructor;
-import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.time.ZoneId;
-import java.util.*;
-import java.util.stream.Collectors;
-
-/**
- * <p>
- * 鏈嶅姟瀹炵幇绫�
- * </p>
- *
- * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
- * @since 2026-04-16 04:43:00
- */
-@Service
-@Transactional(rollbackFor = Exception.class)
-@RequiredArgsConstructor
-public class CustomerPrivatePoolServiceImpl extends ServiceImpl<CustomerPrivatePoolMapper, CustomerPrivatePool> implements CustomerPrivatePoolService {
-
-    private final CustomerPrivatePoolMapper customerPrivatePoolMapper;
-
-    private final CustomerFollowUpService customerFollowUpService;
-
-    private final CustomerReturnVisitService customerReturnVisitService;
-
-    private final ICustomerService customerService;
-
-    private final CustomerFollowUpFileService customerFollowUpFileService;
-    private final CustomerPrivateMapper customerPrivateMapper;
-
-
-    @Override
-    public IPage<CustomerPrivatePoolDto> listPage(Page<CustomerPrivatePoolDto> page, CustomerPrivatePoolDto customerPrivatePoolDto) {
-        IPage<CustomerPrivatePoolDto> customerPrivatePoolDtoIPage = customerPrivatePoolMapper.listPage(page, customerPrivatePoolDto);
-        List<Long> customerIds = customerPrivatePoolDtoIPage.getRecords().stream()
-                .map(CustomerPrivatePoolDto::getId )
-                .filter(Objects::nonNull)
-                .collect(Collectors.toList());
-
-        if (!org.springframework.util.CollectionUtils.isEmpty(customerIds)) {
-            Map<Long, CustomerFollowUp> latestFollowUpMap = getLatestFollowUpMap(customerIds);
-
-            customerPrivatePoolDtoIPage.getRecords().forEach(c -> {
-                String address = StringUtils.defaultString(c.getCompanyAddress(), "");
-                String phone = StringUtils.defaultString(c.getCompanyPhone(), "");
-                c.setAddressPhone(address + "(" + phone + ")");
-
-                CustomerFollowUp followUp = latestFollowUpMap.get(c.getId());
-                if (followUp != null) {
-                    c.setFollowUpLevel(followUp.getFollowUpLevel());
-                    c.setFollowUpTime(Date.from(
-                            followUp.getFollowUpTime().atZone(ZoneId.systemDefault()).toInstant()
-                    ));
-                }
-            });
-
-        }
-        return customerPrivatePoolDtoIPage;
-    }
-
-
-    private Map<Long, CustomerFollowUp> getLatestFollowUpMap(List<Long> customerIds) {
-        List<CustomerFollowUp> followUps = customerFollowUpService.list(
-                new LambdaQueryWrapper<CustomerFollowUp>()
-                        .in(CustomerFollowUp::getCustomerPrivatePoolId, customerIds)
-                        .orderByDesc(CustomerFollowUp::getFollowUpTime)
-        );
-
-        return followUps.stream()
-                .collect(Collectors.toMap(
-                        CustomerFollowUp::getCustomerPrivatePoolId,
-                        followUp -> followUp,
-                        (existing, replacement) -> existing
-                ));
-    }
-
-    @Override
-    public boolean deleteCustomerPrivatePool(Long id) {
-        List<CustomerPrivatePool> list = this.list(new QueryWrapper<CustomerPrivatePool>().lambda().eq(CustomerPrivatePool::getCustomerId, id));
-
-        for (CustomerPrivatePool customerPrivatePool : list) {
-            customerFollowUpService.remove(new QueryWrapper<CustomerFollowUp>().lambda().eq(CustomerFollowUp::getCustomerPrivatePoolId, customerPrivatePool.getId()));
-            customerReturnVisitService.remove(new QueryWrapper<CustomerReturnVisit>().lambda().eq(CustomerReturnVisit::getCustomerPrivatePoolId, customerPrivatePool.getId()));
-        }
-        Customer byId = customerService.getById(id);
-        byId.setUsageStatus(0L);
-        byId.setUsageUser(0L);
-        customerService.updateById(byId);
-        list.stream().forEach(customerPrivatePool -> {
-            customerPrivatePool.setDeleteFlag(1);
-            customerPrivatePoolMapper.updateById(customerPrivatePool);
-        });
-        return true;
-    }
-
-    @Override
-    public boolean together(CustomerPrivatePoolDto customerPrivatePoolDto) {
-        List<CustomerPrivatePool> existingPools = this.list(new QueryWrapper<CustomerPrivatePool>().lambda().eq(CustomerPrivatePool::getCustomerId, customerPrivatePoolDto.getCustomerId()));
-
-        List<Long> existingBoundIds = existingPools.stream()
-                .map(CustomerPrivatePool::getBoundId)
-                .collect(Collectors.toList());
-
-        List<Long> newBoundIds = customerPrivatePoolDto.getBoundIds().stream()
-                .filter(boundId -> !existingBoundIds.contains(boundId))
-                .collect(Collectors.toList());
-
-        if (CollectionUtils.isEmpty(newBoundIds)) {
-            return true;
-        }
-        for (Long id : customerPrivatePoolDto.getBoundIds()) {
-            CustomerPrivatePool customerPrivatePool = new CustomerPrivatePool();
-            customerPrivatePool.setCustomerId(customerPrivatePoolDto.getCustomerId());
-            customerPrivatePool.setBoundId(id);
-            customerPrivatePool.setType(1L);
-            this.save(customerPrivatePool);
-        }
-        return true;
-    }
-
-    @Override
-    public boolean add(CustomerPrivatePoolDto customerPrivatePool) {
-        customerPrivatePool.setType(1L);
-        this.save(customerPrivatePool);
-        Customer byId = customerService.getById(customerPrivatePool.getCustomerId());
-        if (byId != null) {
-            byId.setUsageStatus(1L);
-            byId.setUsageUser(customerPrivatePool.getBoundId());
-            return customerService.updateById(byId);
-        }
-        throw new RuntimeException("瀹㈡埛涓嶅瓨鍦�");
-
-    }
-
-    @Override
-    public CustomerPrivatePoolDto getInfo(Long id) {
-        CustomerPrivatePoolDto customerPrivatePool = customerPrivatePoolMapper.selectInfo(id);
-        if (customerPrivatePool == null) {
-            return null;
-        }
-
-        // 鏌ヨ璺熻繘璁板綍
-        List<CustomerFollowUp> followUpList = customerFollowUpService.list(
-                new LambdaQueryWrapper<CustomerFollowUp>()
-                        .eq(CustomerFollowUp::getCustomerPrivatePoolId, id)
-                        .orderByDesc(CustomerFollowUp::getFollowUpTime)
-        );
-        if (!CollectionUtils.isEmpty(followUpList)) {
-            List<CustomerFollowUpDto> followUpDtoList = followUpList.stream().map(followUp -> {
-                CustomerFollowUpDto followUpDto = new CustomerFollowUpDto();
-                BeanUtils.copyProperties(followUp, followUpDto);
-
-                // 鏌ヨ闄勪欢
-                List<CustomerFollowUpFile> fileList = customerFollowUpFileService.list(
-                        new LambdaQueryWrapper<CustomerFollowUpFile>()
-                                .eq(CustomerFollowUpFile::getFollowUpId, followUp.getId())
-                );
-                followUpDto.setFileList(fileList);
-
-                return followUpDto;
-            }).collect(Collectors.toList());
-
-            customerPrivatePool.setFollowUpList(followUpDtoList);
-        }
-
-        return customerPrivatePool;
-    }
-
-    @Override
-    public Boolean updateCustomerPrivatePoolDto(CustomerPrivatePoolDto customerPrivatePoolDto) {
-        if (customerPrivatePoolDto.getType() == 0L) {
-            CustomerPrivate byId = customerPrivateMapper.selectById(customerPrivatePoolDto.getCustomerId());
-            BeanUtils.copyProperties(customerPrivatePoolDto, byId);
-            byId.setId(customerPrivatePoolDto.getCustomerId());
-            customerPrivateMapper.updateById(byId);
-        } else if (customerPrivatePoolDto.getType() == 1L) {
-            Customer customer = customerService.getById(customerPrivatePoolDto.getCustomerId());
-            BeanUtils.copyProperties(customerPrivatePoolDto, customer);
-            customer.setId(customerPrivatePoolDto.getCustomerId());
-            customerService.updateById(customer);
-        }
-        return true;
-    }
-
-    @Override
-    public CustomerPrivatePoolDto getbyId(Long id) {
-        CustomerPrivatePoolDto customerPrivatePool = customerPrivatePoolMapper.selectInfo(id);
-        return customerPrivatePool;
-    }
-
-    @Override
-    public List<CustomerPrivatePoolDto> selectCustomerPrivatePoolDtoListByIds(List<Long> ids) {
-        ArrayList<CustomerPrivatePoolDto> customerPrivatePoolDtos = new ArrayList<>();
-        for (Long id : ids) {
-            CustomerPrivatePoolDto customerPrivatePoolDto = customerPrivatePoolMapper.selectInfo(id);
-            customerPrivatePoolDtos.add(customerPrivatePoolDto);
-        }
-        return customerPrivatePoolDtos;
-    }
-
-    @Override
-    public List<CustomerPrivatePoolDto> selectCustomerPrivatePoolDtoLists(CustomerPrivatePoolDto customerPrivatePoolDto) {
-
-        return customerPrivatePoolMapper.selectInfos();
-    }
-}
diff --git a/src/main/java/com/ruoyi/basic/service/impl/CustomerPrivateServiceImpl.java b/src/main/java/com/ruoyi/basic/service/impl/CustomerPrivateServiceImpl.java
deleted file mode 100644
index 4521155..0000000
--- a/src/main/java/com/ruoyi/basic/service/impl/CustomerPrivateServiceImpl.java
+++ /dev/null
@@ -1,121 +0,0 @@
-package com.ruoyi.basic.service.impl;
-
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.basic.dto.CustomerPrivateDto;
-import com.ruoyi.basic.mapper.CustomerPrivateMapper;
-import com.ruoyi.basic.mapper.CustomerPrivatePoolMapper;
-import com.ruoyi.basic.pojo.CustomerFollowUp;
-import com.ruoyi.basic.pojo.CustomerPrivate;
-import com.ruoyi.basic.pojo.CustomerPrivatePool;
-import com.ruoyi.basic.pojo.CustomerReturnVisit;
-import com.ruoyi.basic.service.CustomerFollowUpService;
-import com.ruoyi.basic.service.CustomerPrivateService;
-import com.ruoyi.basic.service.CustomerReturnVisitService;
-import com.ruoyi.common.utils.SecurityUtils;
-import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.framework.web.domain.R;
-import com.ruoyi.sales.mapper.SalesLedgerMapper;
-import com.ruoyi.sales.pojo.SalesLedger;
-import lombok.RequiredArgsConstructor;
-import org.springframework.beans.BeanUtils;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.CollectionUtils;
-import org.springframework.web.multipart.MultipartFile;
-
-import java.util.List;
-import java.util.stream.Collectors;
-
-/**
- * <p>
- * 瀹㈡埛妗f 鏈嶅姟瀹炵幇绫�
- * </p>
- *
- * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
- * @since 2026-04-17 10:39:09
- */
-@Service
-@Transactional(rollbackFor = Exception.class)
-@RequiredArgsConstructor
-public class CustomerPrivateServiceImpl extends ServiceImpl<CustomerPrivateMapper, CustomerPrivate> implements CustomerPrivateService {
-
-
-    private final CustomerPrivatePoolMapper customerPrivatePoolMapper;
-
-    private final CustomerFollowUpService customerFollowUpService;
-
-    private final CustomerReturnVisitService customerReturnVisitService;
-    private final SalesLedgerMapper salesLedgerMapper;
-
-    private final CustomerPrivateMapper customerPrivateMapper;
-
-
-    @Override
-    public Boolean add(CustomerPrivateDto customerPrivateDto) {
-        //鏂板绉佹捣 瀹㈡埛
-        this.save(customerPrivateDto);
-        //鏂板绉佹捣璁板綍
-        CustomerPrivatePool customerPrivatePool = new CustomerPrivatePool();
-        customerPrivatePool.setCustomerId(customerPrivateDto.getId());
-        customerPrivatePool.setType(0L);
-        customerPrivatePool.setBoundId(SecurityUtils.getLoginUser().getUserId());
-        customerPrivatePoolMapper.insert(customerPrivatePool);
-        return true;
-    }
-
-
-    @Override
-    public Integer delete(List<Long> ids) {
-        List<CustomerPrivatePool> customerPrivatePools = customerPrivatePoolMapper.selectList(new QueryWrapper<CustomerPrivatePool>().lambda().in(CustomerPrivatePool::getId, ids));
-        List<SalesLedger> salesLedgers = salesLedgerMapper.selectList(new QueryWrapper<SalesLedger>().lambda().in(SalesLedger::getCustomerId, customerPrivatePools.stream().map(CustomerPrivatePool::getCustomerId).collect(Collectors.toList())));
-        if (!CollectionUtils.isEmpty(salesLedgers)) {
-            throw new RuntimeException("瀹㈡埛鏈夐攢鍞悎鍚岋紝璇峰厛鍒犻櫎閿�鍞悎鍚�");
-        }
-        if (CollectionUtils.isEmpty(customerPrivatePools)) {
-            throw new RuntimeException("瀹㈡埛涓嶅瓨鍦�");
-        }
-        customerFollowUpService.remove(new QueryWrapper<CustomerFollowUp>().lambda().in(CustomerFollowUp::getCustomerPrivatePoolId, customerPrivatePools.stream().map(CustomerPrivatePool::getCustomerId).collect(Collectors.toList())));
-        customerReturnVisitService.remove(new QueryWrapper<CustomerReturnVisit>().lambda().in(CustomerReturnVisit::getCustomerPrivatePoolId, customerPrivatePools.stream().map(CustomerPrivatePool::getCustomerId).collect(Collectors.toList())));
-        customerPrivatePools.stream().forEach(customerPrivatePool -> {
-            customerPrivatePool.setDeleteFlag(1);
-            customerPrivatePoolMapper.updateById(customerPrivatePool);
-        });
-        return 1;
-
-    }
-
-    @Override
-    public R importData(MultipartFile file) {
-        try {
-            List<CustomerPrivate> existingList = customerPrivateMapper.selectList(null);
-            java.util.Set<String> existingCustomerNames = existingList.stream()
-                    .map(CustomerPrivate::getCustomerName)
-                    .collect(Collectors.toSet());
-
-            ExcelUtil<CustomerPrivate> util = new ExcelUtil<CustomerPrivate>(CustomerPrivate.class);
-            List<CustomerPrivate> userList = util.importExcel(file.getInputStream());
-            if (CollectionUtils.isEmpty(userList)) {
-                return R.fail("妯℃澘閿欒鎴栧鍏ユ暟鎹负绌�");
-            }
-
-            int successCount = 0;
-            int skipCount = 0;
-            for (CustomerPrivate user : userList) {
-                if (existingCustomerNames.contains(user.getCustomerName())) {
-                    skipCount++;
-                    continue;
-                }
-                CustomerPrivateDto customerPrivateDto = new CustomerPrivateDto();
-                BeanUtils.copyProperties(user, customerPrivateDto);
-                this.add(customerPrivateDto);
-                existingCustomerNames.add(user.getCustomerName());
-                successCount++;
-            }
-            return R.ok("瀵煎叆瀹屾垚锛屾垚鍔�" + successCount + "鏉★紝璺宠繃閲嶅" + skipCount + "鏉�");
-        } catch (Exception e) {
-            e.printStackTrace();
-            return R.fail("瀵煎叆澶辫触锛�" + e.getMessage());
-        }
-    }
-}
diff --git a/src/main/java/com/ruoyi/basic/service/impl/CustomerReturnVisitServiceImpl.java b/src/main/java/com/ruoyi/basic/service/impl/CustomerReturnVisitServiceImpl.java
index 9192d50..f2a1556 100644
--- a/src/main/java/com/ruoyi/basic/service/impl/CustomerReturnVisitServiceImpl.java
+++ b/src/main/java/com/ruoyi/basic/service/impl/CustomerReturnVisitServiceImpl.java
@@ -75,7 +75,7 @@
             throw new ServiceException("瀹㈡埛ID涓嶈兘涓虹┖");
         }
         LambdaQueryWrapper<CustomerReturnVisit> queryWrapper = new LambdaQueryWrapper<>();
-        queryWrapper.eq(CustomerReturnVisit::getCustomerPrivatePoolId, customerId);
+        queryWrapper.eq(CustomerReturnVisit::getCustomerId, customerId);
         CustomerReturnVisit returnVisit = baseMapper.selectOne(queryWrapper);
 
         if (returnVisit == null) {
@@ -94,7 +94,7 @@
             throw new ServiceException("瀹㈡埛ID涓嶈兘涓虹┖");
         }
         LambdaQueryWrapper<CustomerReturnVisit> queryWrapper = new LambdaQueryWrapper<>();
-        queryWrapper.eq(CustomerReturnVisit::getCustomerPrivatePoolId, customerId);
+        queryWrapper.eq(CustomerReturnVisit::getCustomerId, customerId);
         List<CustomerReturnVisit> returnVisits = baseMapper.selectList(queryWrapper);
 
         for (CustomerReturnVisit returnVisit : returnVisits) {
@@ -124,7 +124,7 @@
         if (returnVisit == null) {
             throw new ServiceException("鍥炶鎻愰啋鏁版嵁涓嶈兘涓虹┖");
         }
-        if (returnVisit.getCustomerPrivatePoolId() == null) {
+        if (returnVisit.getCustomerId() == null) {
             throw new ServiceException("瀹㈡埛ID涓嶈兘涓虹┖");
         }
         if (returnVisit.getReminderTime() == null) {
diff --git a/src/main/java/com/ruoyi/basic/service/impl/CustomerServiceImpl.java b/src/main/java/com/ruoyi/basic/service/impl/CustomerServiceImpl.java
index b4b0232..52d01ec 100644
--- a/src/main/java/com/ruoyi/basic/service/impl/CustomerServiceImpl.java
+++ b/src/main/java/com/ruoyi/basic/service/impl/CustomerServiceImpl.java
@@ -8,23 +8,25 @@
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ruoyi.basic.dto.CustomerDto;
+import com.ruoyi.basic.dto.CustomerFollowUpDto;
 import com.ruoyi.basic.mapper.CustomerMapper;
-import com.ruoyi.basic.mapper.CustomerPrivatePoolMapper;
 import com.ruoyi.basic.pojo.Customer;
 import com.ruoyi.basic.pojo.CustomerFollowUp;
-import com.ruoyi.basic.pojo.CustomerPrivatePool;
-import com.ruoyi.basic.service.CustomerFollowUpService;
-import com.ruoyi.basic.service.CustomerReturnVisitService;
-import com.ruoyi.basic.service.ICustomerService;
+import com.ruoyi.basic.pojo.CustomerFollowUpFile;
+import com.ruoyi.basic.pojo.CustomerUser;
+import com.ruoyi.basic.service.*;
+import com.ruoyi.basic.vo.CustomerVo;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.framework.security.LoginUser;
-import com.ruoyi.framework.web.domain.AjaxResult;
+import com.ruoyi.framework.web.domain.R;
 import com.ruoyi.sales.mapper.SalesLedgerMapper;
 import com.ruoyi.sales.pojo.SalesLedger;
-import lombok.RequiredArgsConstructor;
+import lombok.AllArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
@@ -42,15 +44,22 @@
  * @date 2025-05-07
  */
 @Service
-@RequiredArgsConstructor
+@AllArgsConstructor
 @Slf4j
 public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> implements ICustomerService {
-    private final SalesLedgerMapper salesLedgerMapper;
-    private final CustomerPrivatePoolMapper customerPrivatePoolMapper;
-    private final CustomerMapper customerMapper;
+    @Autowired
+    private  SalesLedgerMapper salesLedgerMapper;
+    @Autowired
+    private CustomerMapper customerMapper;
 
-    private final CustomerFollowUpService customerFollowUpService;
-    private final CustomerReturnVisitService customerReturnVisitService;
+    @Autowired
+    private CustomerFollowUpService customerFollowUpService;
+    @Autowired
+    private CustomerFollowUpFileService customerFollowUpFileService;
+    @Autowired
+    private CustomerReturnVisitService customerReturnVisitService;
+    @Autowired
+    private CustomerUserService customerUserService;
 
     /**
      * 鏌ヨ瀹㈡埛妗f
@@ -70,8 +79,35 @@
      * @return 瀹㈡埛璇︽儏DTO
      */
     @Override
-    public Customer selectCustomerDetailById(Long id) {
-        return this.getById( id);
+    public CustomerVo selectCustomerDetailById(Long id) {
+        CustomerVo customerVo = new CustomerVo();
+        BeanUtils.copyProperties(this.getById(id), customerVo);
+
+        // 鏌ヨ璺熻繘璁板綍
+        List<CustomerFollowUp> followUpList = customerFollowUpService.list(
+                new LambdaQueryWrapper<CustomerFollowUp>()
+                        .eq(CustomerFollowUp::getCustomerId, id)
+                        .orderByDesc(CustomerFollowUp::getFollowUpTime)
+        );
+        if (!com.baomidou.mybatisplus.core.toolkit.CollectionUtils.isEmpty(followUpList)) {
+            List<CustomerFollowUpDto> followUpDtoList = followUpList.stream().map(followUp -> {
+                CustomerFollowUpDto followUpDto = new CustomerFollowUpDto();
+                BeanUtils.copyProperties(followUp, followUpDto);
+
+                // 鏌ヨ闄勪欢
+                List<CustomerFollowUpFile> fileList = customerFollowUpFileService.list(
+                        new LambdaQueryWrapper<CustomerFollowUpFile>()
+                                .eq(CustomerFollowUpFile::getFollowUpId, followUp.getId())
+                );
+                followUpDto.setFileList(fileList);
+
+                return followUpDto;
+            }).collect(Collectors.toList());
+
+            customerVo.setFollowUpList(followUpDtoList);
+        }
+
+        return customerVo;
     }
 
     /**
@@ -81,16 +117,18 @@
      * @return 瀹㈡埛妗f
      */
     @Override
-    public IPage<CustomerDto> selectCustomerList(Page<CustomerDto> page, CustomerDto customer) {
-        IPage<CustomerDto> customerPage = customerMapper.listPage(page, customer);
+    public IPage<CustomerVo> selectCustomerList(Page<CustomerDto> page, CustomerDto customer) {
+        LoginUser loginUser = SecurityUtils.getLoginUser();
+        Long loginUserId = loginUser.getUserId();
+        IPage<CustomerVo> customerPage = customerMapper.listPage(page, customer, loginUserId);
 
-        List<CustomerDto> records = customerPage.getRecords();
+        List<CustomerVo> records = customerPage.getRecords();
         if (CollectionUtils.isEmpty(records)) {
             return customerPage;
         }
 
         List<Long> customerIds = records.stream()
-                .map(CustomerDto::getId)
+                .map(CustomerVo::getId)
                 .filter(Objects::nonNull)
                 .collect(Collectors.toList());
 
@@ -109,6 +147,16 @@
                             followUp.getFollowUpTime().atZone(ZoneId.systemDefault()).toInstant()
                     ));
                 }
+
+                // 杞崲鍏变韩鐢ㄦ埛ID瀛楃涓蹭负List<Long>
+                String userIdsStr = c.getUserIdsStr();
+                if (StringUtils.isNotEmpty(userIdsStr)) {
+                    List<Long> userIds = Arrays.stream(userIdsStr.split(","))
+                            .map(String::trim)
+                            .map(Long::parseLong)
+                            .collect(Collectors.toList());
+                    c.setUserIds(userIds);
+                }
             });
         }
 
@@ -118,13 +166,13 @@
     private Map<Long, CustomerFollowUp> getLatestFollowUpMap(List<Long> customerIds) {
         List<CustomerFollowUp> followUps = customerFollowUpService.list(
                 new LambdaQueryWrapper<CustomerFollowUp>()
-                        .in(CustomerFollowUp::getCustomerPrivatePoolId, customerIds)
+                        .in(CustomerFollowUp::getCustomerId, customerIds)
                         .orderByDesc(CustomerFollowUp::getFollowUpTime)
         );
 
         return followUps.stream()
                 .collect(Collectors.toMap(
-                        CustomerFollowUp::getCustomerPrivatePoolId,
+                        CustomerFollowUp::getCustomerId,
                         followUp -> followUp,
                         (existing, replacement) -> existing
                 ));
@@ -172,16 +220,28 @@
         if (!salesLedgers.isEmpty()) {
             throw new RuntimeException("瀹㈡埛妗f涓嬫湁閿�鍞悎鍚岋紝璇峰厛鍒犻櫎閿�鍞悎鍚�");
         }
-        List<CustomerPrivatePool> customerPrivatePools = customerPrivatePoolMapper.selectList(new QueryWrapper<CustomerPrivatePool>().lambda().in(CustomerPrivatePool::getCustomerId, idList));
-        if (!customerPrivatePools.isEmpty()) {
-            throw new RuntimeException("瀹㈡埛妗f涓嬫湁瀹㈡埛绉佹捣锛岃鍏堟敹鍥炵娴锋暟鎹�");
+        // 鏌ヨ鏄惁鏈夊凡鍒嗛厤鐨勫叕娴峰鎴�
+        List<Customer> assignedPools = customerMapper.selectList(
+                new QueryWrapper<Customer>().lambda()
+                        .in(Customer::getId, idList)
+                        .eq(Customer::getType, 1).
+                        eq(Customer::getIsAssigned, 1)  // 鍏捣瀹㈡埛
+        );
+        if (!assignedPools.isEmpty()) {
+            throw new RuntimeException("瀹㈡埛妗f涓嬫湁宸插垎閰嶇殑鍏捣瀹㈡埛锛岃鍏堟敹鍥�");
         }
-        //  鍒犻櫎瀹㈡埛鐨勫悓鏃朵篃闇�瑕佸垹闄ゅ搴旂殑瀹㈡埛璺熼殢銆侀檮浠跺拰鍥炶鎻愰啋
+        // 鍒犻櫎瀹㈡埛鐨勫悓鏃朵篃闇�瑕佸垹闄ゅ搴旂殑瀹㈡埛璺熼殢銆侀檮浠跺拰鍥炶鎻愰啋
         for (Long id : ids) {
             customerFollowUpService.deleteByCustomerId(id);
             customerReturnVisitService.deleteByCustomerId(id);
+            // 鍒犻櫎瀹㈡埛鐨勫叡浜叧绯�
+            customerUserService.remove(
+                new QueryWrapper<CustomerUser>().lambda()
+                    .eq(CustomerUser::getCustomerId, id)
+            );
         }
 
+        // 鍒犻櫎瀹㈡埛涓昏〃鏁版嵁
         return customerMapper.deleteBatchIds(idList);
     }
 
@@ -193,23 +253,32 @@
     }
 
     @Override
-    public List<Customer> selectCustomerLists(Customer customer) {
-        return customerMapper.selectList(null);
+    public List<CustomerVo> selectCustomerLists(CustomerDto customer) {
+        LoginUser loginUser = SecurityUtils.getLoginUser();
+        Long loginUserId = loginUser.getUserId();
+        return customerMapper.list(customer, loginUserId);
     }
 
     @Override
-    public AjaxResult importData(MultipartFile file) {
+    public R importData(MultipartFile file, Integer type) {
         try {
             ExcelUtil<Customer> util = new ExcelUtil<Customer>(Customer.class);
             List<Customer> userList = util.importExcel(file.getInputStream());
             if (CollectionUtils.isEmpty(userList)) {
-                return AjaxResult.warn("妯℃澘閿欒鎴栧鍏ユ暟鎹负绌�");
+                return R.fail("妯℃澘閿欒鎴栧鍏ユ暟鎹负绌�");
+            }
+
+            // 鏍规嵁 type 鍙傛暟璁剧疆瀹㈡埛绫诲瀷锛堢娴�/鍏捣锛�
+            if (type != null) {
+                userList.forEach(customer -> {
+                    customer.setType(type);
+                });
             }
             this.saveOrUpdateBatch(userList);
-            return AjaxResult.success(true);
+            return R.ok(true);
         } catch (Exception e) {
             e.printStackTrace();
-            return AjaxResult.error("瀵煎叆澶辫触");
+            return R.fail("瀵煎叆澶辫触");
         }
 
     }
@@ -230,6 +299,86 @@
         ).collect(Collectors.toList());
     }
 
+    // 鍒嗛厤鍏捣瀹㈡埛缁欑娴�
+    @Override
+    public void assignCustomer(CustomerDto customerDto) {
+        Customer customer = customerMapper.selectById(customerDto.getId());
+        if (customer.getType() == 1 && customer.getIsAssigned() == 0) {  // 鍏捣涓斿彲鍒嗛厤
+            customer.setIsAssigned(1);
+            customer.setUsageStatus(1L);
+            customer.setUsageUser(customerDto.getUsageUser());
+            customerMapper.updateById(customer);
+        }
+    }
+
+    // 鍥炴敹绉佹捣瀹㈡埛鍒板叕娴�
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void recycleCustomer(CustomerDto customerDto) {
+        Customer customer = customerMapper.selectById(customerDto.getId());
+        if (customer.getType() == 1 && customer.getIsAssigned() == 1) {  // 鍏捣涓斿凡鍒嗛厤
+            customer.setIsAssigned(0);
+            customer.setUsageStatus(0L);
+            customer.setUsageUser(0L);
+            customerMapper.updateById(customer);
+
+            // 鍒犻櫎璇ュ鎴风殑鎵�鏈夊叡浜叧绯�
+            customerUserService.remove(
+                new QueryWrapper<CustomerUser>().lambda()
+                    .eq(CustomerUser::getCustomerId, customerDto.getId())
+            );
+        }
+    }
+
+    // 瀹㈡埛鍏变韩
+    @Override
+    public void together(CustomerDto customerDto) {
+        // 鏌ヨ鐜版湁鐨勫叡浜褰�
+        List<CustomerUser> existingUsers = customerUserService.list(
+                new QueryWrapper<CustomerUser>().lambda().eq(CustomerUser::getCustomerId, customerDto.getId())
+        );
+
+        // 鑾峰彇宸插瓨鍦ㄧ殑鐢ㄦ埛ID鍒楄〃
+        List<Long> existingUserIds = existingUsers.stream()
+                .map(CustomerUser::getUserId)
+                .collect(Collectors.toList());
+
+        // 杩囨护鎺夊凡瀛樺湪鐨勭敤鎴凤紝鍙繚鐣欐柊鐢ㄦ埛
+        List<Long> newUserIds = customerDto.getUserIds().stream()
+                .filter(userId -> !existingUserIds.contains(userId))
+                .collect(Collectors.toList());
+
+        if (CollectionUtils.isEmpty(newUserIds)) {
+            return;
+        }
+
+        // 鑾峰彇褰撳墠绉熸埛ID
+        LoginUser loginUser = SecurityUtils.getLoginUser();
+        Long tenantId = loginUser.getTenantId();
+
+        // 鎵归噺淇濆瓨鏂扮殑鍏变韩璁板綍
+        List<CustomerUser> customerUsers = newUserIds.stream()
+                .map(userId -> {
+                    CustomerUser customerUser = new CustomerUser();
+                    customerUser.setCustomerId(customerDto.getId());
+                    customerUser.setUserId(userId);
+                    customerUser.setTenantId(tenantId);
+                    return customerUser;
+                })
+                .collect(Collectors.toList());
+
+        customerUserService.saveBatch(customerUsers);
+    }
+
+    @Override
+    public Boolean back(Long id) {
+        //灏嗗鎴风殑type鏀逛负1 涓旂洿鎺ュ垎閰嶇粰褰撳墠鐢ㄦ埛
+        Customer customer = customerMapper.selectById(id);
+        customer.setType(1);
+        customer.setIsAssigned(1);
+        return this.updateById(customer);
+    }
+
     /**
      * 涓嬪垝绾垮懡鍚嶈浆椹煎嘲鍛藉悕
      */
diff --git a/src/main/java/com/ruoyi/basic/service/impl/CustomerUserServiceImpl.java b/src/main/java/com/ruoyi/basic/service/impl/CustomerUserServiceImpl.java
new file mode 100644
index 0000000..5829e8a
--- /dev/null
+++ b/src/main/java/com/ruoyi/basic/service/impl/CustomerUserServiceImpl.java
@@ -0,0 +1,19 @@
+package com.ruoyi.basic.service.impl;
+
+import com.ruoyi.basic.mapper.CustomerUserMapper;
+import com.ruoyi.basic.pojo.CustomerUser;
+import com.ruoyi.basic.service.CustomerUserService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * 瀹㈡埛鍏变韩Service瀹炵幇绫�
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @date 2026-04-29
+ */
+@Service
+@Transactional(rollbackFor = Exception.class)
+public class CustomerUserServiceImpl extends ServiceImpl<CustomerUserMapper, CustomerUser> implements CustomerUserService {
+}
\ No newline at end of file
diff --git a/src/main/java/com/ruoyi/basic/task/ReturnVisitReminderTask.java b/src/main/java/com/ruoyi/basic/task/ReturnVisitReminderTask.java
index edc3b54..fbfb5b6 100644
--- a/src/main/java/com/ruoyi/basic/task/ReturnVisitReminderTask.java
+++ b/src/main/java/com/ruoyi/basic/task/ReturnVisitReminderTask.java
@@ -72,7 +72,7 @@
         }
 
         try {
-            unipushService.sendReturnVisitReminder(returnVisitId, client.getCid(), returnVisit.getContent(), returnVisit.getCustomerPrivatePoolId());
+            unipushService.sendReturnVisitReminder(returnVisitId, client.getCid(), returnVisit.getContent(), returnVisit.getCustomerId());
             CustomerReturnVisit updateObj = new CustomerReturnVisit();
             updateObj.setId(returnVisitId);
             updateObj.setIsCompleted(1);
diff --git a/src/main/java/com/ruoyi/basic/vo/CustomerVo.java b/src/main/java/com/ruoyi/basic/vo/CustomerVo.java
new file mode 100644
index 0000000..3d4c8cb
--- /dev/null
+++ b/src/main/java/com/ruoyi/basic/vo/CustomerVo.java
@@ -0,0 +1,28 @@
+package com.ruoyi.basic.vo;
+
+import com.ruoyi.basic.dto.CustomerFollowUpDto;
+import com.ruoyi.basic.pojo.Customer;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class CustomerVo extends Customer {
+    @ApiModelProperty(value = "璺熻繘璁板綍")
+    private List<CustomerFollowUpDto> followUpList;
+
+    private String usageUserName;
+
+    private String togetherUserNames;
+
+    /**
+     * 鍏变韩鐢ㄦ埛ID鍒楄〃
+     */
+    private List<Long> userIds;
+
+    /**
+     * 鍏变韩鐢ㄦ埛ID瀛楃涓诧紙SQL鏌ヨ杩斿洖锛岀敤浜庤浆鎹负List锛�
+     */
+    private String userIdsStr;
+}
diff --git a/src/main/java/com/ruoyi/project/system/service/impl/UnipushService.java b/src/main/java/com/ruoyi/project/system/service/impl/UnipushService.java
index af06bbc..c331756 100644
--- a/src/main/java/com/ruoyi/project/system/service/impl/UnipushService.java
+++ b/src/main/java/com/ruoyi/project/system/service/impl/UnipushService.java
@@ -136,7 +136,7 @@
     /**
      * 鍙戦�佸洖璁挎彁閱�
      */
-    public void sendReturnVisitReminder(Long returnVisitId, String cid, String content, Integer customerId) {
+    public void sendReturnVisitReminder(Long returnVisitId, String cid, String content, Long customerId) {
         String targetPath = "pages/cooperativeOffice/customerManage/detail?customerId=" + customerId;
         sendRoutingPush(returnVisitId, cid, "瀹㈡埛鍥炶鎻愰啋", content, targetPath, false);
     }
diff --git a/src/main/java/com/ruoyi/sales/pojo/SalesQuotation.java b/src/main/java/com/ruoyi/sales/pojo/SalesQuotation.java
index 9a795c4..b72b3af 100644
--- a/src/main/java/com/ruoyi/sales/pojo/SalesQuotation.java
+++ b/src/main/java/com/ruoyi/sales/pojo/SalesQuotation.java
@@ -3,7 +3,7 @@
 import com.baomidou.mybatisplus.annotation.*;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.ruoyi.framework.aspectj.lang.annotation.Excel;
-import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import org.springframework.format.annotation.DateTimeFormat;
 
@@ -16,55 +16,58 @@
 public class SalesQuotation {
     @TableId(value = "id", type = IdType.AUTO)
     private Long id;
-    @Schema(description = "鎶ヤ环鍗曠紪鍙�")
+    @ApiModelProperty(value = "鎶ヤ环鍗曠紪鍙�")
     @Excel(name = "鎶ヤ环鍗曠紪鍙�")
     private String quotationNo;
-    @Schema(description = "瀹㈡埛鍚嶇О")
+    @ApiModelProperty(value = "瀹㈡埛鍚嶇О")
     @Excel(name = "瀹㈡埛鍚嶇О")
     private String customer;
 
-    @Schema(description = "涓氬姟鍛�")
+    @ApiModelProperty(value = "瀹㈡埛id")
+    private Long customerId;
+
+    @ApiModelProperty(value = "涓氬姟鍛�")
     @Excel(name = "涓氬姟鍛�")
     private String salesperson;
-    @Schema(description = "鎶ヤ环鏃ユ湡")
+    @ApiModelProperty(value = "鎶ヤ环鏃ユ湡")
     @JsonFormat(pattern = "yyyy-MM-dd")
     @DateTimeFormat(pattern = "yyyy-MM-dd")
     @Excel(name = "鎶ヤ环鏃ユ湡", width = 30, dateFormat = "yyyy-MM-dd")
     private LocalDate quotationDate;
-    @Schema(description = "鏈夋晥鏈熻嚦")
+    @ApiModelProperty(value = "鏈夋晥鏈熻嚦")
     @JsonFormat(pattern = "yyyy-MM-dd")
     @DateTimeFormat(pattern = "yyyy-MM-dd")
     @Excel(name = "鏈夋晥鏈熻嚦", width = 30, dateFormat = "yyyy-MM-dd")
     private LocalDate validDate;
-    @Schema(description = "浠樻鏂瑰紡")
+    @ApiModelProperty(value = "浠樻鏂瑰紡")
     private String paymentMethod;
-    @Schema(description = "浜よ揣鍛ㄦ湡澶╂暟")
+    @ApiModelProperty(value = "浜よ揣鍛ㄦ湡澶╂暟")
     private String deliveryPeriod;
-    @Schema(description = "鐘舵��")
+    @ApiModelProperty(value = "鐘舵��")
     private String status;
-    @Schema(description = "鎶ヤ环鎬婚噾棰�")
+    @ApiModelProperty(value = "鎶ヤ环鎬婚噾棰�")
     @Excel(name = "鎶ヤ环閲戦")
     private BigDecimal totalAmount;
 
-    @Schema(description = "澶囨敞")
+    @ApiModelProperty(value = "澶囨敞")
     private String remark;
-    @Schema(description = "鍒涘缓鏃堕棿")
+    @ApiModelProperty(value = "鍒涘缓鏃堕棿")
     @TableField(fill = FieldFill.INSERT)
     private LocalDateTime createTime;
 
-    @Schema(description = "淇敼鏃堕棿")
+    @ApiModelProperty(value = "淇敼鏃堕棿")
     @TableField(fill = FieldFill.INSERT_UPDATE)
     private LocalDateTime updateTime;
 
-    @Schema(description = "鍒涘缓鐢ㄦ埛")
+    @ApiModelProperty(value = "鍒涘缓鐢ㄦ埛")
     @TableField(fill = FieldFill.INSERT)
     private Integer createUser;
 
-    @Schema(description = "淇敼鐢ㄦ埛")
+    @ApiModelProperty(value = "淇敼鐢ㄦ埛")
     @TableField(fill = FieldFill.INSERT_UPDATE)
     private Integer updateUser;
 
-    @Schema(description = "绉熸埛ID")
+    @ApiModelProperty(value = "绉熸埛ID")
     @TableField(fill = FieldFill.INSERT)
     private Long tenantId;
 
diff --git a/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java b/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
index ccbe035..9803611 100644
--- a/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
+++ b/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
@@ -9,15 +9,10 @@
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ruoyi.account.service.AccountIncomeService;
-import com.ruoyi.basic.dto.CustomerPrivatePoolDto;
-import com.ruoyi.basic.dto.StorageBlobVO;
-import com.ruoyi.basic.enums.ApplicationTypeEnum;
-import com.ruoyi.basic.enums.RecordTypeEnum;
 import com.ruoyi.basic.mapper.CustomerMapper;
-import com.ruoyi.basic.mapper.CustomerPrivatePoolMapper;
+import com.ruoyi.basic.mapper.ProductMapper;
 import com.ruoyi.basic.mapper.ProductModelMapper;
 import com.ruoyi.basic.pojo.Customer;
-import com.ruoyi.basic.utils.FileUtil;
 import com.ruoyi.common.enums.FileNameType;
 import com.ruoyi.common.enums.SaleEnum;
 import com.ruoyi.common.exception.base.BaseException;
@@ -29,9 +24,8 @@
 import com.ruoyi.framework.security.LoginUser;
 import com.ruoyi.framework.web.domain.AjaxResult;
 import com.ruoyi.other.mapper.TempFileMapper;
-import com.ruoyi.production.mapper.ProductionProductInputMapper;
-import com.ruoyi.production.mapper.ProductionProductMainMapper;
-import com.ruoyi.production.mapper.ProductionProductOutputMapper;
+import com.ruoyi.other.pojo.TempFile;
+import com.ruoyi.production.mapper.*;
 import com.ruoyi.production.service.ProductionProductMainService;
 import com.ruoyi.project.system.domain.SysDept;
 import com.ruoyi.project.system.domain.SysUser;
@@ -47,8 +41,10 @@
 import com.ruoyi.sales.vo.SalesLedgerVo;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.io.FilenameUtils;
 import org.jetbrains.annotations.Nullable;
 import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.data.redis.core.script.DefaultRedisScript;
@@ -56,10 +52,15 @@
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.multipart.MultipartFile;
 
+import java.io.IOException;
 import java.io.InputStream;
 import java.lang.reflect.Field;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.YearMonth;
@@ -82,11 +83,13 @@
     private static final String LOCK_PREFIX = "contract_no_lock:";
     private static final long LOCK_WAIT_TIMEOUT = 10; // 閿佺瓑寰呰秴鏃舵椂闂达紙绉掞級
     private static final long LOCK_EXPIRE_TIME = 30;  // 閿佽嚜鍔ㄨ繃鏈熸椂闂达紙绉掞級
+    private final AccountIncomeService accountIncomeService;
     private final SalesLedgerMapper salesLedgerMapper;
     private final CustomerMapper customerMapper;
     private final SalesLedgerProductMapper salesLedgerProductMapper;
     private final SalesLedgerProductServiceImpl salesLedgerProductServiceImpl;
     private final CommonFileMapper commonFileMapper;
+    private final TempFileMapper tempFileMapper;
     private final ReceiptPaymentMapper receiptPaymentMapper;
     private final ShippingInfoServiceImpl shippingInfoServiceImpl;
     private final CommonFileServiceImpl commonFileService;
@@ -94,14 +97,27 @@
     private final InvoiceLedgerMapper invoiceLedgerMapper;
     private final InvoiceRegistrationProductMapper invoiceRegistrationProductMapper;
     private final InvoiceRegistrationMapper invoiceRegistrationMapper;
-    private final ProductModelMapper productModelMapper;
+    private final ProductionProductMainMapper productionProductMainMapper;
+    private final ProductionProductOutputMapper productionProductOutputMapper;
+    private final ProductionProductInputMapper productionProductInputMapper;
+    private final QualityInspectMapper qualityInspectMapper;
     private final RedisTemplate<String, String> redisTemplate;
-    private final SysDeptMapper sysDeptMapper;
-    private final ProductionProductMainService productionProductMainService;
-    private final PurchaseReturnOrderProductsMapper purchaseReturnOrderProductsMapper;
-    private final SysUserMapper sysUserMapper;
-    private final CustomerPrivatePoolMapper customerPrivatePoolMapper;
-    private final FileUtil fileUtil;
+    @Autowired
+    private SysDeptMapper sysDeptMapper;
+    @Value("${file.upload-dir}")
+    private String uploadDir;
+    @Autowired
+    private ProductModelMapper productModelMapper;
+
+    @Autowired
+    private ProductMapper productMapper;
+    @Autowired
+    private ProductionProductMainService productionProductMainService;
+    @Autowired
+    private PurchaseReturnOrderProductsMapper purchaseReturnOrderProductsMapper;
+    ;
+    @Autowired
+    private SysUserMapper sysUserMapper;
 
     @Override
     public List<SalesLedger> selectSalesLedgerList(SalesLedgerDto salesLedgerDto) {
@@ -185,9 +201,6 @@
             resultDto.setProductData(products);
             resultDto.setSalesLedgerFiles(salesLedgerFiles);
         }
-        // 5. 鏌ヨ闄勪欢
-        List<StorageBlobVO> StorageBlobVOs = fileUtil.getStorageBlobVOsByRecordTypeAndRecordId(RecordTypeEnum.SALES_LEDGER, salesLedger.getId());
-        resultDto.setStorageBlobVOs(StorageBlobVOs);
         return resultDto;
     }
 
@@ -514,7 +527,7 @@
         List<Long> productIds = products.stream()
                 .map(SalesLedgerProduct::getId)
                 .collect(Collectors.toList());
-        //鍒犻櫎鐢熶骇璁″垝
+        //鍒犻櫎鐢熶骇鏁版嵁
         salesLedgerProductServiceImpl.deleteProductionData(productIds);
 
         // 鎵归噺鍒犻櫎浜у搧瀛愯〃
@@ -569,43 +582,122 @@
     @Override
     @Transactional(rollbackFor = Exception.class)
     public int addOrUpdateSalesLedger(SalesLedgerDto salesLedgerDto) {
-        // 1. 鏍¢獙瀹㈡埛淇℃伅
-        CustomerPrivatePoolDto customer = customerPrivatePoolMapper.selectInfo(salesLedgerDto.getCustomerId());
-        if (customer == null) {
-            throw new BaseException("瀹㈡埛涓嶅瓨鍦�");
+        try {
+            // 1. 鏍¢獙瀹㈡埛淇℃伅
+            Customer customer = customerMapper.selectById(salesLedgerDto.getCustomerId());
+            if (customer == null) {
+                throw new BaseException("瀹㈡埛涓嶅瓨鍦�");
+            }
+
+            // 2. DTO杞珽ntity
+            SalesLedger salesLedger = convertToEntity(salesLedgerDto);
+            salesLedger.setCustomerName(customer.getCustomerName());
+            salesLedger.setTenantId(customer.getTenantId());
+            // 3. 鏂板鎴栨洿鏂颁富琛�
+            if (salesLedger.getId() == null) {
+                String contractNo = generateSalesContractNo();
+                salesLedger.setSalesContractNo(contractNo);
+                salesLedgerMapper.insert(salesLedger);
+            } else {
+                salesLedgerMapper.updateById(salesLedger);
+            }
+
+            // 4. 澶勭悊瀛愯〃鏁版嵁
+            List<SalesLedgerProduct> productList = salesLedgerDto.getProductData();
+            if (productList != null && !productList.isEmpty()) {
+                handleSalesLedgerProducts(salesLedger.getId(), productList, EnumUtil.fromCode(SaleEnum.class, salesLedgerDto.getType()));
+                updateMainContractAmount(
+                        salesLedger.getId(),
+                        productList,
+                        SalesLedgerProduct::getTaxInclusiveTotalPrice,
+                        salesLedgerMapper,
+                        SalesLedger.class
+                );
+            }
+
+            // 5. 杩佺Щ涓存椂鏂囦欢鍒版寮忕洰褰�
+            if (salesLedgerDto.getTempFileIds() != null && !salesLedgerDto.getTempFileIds().isEmpty()) {
+                migrateTempFilesToFormal(salesLedger.getId(), salesLedgerDto.getTempFileIds());
+            }
+            return 1;
+        } catch (IOException e) {
+            throw new BaseException("鏂囦欢杩佺Щ澶辫触: " + e.getMessage());
+        }
+    }
+
+    /**
+     * 灏嗕复鏃舵枃浠惰縼绉诲埌姝e紡鐩綍
+     *
+     * @param businessId  涓氬姟ID锛堥攢鍞彴璐D锛�
+     * @param tempFileIds 涓存椂鏂囦欢ID鍒楄〃
+     * @throws IOException 鏂囦欢鎿嶄綔寮傚父
+     */
+    private void migrateTempFilesToFormal(Long businessId, List<String> tempFileIds) throws IOException {
+        if (CollectionUtils.isEmpty(tempFileIds)) {
+            return;
         }
 
-        // 2. DTO杞珽ntity
-        SalesLedger salesLedger = convertToEntity(salesLedgerDto);
-        salesLedger.setCustomerName(customer.getCustomerName());
-        salesLedger.setTenantId(customer.getTenantId());
-        // 3. 鏂板鎴栨洿鏂颁富琛�
-        if (salesLedger.getId() == null) {
-            String contractNo = generateSalesContractNo();
-            salesLedger.setSalesContractNo(contractNo);
-            salesLedgerMapper.insert(salesLedger);
-        } else {
-            salesLedgerMapper.updateById(salesLedger);
+        // 鏋勫缓姝e紡鐩綍璺緞锛堟寜涓氬姟绫诲瀷鍜屾棩鏈熷垎缁勶級
+        String formalDir = uploadDir + LocalDate.now().format(DateTimeFormatter.ISO_LOCAL_DATE);
+
+        Path formalDirPath = Paths.get(formalDir);
+
+        // 纭繚姝e紡鐩綍瀛樺湪锛堥�掑綊鍒涘缓锛�
+        if (!Files.exists(formalDirPath)) {
+            Files.createDirectories(formalDirPath);
         }
 
-        // 4. 澶勭悊瀛愯〃鏁版嵁
-        List<SalesLedgerProduct> productList = salesLedgerDto.getProductData();
-        if (productList != null && !productList.isEmpty()) {
-            handleSalesLedgerProducts(salesLedger.getId(), productList, EnumUtil.fromCode(SaleEnum.class, salesLedgerDto.getType()));
-            updateMainContractAmount(
-                    salesLedger.getId(),
-                    productList,
-                    SalesLedgerProduct::getTaxInclusiveTotalPrice,
-                    salesLedgerMapper,
-                    SalesLedger.class
-            );
-        }
+        for (String tempFileId : tempFileIds) {
+            // 鏌ヨ涓存椂鏂囦欢璁板綍
+            TempFile tempFile = tempFileMapper.selectById(tempFileId);
+            if (tempFile == null) {
+                log.warn("涓存椂鏂囦欢涓嶅瓨鍦紝璺宠繃澶勭悊: {}", tempFileId);
+                continue;
+            }
 
-        // 5. 淇濆瓨鏂囦欢
-        if (salesLedgerDto.getStorageBlobDTOs() != null && !salesLedgerDto.getStorageBlobDTOs().isEmpty()) {
-            fileUtil.saveStorageAttachment(ApplicationTypeEnum.FILE, RecordTypeEnum.SALES_LEDGER, salesLedger.getId(), salesLedgerDto.getStorageBlobDTOs());
+            // 鏋勫缓姝e紡鏂囦欢鍚嶏紙鍖呭惈涓氬姟ID鍜屾椂闂存埑锛岄伩鍏嶅啿绐侊級
+            String originalFilename = tempFile.getOriginalName();
+            String fileExtension = FilenameUtils.getExtension(originalFilename);
+            String formalFilename = businessId + "_" +
+                    System.currentTimeMillis() + "_" +
+                    UUID.randomUUID().toString().substring(0, 8) +
+                    (StringUtils.hasText(fileExtension) ? "." + fileExtension : "");
+
+            Path formalFilePath = formalDirPath.resolve(formalFilename);
+
+            try {
+                // 鎵ц鏂囦欢杩佺Щ锛堜娇鐢ㄥ師瀛愭搷浣滅‘淇濆畨鍏ㄦ�э級
+//                Files.move(
+//                        Paths.get(tempFile.getTempPath()),
+//                        formalFilePath,
+//                        StandardCopyOption.REPLACE_EXISTING,
+//                        StandardCopyOption.ATOMIC_MOVE
+//                );
+                // 鍘熷瓙绉诲姩澶辫触锛屼娇鐢ㄥ鍒�+鍒犻櫎
+                Files.copy(Paths.get(tempFile.getTempPath()), formalFilePath, StandardCopyOption.REPLACE_EXISTING);
+                Files.deleteIfExists(Paths.get(tempFile.getTempPath()));
+                log.info("鏂囦欢杩佺Щ鎴愬姛: {} -> {}", tempFile.getTempPath(), formalFilePath);
+
+                // 鏇存柊鏂囦欢璁板綍锛堝叧鑱斿埌涓氬姟ID锛�
+                CommonFile fileRecord = new CommonFile();
+                fileRecord.setCommonId(businessId);
+                fileRecord.setName(originalFilename);
+                fileRecord.setUrl(formalFilePath.toString());
+                fileRecord.setCreateTime(LocalDateTime.now());
+                //閿�鍞�
+                fileRecord.setType(FileNameType.SALE.getValue());
+                commonFileMapper.insert(fileRecord);
+
+                // 鍒犻櫎涓存椂鏂囦欢璁板綍
+                tempFileMapper.deleteById(tempFile);
+
+                log.info("鏂囦欢杩佺Щ鎴愬姛: {} -> {}", tempFile.getTempPath(), formalFilePath);
+            } catch (IOException e) {
+                log.error("鏂囦欢杩佺Щ澶辫触: {}", tempFile.getTempPath(), e);
+                // 鍙�夋嫨鍥炴粴浜嬪姟鎴栬褰曞け璐ユ枃浠�
+                throw new IOException("鏂囦欢杩佺Щ寮傚父", e);
+            }
         }
-        return 1;
     }
 
     // 鏂囦欢杩佺Щ鏂规硶
diff --git a/src/main/java/com/ruoyi/sales/service/impl/SalesQuotationServiceImpl.java b/src/main/java/com/ruoyi/sales/service/impl/SalesQuotationServiceImpl.java
index a58bcfc..1ec6a8d 100644
--- a/src/main/java/com/ruoyi/sales/service/impl/SalesQuotationServiceImpl.java
+++ b/src/main/java/com/ruoyi/sales/service/impl/SalesQuotationServiceImpl.java
@@ -11,8 +11,8 @@
 import com.ruoyi.approve.service.impl.ApproveProcessServiceImpl;
 import com.ruoyi.approve.bean.vo.ApproveGetAndUpdateVo;
 import com.ruoyi.approve.bean.vo.ApproveProcessVO;
-import com.ruoyi.basic.dto.CustomerPrivatePoolDto;
-import com.ruoyi.basic.mapper.CustomerPrivatePoolMapper;
+import com.ruoyi.basic.mapper.CustomerMapper;
+import com.ruoyi.basic.pojo.Customer;
 import com.ruoyi.common.utils.OrderUtils;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.bean.BeanUtils;
@@ -42,7 +42,7 @@
     private final SalesQuotationProductService salesQuotationProductService;
 
     private final ApproveProcessServiceImpl approveProcessService;
-    private final CustomerPrivatePoolMapper customerPrivatePoolMapper;
+    private final CustomerMapper customerMapper;
 
     @Override
     public IPage<SalesQuotationDto> listPage(Page page, SalesQuotationDto salesQuotationDto) {
@@ -61,10 +61,9 @@
     public boolean add(SalesQuotationDto salesQuotationDto) {
         LoginUser loginUser = SecurityUtils.getLoginUser();
         SalesQuotation salesQuotation = new SalesQuotation();
-        CustomerPrivatePoolDto customerPrivatePoolDto = customerPrivatePoolMapper.selectInfo(Long.valueOf(salesQuotationDto.getCustomer()));
-        if (ObjectUtils.isNotEmpty(customerPrivatePoolDto))  {
-            BeanUtils.copyProperties(salesQuotationDto, salesQuotation);
-            salesQuotation.setCustomer(customerPrivatePoolDto.getCustomerName());
+        Customer customer = customerMapper.selectById(Long.valueOf(salesQuotationDto.getCustomerId()));
+        if (ObjectUtils.isNotEmpty(customer))  {
+            salesQuotation.setCustomer(customer.getCustomerName());
         }
         String quotationNo = OrderUtils.countTodayByCreateTime(salesQuotationMapper, "QT","quotation_no");
         salesQuotation.setQuotationNo(quotationNo);
@@ -93,7 +92,7 @@
             approveProcessService.addApprove(approveProcessVO);
         }catch (Exception e){
             log.error("SalesQuotationServiceImpl error:{}", e);
-            throw new RuntimeException("瀹℃壒澶辫触");
+            throw                                new RuntimeException("瀹℃壒澶辫触");
         }
         return true;
     }
diff --git a/src/main/java/com/ruoyi/staff/controller/PersonalAttendanceLocationConfigController.java b/src/main/java/com/ruoyi/staff/controller/PersonalAttendanceLocationConfigController.java
index aa40835..7b4ba61 100644
--- a/src/main/java/com/ruoyi/staff/controller/PersonalAttendanceLocationConfigController.java
+++ b/src/main/java/com/ruoyi/staff/controller/PersonalAttendanceLocationConfigController.java
@@ -1,17 +1,12 @@
 package com.ruoyi.staff.controller;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.framework.web.domain.AjaxResult;
 import com.ruoyi.framework.web.domain.R;
-import com.ruoyi.staff.dto.PersonalAttendanceRecordsDto;
 import com.ruoyi.staff.pojo.PersonalAttendanceLocationConfig;
-import com.ruoyi.staff.pojo.PersonalAttendanceRecords;
 import com.ruoyi.staff.service.PersonalAttendanceLocationConfigService;
-import io.swagger.v3.oas.annotations.tags.Tag;
 import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
 import lombok.RequiredArgsConstructor;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
@@ -30,7 +25,7 @@
 @RequiredArgsConstructor
 public class PersonalAttendanceLocationConfigController {
 
-    private PersonalAttendanceLocationConfigService personalAttendanceLocationConfigService;
+    private final PersonalAttendanceLocationConfigService personalAttendanceLocationConfigService;
 
     @Operation(summary = "鏂板/淇敼浜哄憳鎵撳崱瑙勫垯閰嶇疆")
     @PostMapping("/add")
diff --git a/src/main/resources/mapper/basic/CustomerMapper.xml b/src/main/resources/mapper/basic/CustomerMapper.xml
index 3b42238..57dea6c 100644
--- a/src/main/resources/mapper/basic/CustomerMapper.xml
+++ b/src/main/resources/mapper/basic/CustomerMapper.xml
@@ -6,17 +6,23 @@
     <resultMap id="BaseResultMap" type="com.ruoyi.basic.pojo.Customer">
         <id column="id" property="id" />
     </resultMap>
-    <select id="listPage" resultType="com.ruoyi.basic.dto.CustomerDto">
+    <select id="listPage" resultType="com.ruoyi.basic.vo.CustomerVo">
         select
         c.*,
         u.user_name usage_user_name,
         (
         select group_concat(u2.user_name separator ', ')
-        from customer_private_pool cpp2
-        left join sys_user u2 on cpp2.bound_id = u2.user_id
-        where cpp2.customer_id = c.id and cpp2.delete_flag = 0
-        and cpp2.bound_id != c.usage_user
-        ) as together_user_names
+        from customer_user cu
+        left join sys_user u2 on cu.user_id = u2.user_id
+        where cu.customer_id = c.id
+        and cu.user_id != c.usage_user
+        ) as together_user_names,
+        (
+        select group_concat(cu.user_id separator ',')
+        from customer_user cu
+        where cu.customer_id = c.id
+        and cu.user_id != c.usage_user
+        ) as user_ids_str
         from customer c
         left join sys_user u on c.usage_user = u.user_id
         <where>
@@ -26,8 +32,79 @@
             <if test="c.customerType != null and c.customerType != ''">
                 and customer_type = #{c.customerType}
             </if>
+            <!-- 鍏捣鏌ヨ锛歵ype = 1锛堝叕娴峰鎴凤級-->
+            <if test="c.type != null and c.type == 1">
+                and type = #{c.type}
+            </if>
+            <!-- 绉佹捣鏌ヨ锛歵ype = 0锛堢娴峰鎴凤級鎴栬�� type = 1锛堝叕娴峰鎴凤級涓斿凡琚垎閰嶏紝骞朵笖鏄嚜宸遍鐢ㄣ�佽嚜宸卞垱寤烘垨鑰呭叡浜粰鑷繁鐨勫鎴� -->
+            <if test="c.type != null and c.type == 0">
+                and (
+                    (type = #{c.type} or (type = 1 and is_assigned = 1))
+                    and (
+                        c.usage_user = #{loginUserId}
+                        or c.create_user = #{loginUserId}
+                        or exists (
+                            select 1 from customer_user cu
+                            where cu.customer_id = c.id
+                            and cu.user_id = #{loginUserId}
+                        )
+                    )
+                )
+            </if>
         </where>
     </select>
 
-
-</mapper>
+    <select id="list" resultType="com.ruoyi.basic.vo.CustomerVo">
+        select
+        c.*,
+        u.user_name usage_user_name,
+        (
+        select group_concat(u2.user_name separator ', ')
+        from customer_user cu
+        left join sys_user u2 on cu.user_id = u2.user_id
+        where cu.customer_id = c.id
+        and cu.user_id != c.usage_user
+        ) as together_user_names,
+        (
+        select group_concat(cu.user_id separator ',')
+        from customer_user cu
+        where cu.customer_id = c.id
+        and cu.user_id != c.usage_user
+        ) as user_ids_str
+        from customer c
+        left join sys_user u on c.usage_user = u.user_id
+        <where>
+            <if test="c.ids != null and c.ids.length > 0">
+                and c.id in
+                <foreach collection="c.ids" item="id" open="(" separator="," close=")">
+                    #{id}
+                </foreach>
+            </if>
+            <if test="c.customerName != null and c.customerName != ''">
+                and customer_name like concat('%', #{c.customerName}, '%')
+            </if>
+            <if test="c.customerType != null and c.customerType != ''">
+                and customer_type = #{c.customerType}
+            </if>
+            <!-- 鍏捣鏌ヨ锛歵ype = 1锛堝叕娴峰鎴凤級-->
+            <if test="c.type != null and c.type == 1">
+                and type = #{c.type}
+            </if>
+            <!-- 绉佹捣鏌ヨ锛歵ype = 0锛堢娴峰鎴凤級鎴栬�� type = 1锛堝叕娴峰鎴凤級涓斿凡琚垎閰嶏紝骞朵笖鏄嚜宸遍鐢ㄣ�佽嚜宸卞垱寤烘垨鑰呭叡浜粰鑷繁鐨勫鎴� -->
+            <if test="c.type != null and c.type == 0">
+                and (
+                    (type = #{c.type} or (type = 1 and is_assigned = 1))
+                    and (
+                        c.usage_user = #{loginUserId}
+                        or c.create_user = #{loginUserId}
+                        or exists (
+                            select 1 from customer_user cu
+                            where cu.customer_id = c.id
+                            and cu.user_id = #{loginUserId}
+                        )
+                    )
+                )
+            </if>
+        </where>
+    </select>
+</mapper>
\ No newline at end of file
diff --git a/src/main/resources/mapper/basic/CustomerPrivateMapper.xml b/src/main/resources/mapper/basic/CustomerPrivateMapper.xml
deleted file mode 100644
index 9a8d68c..0000000
--- a/src/main/resources/mapper/basic/CustomerPrivateMapper.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.ruoyi.basic.mapper.CustomerPrivateMapper">
-
-    <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 -->
-    <resultMap id="BaseResultMap" type="com.ruoyi.basic.pojo.CustomerPrivate">
-        <id column="id" property="id" />
-        <result column="customer_name" property="customerName" />
-        <result column="taxpayer_identification_number" property="taxpayerIdentificationNumber" />
-        <result column="company_address" property="companyAddress" />
-        <result column="company_phone" property="companyPhone" />
-        <result column="contact_person" property="contactPerson" />
-        <result column="contact_phone" property="contactPhone" />
-        <result column="maintainer" property="maintainer" />
-        <result column="maintenance_time" property="maintenanceTime" />
-        <result column="tenant_id" property="tenantId" />
-        <result column="basic_bank_account" property="basicBankAccount" />
-        <result column="bank_account" property="bankAccount" />
-        <result column="bank_code" property="bankCode" />
-        <result column="customer_type" property="customerType" />
-        <result column="create_user" property="createUser" />
-        <result column="dept_id" property="deptId" />
-    </resultMap>
-
-</mapper>
diff --git a/src/main/resources/mapper/basic/CustomerPrivatePoolMapper.xml b/src/main/resources/mapper/basic/CustomerPrivatePoolMapper.xml
deleted file mode 100644
index c7f33c8..0000000
--- a/src/main/resources/mapper/basic/CustomerPrivatePoolMapper.xml
+++ /dev/null
@@ -1,101 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.ruoyi.basic.mapper.CustomerPrivatePoolMapper">
-
-    <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 -->
-    <resultMap id="BaseResultMap" type="com.ruoyi.basic.pojo.CustomerPrivatePool">
-        <id column="id" property="id" />
-        <result column="customer_id" property="customerId" />
-        <result column="bound_id" property="boundId" />
-        <result column="create_user" property="createUser" />
-        <result column="update_user" property="updateUser" />
-        <result column="create_time" property="createTime" />
-        <result column="update_time" property="updateTime" />
-    </resultMap>
-    <select id="listPage" resultType="com.ruoyi.basic.dto.CustomerPrivatePoolDto">
-        select cpp.id,
-        cpp.bound_id,
-        cpp.type,
-        coalesce(c.id, cp.id) as customer_id,
-        coalesce(c.customer_name, cp.customer_name) as customer_name,
-        coalesce(c.customer_type, cp.customer_type) as customer_type,
-        coalesce(c.taxpayer_identification_number, cp.taxpayer_identification_number) as taxpayer_identification_number,
-        coalesce(c.company_address, cp.company_address) as company_address,
-        coalesce(c.company_phone, cp.company_phone) as company_phone,
-        coalesce(c.contact_person, cp.contact_person) as contact_person,
-        coalesce(c.contact_phone, cp.contact_phone) as contact_phone,
-        coalesce(c.maintainer, cp.maintainer) as maintainer,
-        coalesce(c.maintenance_time, cp.maintenance_time) as maintenance_time,
-        coalesce(c.tenant_id, cp.tenant_id) as tenant_id,
-        coalesce(c.basic_bank_account, cp.basic_bank_account) as basic_bank_account,
-        coalesce(c.bank_account, cp.bank_account) as bank_account,
-        coalesce(c.bank_code, cp.bank_code) as bank_code
-        from customer_private_pool cpp
-        left join customer c on c.id = cpp.customer_id and cpp.type = 1
-        left join customer_private cp on cp.id = cpp.customer_id and cpp.type = 0
-        <where>
-            cpp.delete_flag = 0
-            <if test="c.customerName != null and c.customerName != ''">
-                and (c.customer_name like concat('%', #{c.customerName}, '%') or cp.customer_name like concat('%', #{c.customerName}, '%'))
-            </if>
-            <if test="c.customerType != null">
-                and c.customer_type = #{c.customerType}
-            </if>
-            <if test="c.boundId != null">
-                and cpp.bound_id = #{c.boundId}
-            </if>
-
-        </where>
-        order by cpp.id desc
-    </select>
-    <select id="selectInfo" resultType="com.ruoyi.basic.dto.CustomerPrivatePoolDto">
-        select cpp.id,
-               cpp.bound_id,
-               cpp.type,
-               coalesce(c.id, cp.id) as customer_id,
-               coalesce(c.customer_name, cp.customer_name) as customer_name,
-               coalesce(c.customer_type, cp.customer_type) as customer_type,
-               coalesce(c.taxpayer_identification_number, cp.taxpayer_identification_number) as taxpayer_identification_number,
-               coalesce(c.company_address, cp.company_address) as company_address,
-               coalesce(c.company_phone, cp.company_phone) as company_phone,
-               coalesce(c.contact_person, cp.contact_person) as contact_person,
-               coalesce(c.contact_phone, cp.contact_phone) as contact_phone,
-               coalesce(c.maintainer, cp.maintainer) as maintainer,
-               coalesce(c.maintenance_time, cp.maintenance_time) as maintenance_time,
-               coalesce(c.tenant_id, cp.tenant_id) as tenant_id,
-               coalesce(c.basic_bank_account, cp.basic_bank_account) as basic_bank_account,
-               coalesce(c.bank_account, cp.bank_account) as bank_account,
-               coalesce(c.bank_code, cp.bank_code) as bank_code
-        from customer_private_pool cpp
-                 left join customer c on c.id = cpp.customer_id and cpp.type = 1
-                 left join customer_private cp on cp.id = cpp.customer_id and cpp.type = 0
-        <where>
-            <if test="id != null">
-                and cpp.id = #{id}
-            </if>
-        </where>
-    </select>
-    <select id="selectInfos" resultType="com.ruoyi.basic.dto.CustomerPrivatePoolDto">
-        select cpp.id,
-               cpp.bound_id,
-               cpp.type,
-               coalesce(c.id, cp.id) as customer_id,
-               coalesce(c.customer_name, cp.customer_name) as customer_name,
-               coalesce(c.customer_type, cp.customer_type) as customer_type,
-               coalesce(c.taxpayer_identification_number, cp.taxpayer_identification_number) as taxpayer_identification_number,
-               coalesce(c.company_address, cp.company_address) as company_address,
-               coalesce(c.company_phone, cp.company_phone) as company_phone,
-               coalesce(c.contact_person, cp.contact_person) as contact_person,
-               coalesce(c.contact_phone, cp.contact_phone) as contact_phone,
-               coalesce(c.maintainer, cp.maintainer) as maintainer,
-               coalesce(c.maintenance_time, cp.maintenance_time) as maintenance_time,
-               coalesce(c.tenant_id, cp.tenant_id) as tenant_id,
-               coalesce(c.basic_bank_account, cp.basic_bank_account) as basic_bank_account,
-               coalesce(c.bank_account, cp.bank_account) as bank_account,
-               coalesce(c.bank_code, cp.bank_code) as bank_code
-        from customer_private_pool cpp
-                 left join customer c on c.id = cpp.customer_id and cpp.type = 1
-                 left join customer_private cp on cp.id = cpp.customer_id and cpp.type = 0
-    </select>
-
-</mapper>

--
Gitblit v1.9.3