From 2b382a92207dfabf0eb30e743265df5c7c50e7bc Mon Sep 17 00:00:00 2001
From: liyong <18434998025@163.com>
Date: 星期四, 07 五月 2026 14:27:45 +0800
Subject: [PATCH] feat(approve): 新增办公用品审批功能
---
src/main/java/com/ruoyi/basic/controller/CustomerController.java | 121 ++++++++++++++++++++++++++++------------
1 files changed, 84 insertions(+), 37 deletions(-)
diff --git a/src/main/java/com/ruoyi/basic/controller/CustomerController.java b/src/main/java/com/ruoyi/basic/controller/CustomerController.java
index cc94893..9090d34 100644
--- a/src/main/java/com/ruoyi/basic/controller/CustomerController.java
+++ b/src/main/java/com/ruoyi/basic/controller/CustomerController.java
@@ -1,24 +1,22 @@
package com.ruoyi.basic.controller;
-import java.util.List;
-import javax.servlet.http.HttpServletResponse;
-
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.basic.dto.CustomerDto;
import com.ruoyi.basic.pojo.Customer;
import com.ruoyi.basic.service.ICustomerService;
-import lombok.AllArgsConstructor;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+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.common.utils.poi.ExcelUtil;
-import com.ruoyi.framework.web.page.TableDataInfo;
+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;
/**
* 瀹㈡埛妗fController
@@ -36,10 +34,9 @@
* 鏌ヨ瀹㈡埛妗f鍒楄〃
*/
@GetMapping("/list")
- public TableDataInfo list(Customer customer) {
- startPage();
- List<Customer> list = customerService.selectCustomerList(customer);
- return getDataTable(list);
+ public R list(Page<CustomerDto> page, CustomerDto customer) {
+ IPage<CustomerVo> customerDtoIPage = customerService.selectCustomerList(page, customer);
+ return R.ok(customerDtoIPage);
}
/**
@@ -47,25 +44,35 @@
*/
@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 {
+ public void export(HttpServletResponse response, CustomerDto customer) {
+ ExcelUtil<CustomerVo> util = new ExcelUtil<CustomerVo>(CustomerVo.class);
+ util.exportExcel(response, customerService.selectCustomerLists(customer), "瀹㈡埛妗f鏁版嵁");
+ }
- list = customerService.selectCustomerList(customer);
- }
+ @PostMapping("/downloadTemplate")
+ @Log(title = "瀹㈡埛妗f-涓嬭浇妯℃澘", businessType = BusinessType.EXPORT)
+ public void downloadTemplate(HttpServletResponse response) {
ExcelUtil<Customer> util = new ExcelUtil<Customer>(Customer.class);
- util.exportExcel(response, list, "瀹㈡埛妗f鏁版嵁");
+ util.importTemplateExcel(response, "瀹㈡埛妗f妯℃澘");
+ }
+
+
+ /**
+ * 瀵煎叆瀹㈡埛妗f
+ */
+ @Log(title = "瀹㈡埛妗f", businessType = BusinessType.IMPORT)
+ @PostMapping("/importData")
+ public R importData(MultipartFile file, Integer type) throws Exception {
+
+ return customerService.importData(file, type);
}
/**
* 鑾峰彇瀹㈡埛妗f璇︾粏淇℃伅
*/
@GetMapping(value = "/{id}")
- public AjaxResult getInfo(@PathVariable("id") Long id) {
- return success(customerService.selectCustomerById(id));
+ public R getInfo(@PathVariable("id") Long id) {
+ return R.ok(customerService.selectCustomerDetailById(id));
}
/**
@@ -73,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));
}
/**
@@ -82,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));
}
/**
@@ -91,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));
}
/**
@@ -103,6 +110,46 @@
*/
@GetMapping("/customerList")
public List customerList(Customer customer) {
- return customerService.customerList(customer);
+ return customerService.customerList(customer);
+ }
+
+
+ /**
+ * 鍒嗛厤瀹㈡埛
+ */
+ @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));
}
}
--
Gitblit v1.9.3