From 99755eea33cf009c36507df468c244f3be5b34c9 Mon Sep 17 00:00:00 2001
From: chenrui <1187576398@qq.com>
Date: 星期五, 28 二月 2025 17:27:31 +0800
Subject: [PATCH] Merge branch 'dev' of http://114.132.189.42:9002/r/lims-ruoyi-after into dev_cr

---
 cnas-device/src/main/java/com/ruoyi/device/controller/DeviceDocumentsController.java |   92 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 92 insertions(+), 0 deletions(-)

diff --git a/cnas-device/src/main/java/com/ruoyi/device/controller/DeviceDocumentsController.java b/cnas-device/src/main/java/com/ruoyi/device/controller/DeviceDocumentsController.java
new file mode 100644
index 0000000..6cfe1a7
--- /dev/null
+++ b/cnas-device/src/main/java/com/ruoyi/device/controller/DeviceDocumentsController.java
@@ -0,0 +1,92 @@
+package com.ruoyi.device.controller;
+
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.ruoyi.common.core.domain.Result;
+import com.ruoyi.device.pojo.DeviceDocuments;
+import com.ruoyi.device.service.DeviceDocumentsService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+
+
+/**
+ * 璁惧妗f鏂囨。
+ *
+ * @author zhuo
+ * @since 2025-02-28
+ */
+@RestController
+@Api(tags = "璁惧妗f鏂囨。")
+@RequestMapping("/deviceDocuments")
+public class DeviceDocumentsController {
+
+    @Resource
+    private DeviceDocumentsService deviceDocumentsService;
+
+
+    /**
+     * 鏂板璁惧妗f
+     * @param document
+     * @return
+     */
+    @ApiOperation(value = "鏂板璁惧妗f")
+    @PostMapping("/addDocument")
+    public Result addDocument(@RequestBody DeviceDocuments document) {
+        if (document.getDeviceId() == null) {
+            throw new RuntimeException("璁惧id涓虹┖");
+        }
+        deviceDocumentsService.save(document);
+        return Result.success();
+    }
+
+    /**
+     * 鏌ヨ璁惧妗f淇℃伅
+     * @param id
+     * @return
+     */
+    @ApiOperation(value = "鏌ヨ璁惧妗f淇℃伅")
+    @GetMapping("/getDocumentById")
+    public Result getDocumentById(Integer id) {
+        return Result.success(deviceDocumentsService.getById(id));
+    }
+
+    /**
+     * 淇敼璁惧妗f
+     * @param document
+     * @return
+     */
+    @ApiOperation(value = "淇敼璁惧妗f")
+    @PostMapping("/updateDocument")
+    public Result updateDocument(@RequestBody DeviceDocuments document) {
+        return Result.success(deviceDocumentsService.updateById(document));
+    }
+
+    /**
+     * 鍒犻櫎璁惧妗f
+     * @param id
+     * @return
+     */
+    @ApiOperation(value = "鍒犻櫎璁惧妗f")
+    @DeleteMapping("/deleteDocumentById")
+    public Result deleteDocumentById(Integer id) {
+        return Result.success(deviceDocumentsService.removeById(id));
+    }
+
+    /**
+     * 鏌ヨ璁惧妗f鍒楄〃
+     * @param deviceId
+     * @return
+     */
+    @ApiOperation(value = "鏌ヨ璁惧妗f鍒楄〃")
+    @GetMapping("/getAllDocuments")
+    public Result getAllDocuments(Integer deviceId) {
+        LambdaQueryWrapper<DeviceDocuments> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+        lambdaQueryWrapper.eq(DeviceDocuments::getDeviceId, deviceId);
+        return Result.success(deviceDocumentsService.list(lambdaQueryWrapper));
+    }
+
+}
+

--
Gitblit v1.9.3