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