From 2f0b6462dc65c54e5d1e6d480250e34401ccb077 Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期四, 08 五月 2025 11:00:08 +0800
Subject: [PATCH] 客户档案完善
---
src/main/java/com/ruoyi/basic/controller/CustomerController.java | 49 ++++++++++++++++++++-----------------------------
1 files changed, 20 insertions(+), 29 deletions(-)
diff --git a/src/main/java/com/ruoyi/basic/controller/CustomerController.java b/src/main/java/com/ruoyi/basic/controller/CustomerController.java
index 1c27557..102517c 100644
--- a/src/main/java/com/ruoyi/basic/controller/CustomerController.java
+++ b/src/main/java/com/ruoyi/basic/controller/CustomerController.java
@@ -6,8 +6,6 @@
import com.ruoyi.basic.pojo.Customer;
import com.ruoyi.basic.service.ICustomerService;
import lombok.AllArgsConstructor;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
@@ -25,25 +23,21 @@
/**
* 瀹㈡埛妗fController
- *
+ *
* @author ruoyi
* @date 2025-05-07
*/
@RestController
-@RequestMapping("/system/customer")
+@RequestMapping("/basic/customer")
@AllArgsConstructor
-public class CustomerController extends BaseController
-{
- @Autowired
+public class CustomerController extends BaseController {
private ICustomerService customerService;
/**
* 鏌ヨ瀹㈡埛妗f鍒楄〃
*/
- @PreAuthorize("@ss.hasPermi('system:customer:list')")
@GetMapping("/list")
- public TableDataInfo list(Customer customer)
- {
+ public TableDataInfo list(Customer customer) {
startPage();
List<Customer> list = customerService.selectCustomerList(customer);
return getDataTable(list);
@@ -52,12 +46,17 @@
/**
* 瀵煎嚭瀹㈡埛妗f鍒楄〃
*/
- @PreAuthorize("@ss.hasPermi('system:customer:export')")
@Log(title = "瀹㈡埛妗f", businessType = BusinessType.EXPORT)
@PostMapping("/export")
- public void export(HttpServletResponse response, Customer customer)
- {
- List<Customer> list = customerService.selectCustomerList(customer);
+ 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.selectCustomerList(customer);
+ }
ExcelUtil<Customer> util = new ExcelUtil<Customer>(Customer.class);
util.exportExcel(response, list, "瀹㈡埛妗f鏁版嵁");
}
@@ -65,43 +64,35 @@
/**
* 鑾峰彇瀹㈡埛妗f璇︾粏淇℃伅
*/
- @PreAuthorize("@ss.hasPermi('system:customer:query')")
@GetMapping(value = "/{id}")
- public AjaxResult getInfo(@PathVariable("id") Long id)
- {
+ public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(customerService.selectCustomerById(id));
}
/**
* 鏂板瀹㈡埛妗f
*/
- @PreAuthorize("@ss.hasPermi('system:customer:add')")
@Log(title = "瀹㈡埛妗f", businessType = BusinessType.INSERT)
- @PostMapping
- public AjaxResult add(@RequestBody Customer customer)
- {
+ @PostMapping("/addCustomer")
+ public AjaxResult add(@RequestBody Customer customer) {
return toAjax(customerService.insertCustomer(customer));
}
/**
* 淇敼瀹㈡埛妗f
*/
- @PreAuthorize("@ss.hasPermi('system:customer:edit')")
@Log(title = "瀹㈡埛妗f", businessType = BusinessType.UPDATE)
- @PutMapping
- public AjaxResult edit(@RequestBody Customer customer)
- {
+ @PutMapping ("/updateCustomer")
+ public AjaxResult edit(@RequestBody Customer customer) {
return toAjax(customerService.updateCustomer(customer));
}
/**
* 鍒犻櫎瀹㈡埛妗f
*/
- @PreAuthorize("@ss.hasPermi('system:customer:remove')")
@Log(title = "瀹㈡埛妗f", businessType = BusinessType.DELETE)
- @DeleteMapping("/{ids}")
- public AjaxResult remove(@PathVariable Long[] ids)
- {
+ @DeleteMapping("/{ids}")
+ public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(customerService.deleteCustomerByIds(ids));
}
}
--
Gitblit v1.9.3