From 1dcfa3702505f0c431757312b5304531029f90f6 Mon Sep 17 00:00:00 2001
From: zhou zhou <3272660260@qq.com>
Date: 星期四, 09 四月 2026 18:57:38 +0800
Subject: [PATCH] #getter$摘出entity
---
rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/CustomerController.java | 22 ++++++++++++----------
1 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/CustomerController.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/CustomerController.java
index 8359c27..d430936 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/CustomerController.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/CustomerController.java
@@ -11,12 +11,13 @@
import com.vincent.rsf.server.common.domain.PageParam;
import com.vincent.rsf.server.manager.entity.Customer;
import com.vincent.rsf.server.manager.service.CustomerService;
+import com.vincent.rsf.server.manager.utils.buildPageRowsUtils;
import com.vincent.rsf.server.system.controller.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
-import javax.servlet.http.HttpServletResponse;
+import jakarta.servlet.http.HttpServletResponse;
import java.util.*;
@RestController
@@ -30,25 +31,26 @@
public R page(@RequestBody Map<String, Object> map) {
BaseParam baseParam = buildParam(map, BaseParam.class);
PageParam<Customer, BaseParam> pageParam = new PageParam<>(baseParam, Customer.class);
- return R.ok().add(customerService.page(pageParam, pageParam.buildWrapper(true)));
+ PageParam<Customer, BaseParam> page = customerService.page(pageParam, pageParam.buildWrapper(true));
+ return R.ok().add(buildPageRowsUtils.rowsMap(page));
}
@PreAuthorize("hasAuthority('manager:customer:list')")
@PostMapping("/customer/list")
public R list(@RequestBody Map<String, Object> map) {
- return R.ok().add(customerService.list());
+ return R.ok().add(buildPageRowsUtils.rowsMap(customerService.list()));
}
@PreAuthorize("hasAuthority('manager:customer:list')")
@PostMapping({"/customer/many/{ids}", "/customers/many/{ids}"})
public R many(@PathVariable Long[] ids) {
- return R.ok().add(customerService.listByIds(Arrays.asList(ids)));
+ return R.ok().add(buildPageRowsUtils.rowsMap(customerService.listByIds(Arrays.asList(ids))));
}
@PreAuthorize("hasAuthority('manager:customer:list')")
@GetMapping("/customer/{id}")
public R get(@PathVariable("id") Long id) {
- return R.ok().add(customerService.getById(id));
+ return R.ok().add(buildPageRowsUtils.rowsMap(customerService.getById(id)));
}
@PreAuthorize("hasAuthority('manager:customer:save')")
@@ -62,7 +64,7 @@
if (!customerService.save(customer)) {
return R.error("Save Fail");
}
- return R.ok("Save Success").add(customer);
+ return R.ok("Save Success").add(buildPageRowsUtils.rowsMap(customer));
}
@PreAuthorize("hasAuthority('manager:customer:update')")
@@ -74,7 +76,7 @@
if (!customerService.updateById(customer)) {
return R.error("Update Fail");
}
- return R.ok("Update Success").add(customer);
+ return R.ok("Update Success").add(buildPageRowsUtils.rowsMap(customer));
}
@PreAuthorize("hasAuthority('manager:customer:remove')")
@@ -84,7 +86,7 @@
if (!customerService.removeByIds(Arrays.asList(ids))) {
return R.error("Delete Fail");
}
- return R.ok("Delete Success").add(ids);
+ return R.ok("Delete Success").add(buildPageRowsUtils.rowsMap(ids));
}
@PreAuthorize("hasAuthority('manager:customer:list')")
@@ -98,13 +100,13 @@
customerService.page(new Page<>(1, 30), wrapper).getRecords().forEach(
item -> vos.add(new KeyValVo(item.getId(), item.getName()))
);
- return R.ok().add(vos);
+ return R.ok().add(buildPageRowsUtils.rowsMap(vos));
}
@PreAuthorize("hasAuthority('manager:customer:list')")
@PostMapping("/customer/export")
public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception {
- ExcelUtil.build(ExcelUtil.create(customerService.list(), Customer.class), response);
+ ExcelUtil.build(ExcelUtil.create(buildPageRowsUtils.rowsMap(customerService.list()), Customer.class), response);
}
}
--
Gitblit v1.9.1