From b22ebe8fad1691b35adcf321fe2e136795b3f81d Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期一, 29 六月 2026 17:58:00 +0800
Subject: [PATCH] 库位

---
 src/main/java/com/ruoyi/device/controller/DeviceLedgerController.java |   38 +++++++++++++++++++++++---------------
 1 files changed, 23 insertions(+), 15 deletions(-)

diff --git a/src/main/java/com/ruoyi/device/controller/DeviceLedgerController.java b/src/main/java/com/ruoyi/device/controller/DeviceLedgerController.java
index f4b807d..4992cd4 100644
--- a/src/main/java/com/ruoyi/device/controller/DeviceLedgerController.java
+++ b/src/main/java/com/ruoyi/device/controller/DeviceLedgerController.java
@@ -35,30 +35,29 @@
     private DeviceMaintenanceMapper deviceMaintenanceMapper;
 
 
-
     @Operation(summary = "璁惧鍙拌处鍒楄〃")
     @GetMapping("/page")
-    public AjaxResult page(Page page , DeviceLedgerDto deviceLedger) {
-        return AjaxResult.success(deviceLedgerService.queryPage(page,deviceLedger));
+    public AjaxResult page(Page page, DeviceLedgerDto deviceLedger) {
+        return AjaxResult.success(deviceLedgerService.queryPage(page, deviceLedger));
     }
 
     @PostMapping()
     @Operation(summary = "娣诲姞璁惧鍙拌处")
-    public AjaxResult add(@RequestBody DeviceLedger deviceLedger) {
-
-        return deviceLedgerService.saveDeviceLedger(deviceLedger);
+    public AjaxResult add(@RequestBody DeviceLedgerDto deviceLedgerDto) {
+        return deviceLedgerService.saveDeviceLedger(deviceLedgerDto);
     }
 
     @Operation(summary = "鏍规嵁id鏌ヨ璁惧鍙拌处")
     @GetMapping("/{id}")
     public AjaxResult detail(@PathVariable Long id) {
-        return AjaxResult.success(deviceLedgerService.getById(id));
+        DeviceLedgerDto deviceLedgerDto = deviceLedgerService.getDeviceLedgerDetail(id);
+        return AjaxResult.success(deviceLedgerDto);
     }
 
-    @PutMapping ()
+    @PutMapping()
     @Operation(summary = "淇敼璁惧鍙拌处")
-    public AjaxResult update(@RequestBody DeviceLedger deviceLedger) {
-        return deviceLedgerService.updateDeviceLedger(deviceLedger);
+    public AjaxResult update(@RequestBody DeviceLedgerDto deviceLedgerDto) {
+        return deviceLedgerService.updateDeviceLedger(deviceLedgerDto);
     }
 
     @DeleteMapping("/{ids}")
@@ -74,7 +73,7 @@
     @PostMapping("export")
     @Operation(summary = "瀵煎嚭璁惧鍙拌处")
     public void export(HttpServletResponse response, Long[] ids) {
-         deviceLedgerService.export(response, ids);
+        deviceLedgerService.export(response, ids);
     }
 
     @Operation(summary = "涓嬭浇妯℃澘")
@@ -97,9 +96,9 @@
 
     @GetMapping("getDeviceLedger")
     @Operation(summary = "鑾峰彇璁惧鍙拌处")
-    public AjaxResult getDeviceLedger( ) {
+    public AjaxResult getDeviceLedger() {
         return AjaxResult.success(deviceLedgerService.list(new QueryWrapper<DeviceLedger>().lambda()
-                .select(DeviceLedger::getId, DeviceLedger::getDeviceName,DeviceLedger::getDeviceModel)));
+                .select(DeviceLedger::getId, DeviceLedger::getDeviceName, DeviceLedger::getDeviceModel)));
     }
 
     @GetMapping("scanDevice")
@@ -108,10 +107,19 @@
     public AjaxResult scanDevice(Long id) {
         List<DeviceMaintenance> list = deviceMaintenanceMapper.list1(id);
         DeviceLedger deviceLedger = deviceLedgerMapper.selectById1(id);
-        if (list.size()>0){
-            deviceLedger.setUpdateTime(list.get(0).getMaintenanceActuallyTime());//鏈�鍚庣淮鎶ゆ椂闂�
+        if (!list.isEmpty()) {
+            deviceLedger.setUpdateTime(list.getFirst().getMaintenanceActuallyTime());//鏈�鍚庣淮鎶ゆ椂闂�
         }
         deviceLedger.setCreateTime(deviceLedger.getUpdateTime().plusMonths(1));//涓嬫缁存姢鏃堕棿
         return AjaxResult.success(deviceLedger);
     }
+
+    @GetMapping("iotDeviceList")
+    @Operation(summary = "鑾峰彇IoT璁惧鍒楄〃锛坕s_iot_device=1锛�")
+    public AjaxResult iotDeviceList() {
+        return AjaxResult.success(deviceLedgerMapper.selectList(
+                new QueryWrapper<DeviceLedger>().lambda()
+                        .eq(DeviceLedger::getIsIotDevice, 1)
+                        .select(DeviceLedger::getId, DeviceLedger::getDeviceName, DeviceLedger::getStorageLocation)));
+    }
 }

--
Gitblit v1.9.3