首页 > 其他分享 >6

6

时间:2024-11-20 10:00:34浏览次数:1  
标签: Result device import com example demo11

package com.example.demo11.Controller;

import com.example.demo11.Service.DeviceService;
import com.example.demo11.entity.Device;
import com.example.demo11.entity.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
//设备管理
@RestController
@RequestMapping("/device")
public class DeviceController {
@Autowired
private DeviceService deviceService;
@GetMapping("/list")
public Result<List<Device>> list() {
List<Device> device = deviceService.list();
return Result.success(device);
}
@PostMapping("/add")
public Result<Device> add(@RequestBody Device device) {
deviceService.save(device);
return Result.success(device);
}

}

标签:,Result,device,import,com,example,demo11
From: https://www.cnblogs.com/luoqingci/p/18556205

相关文章