From d3b5fe3ea8c054055c9cc5ef450a180584968aea Mon Sep 17 00:00:00 2001 From: chenrui <1187576398@qq.com> Date: 星期四, 08 五月 2025 17:33:13 +0800 Subject: [PATCH] 开票登记功能开发 --- src/main/java/com/ruoyi/basic/controller/CustomerController.java | 40 ++++++++++++++++++++-------------------- 1 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/main/java/com/ruoyi/basic/controller/CustomerController.java b/src/main/java/com/ruoyi/basic/controller/CustomerController.java index 1a81652..33e229c 100644 --- a/src/main/java/com/ruoyi/basic/controller/CustomerController.java +++ b/src/main/java/com/ruoyi/basic/controller/CustomerController.java @@ -23,23 +23,21 @@ /** * 瀹㈡埛妗fController - * + * * @author ruoyi * @date 2025-05-07 */ @RestController -@RequestMapping("/system/customer") +@RequestMapping("/basic/customer") @AllArgsConstructor -public class CustomerController extends BaseController -{ +public class CustomerController extends BaseController { private ICustomerService customerService; /** * 鏌ヨ瀹㈡埛妗f鍒楄〃 */ @GetMapping("/list") - public TableDataInfo list(Customer customer) - { + public TableDataInfo list(Customer customer) { startPage(); List<Customer> list = customerService.selectCustomerList(customer); return getDataTable(list); @@ -50,9 +48,15 @@ */ @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鏁版嵁"); } @@ -61,8 +65,7 @@ * 鑾峰彇瀹㈡埛妗f璇︾粏淇℃伅 */ @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) - { + public AjaxResult getInfo(@PathVariable("id") Long id) { return success(customerService.selectCustomerById(id)); } @@ -70,9 +73,8 @@ * 鏂板瀹㈡埛妗f */ @Log(title = "瀹㈡埛妗f", businessType = BusinessType.INSERT) - @PostMapping ("/addCustomer") - public AjaxResult add(@RequestBody Customer customer) - { + @PostMapping("/addCustomer") + public AjaxResult add(@RequestBody Customer customer) { return toAjax(customerService.insertCustomer(customer)); } @@ -80,9 +82,8 @@ * 淇敼瀹㈡埛妗f */ @Log(title = "瀹㈡埛妗f", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody Customer customer) - { + @PostMapping("/updateCustomer") + public AjaxResult edit(@RequestBody Customer customer) { return toAjax(customerService.updateCustomer(customer)); } @@ -90,9 +91,8 @@ * 鍒犻櫎瀹㈡埛妗f */ @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