From dc31792dc1b8ad1658e49ba8fce9a1be924e6fbb Mon Sep 17 00:00:00 2001 From: wu <731351411@qq.com> Date: 星期四, 30 十一月 2023 08:44:04 +0800 Subject: [PATCH] 理片笼测试修改 --- springboot-vue3/src/main/java/com/example/springboot/controller/device/DeviceController.java | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 43 insertions(+), 0 deletions(-) diff --git a/springboot-vue3/src/main/java/com/example/springboot/controller/device/DeviceController.java b/springboot-vue3/src/main/java/com/example/springboot/controller/device/DeviceController.java new file mode 100644 index 0000000..86c397e --- /dev/null +++ b/springboot-vue3/src/main/java/com/example/springboot/controller/device/DeviceController.java @@ -0,0 +1,43 @@ +package com.example.springboot.controller.device; + + + +import com.example.springboot.service.device.DeviceService; +import com.example.springboot.entity.device.DeviceEntity; +import com.example.springboot.entity.vo.Result; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +@RestController +@RequestMapping("/api/device") // 淇敼璇锋眰璺緞涓� "/api/device" +public class DeviceController { + + private final DeviceService deviceService; + + @Autowired + public DeviceController(DeviceService deviceService) { + this.deviceService = deviceService; + } + + @GetMapping("/getAllDevices") // 淇敼鎺ュ彛璺緞涓� "/getAllDevices" + public Result getAllDevices() { + List<DeviceEntity> devices = deviceService.getAllDevices(); + return Result.success(devices); + } + + @PostMapping("/updateDeviceName") // 淇敼鎺ュ彛璺緞涓� "/updateDeviceName" + public Result updateDeviceName(@RequestBody DeviceEntity device) { + deviceService.updateDeviceName(device); + return Result.success(); + } + @PostMapping("/call-stored-proc") + public Result callStoredProc(@RequestBody DeviceEntity device) { + List<DeviceEntity> result = deviceService.callStoredProc(device); // 鑾峰彇澶氳鏌ヨ缁撴灉 + return Result.success(result); // 杩斿洖鍖呭惈澶氳缁撴灉鐨� Result 瀵硅薄 + } + +} + + -- Gitblit v1.8.0