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/BasStationController.java |   76 ++++++++++++++++++++++++++++---------
 1 files changed, 57 insertions(+), 19 deletions(-)

diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/BasStationController.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/BasStationController.java
index e76bba3..1005cbc 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/BasStationController.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/BasStationController.java
@@ -10,18 +10,24 @@
 import com.vincent.rsf.server.common.domain.BaseParam;
 import com.vincent.rsf.server.common.domain.KeyValVo;
 import com.vincent.rsf.server.common.domain.PageParam;
+import com.vincent.rsf.server.common.domain.PageResult;
+import com.vincent.rsf.server.manager.controller.vo.BasStationOptionVo;
 import com.vincent.rsf.server.manager.entity.BasStation;
 import com.vincent.rsf.server.manager.enums.LocStsType;
 import com.vincent.rsf.server.manager.service.BasStationService;
+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 io.swagger.annotations.Api;
 import org.springframework.web.bind.annotation.*;
 
-import javax.servlet.http.HttpServletResponse;
+import jakarta.servlet.http.HttpServletResponse;
 import java.util.*;
+import java.util.stream.Collectors;
 
 @RestController
+@Api(tags = "绔欑偣绠$悊")
 public class BasStationController extends BaseController {
 
     @Autowired
@@ -35,16 +41,20 @@
         PageParam<BasStation, BaseParam> page = basStationService.page(pageParam, pageParam.buildWrapper(true));
         for (BasStation station : page.getRecords()) {
             if (!Cools.isEmpty(station.getCrossZoneArea())) {
-                List<Long> longs1 = station.getCrossZoneArea();
+                List<Long> longs1 = station.getCrossZoneArea().stream()
+                        .map(Integer::longValue)
+                        .collect(Collectors.toList());
                 station.setAreaIds(longs1);
             }
             if (!Cools.isEmpty(station.getContainerType())) {
-                List<Long> longs1 = station.getContainerType();
+                List<Long> longs1 = station.getContainerType().stream()
+                        .map(Integer::longValue)
+                        .collect(Collectors.toList());
                 station.setContainerTypes(longs1);
             }
 
         }
-        return R.ok().add(page);
+        return R.ok().add(buildPageRowsUtils.rowsMap(page));
     }
 
     @PreAuthorize("hasAuthority('manager:warehouseAreas:list')")
@@ -52,19 +62,27 @@
     public R pagev22(@RequestBody Map<String, Object> map) {
         BaseParam baseParam = buildParam(map, BaseParam.class);
         PageParam<BasStation, BaseParam> pageParam = new PageParam<>(baseParam, BasStation.class);
-        return R.ok().add(basStationService.page(pageParam, pageParam.buildWrapper(true)));
+        PageParam<BasStation, BaseParam> page = basStationService.page(
+                pageParam,
+                pageParam.buildWrapper(true).select("id", "station_name", "station_id")
+        );
+        PageResult<BasStationOptionVo> pageResult = new PageResult<>();
+        pageResult
+                .setTotal(page.getTotal())
+                .setRecords(page.getRecords().stream().map(this::buildOptionVo).collect(Collectors.toList()));
+        return R.ok().add(buildPageRowsUtils.rowsMap(pageResult));
     }
 
     @PreAuthorize("hasAuthority('manager:basStation:list')")
     @PostMapping("/basStation/list")
     public R list(@RequestBody Map<String, Object> map) {
-        return R.ok().add(basStationService.list());
+        return R.ok().add(buildPageRowsUtils.rowsMap(basStationService.list()));
     }
 
     @PreAuthorize("hasAuthority('manager:basStation:list')")
     @PostMapping({"/basStation/many/{ids}", "/basStations/many/{ids}"})
     public R many(@PathVariable Long[] ids) {
-        return R.ok().add(basStationService.listByIds(Arrays.asList(ids)));
+        return R.ok().add(buildPageRowsUtils.rowsMap(basStationService.listByIds(Arrays.asList(ids))));
     }
 
     @PreAuthorize("hasAuthority('manager:basStation:list')")
@@ -72,15 +90,19 @@
     public R get(@PathVariable("id") Long id) {
         BasStation station = basStationService.getById(id);
         if (!Cools.isEmpty(station.getCrossZoneArea())) {
-            List<Long> longs1 = station.getCrossZoneArea();
+            List<Long> longs1 = station.getCrossZoneArea().stream()
+                    .map(Integer::longValue)
+                    .collect(Collectors.toList());
             station.setAreaIds(longs1);
         }
         if (!Cools.isEmpty(station.getContainerType())) {
-            List<Long> longs1 = station.getContainerType();
+            List<Long> longs1 = station.getContainerType().stream()
+                    .map(Integer::longValue)
+                    .collect(Collectors.toList());
             station.setContainerTypes(longs1);
         }
 
-        return R.ok().add(station);
+        return R.ok().add(buildPageRowsUtils.rowsMap(station));
     }
 
     @PreAuthorize("hasAuthority('manager:basStation:save')")
@@ -96,10 +118,14 @@
             return R.error(basStation.getStationName()+"绔欏凡琚垵濮嬪寲");
         }
         if (null !=basStation.getAreaIds()){
-            basStation.setCrossZoneArea(basStation.getAreaIds());
+            basStation.setCrossZoneArea(basStation.getAreaIds().stream()
+                    .map(Long::intValue)
+                    .collect(Collectors.toList()));
         }
         if (null !=basStation.getContainerTypes()){
-            basStation.setContainerType(basStation.getContainerTypes());
+            basStation.setContainerType(basStation.getContainerTypes().stream()
+                    .map(Long::intValue)
+                    .collect(Collectors.toList()));
         }
         if (Cools.isEmpty(basStation.getStationAlias())){
             basStation.setStationAlias(new ArrayList<>());
@@ -110,7 +136,7 @@
         if (!basStationService.save(basStation)) {
             return R.error("淇濆瓨澶辫触");
         }
-        return R.ok("淇濆瓨鎴愬姛").add(basStation);
+        return R.ok("淇濆瓨鎴愬姛").add(buildPageRowsUtils.rowsMap(basStation));
     }
 
     @PreAuthorize("hasAuthority('manager:basStation:update')")
@@ -120,10 +146,14 @@
         basStation.setUpdateBy(getLoginUserId());
         basStation.setUpdateTime(new Date());
         if (null !=basStation.getAreaIds() && !basStation.getContainerTypes().isEmpty()){
-            basStation.setCrossZoneArea(basStation.getAreaIds());
+            basStation.setCrossZoneArea(basStation.getAreaIds().stream()
+                    .map(Long::intValue)
+                    .collect(Collectors.toList()));
         }
         if (null != basStation.getContainerTypes() && !basStation.getContainerTypes().isEmpty()){
-            basStation.setContainerType(basStation.getContainerTypes());
+            basStation.setContainerType(basStation.getContainerTypes().stream()
+                    .map(Long::intValue)
+                    .collect(Collectors.toList()));
         }
         if (null !=basStation.getUseStatus() && basStation.getUseStatus().equals(LocStsType.LOC_STS_TYPE_O.type)){
             basStation.setBarcode(null);
@@ -137,7 +167,7 @@
         if (!basStationService.updateById(basStation)) {
             return R.error("鏇存柊澶辫触");
         }
-        return R.ok("鏇存柊鎴愬姛").add(basStation);
+        return R.ok("鏇存柊鎴愬姛").add(buildPageRowsUtils.rowsMap(basStation));
     }
 
     @PreAuthorize("hasAuthority('manager:basStation:remove')")
@@ -147,7 +177,7 @@
         if (!basStationService.removeByIds(Arrays.asList(ids))) {
             return R.error("鍒犻櫎澶辫触");
         }
-        return R.ok("鍒犻櫎鎴愬姛").add(ids);
+        return R.ok("鍒犻櫎鎴愬姛").add(buildPageRowsUtils.rowsMap(ids));
     }
 
     @PreAuthorize("hasAuthority('manager:basStation:list')")
@@ -161,13 +191,21 @@
         basStationService.page(new Page<>(1, 30), wrapper).getRecords().forEach(
                 item -> vos.add(new KeyValVo(item.getId(), item.getId()))
         );
-        return R.ok().add(vos);
+        return R.ok().add(buildPageRowsUtils.rowsMap(vos));
     }
 
     @PreAuthorize("hasAuthority('manager:basStation:list')")
     @PostMapping("/basStation/export")
     public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception {
-        ExcelUtil.build(ExcelUtil.create(basStationService.list(), BasStation.class), response);
+        ExcelUtil.build(ExcelUtil.create(buildPageRowsUtils.rowsMap(basStationService.list()), BasStation.class), response);
+    }
+
+    private BasStationOptionVo buildOptionVo(BasStation station) {
+        BasStationOptionVo optionVo = new BasStationOptionVo();
+        optionVo.setId(station.getId());
+        optionVo.setStationName(station.getStationName());
+        optionVo.setStationId(station.getStationId());
+        return optionVo;
     }
 
 }

--
Gitblit v1.9.1