From 05a19473eae58402c2a26fb358559b1328710add Mon Sep 17 00:00:00 2001 From: iioter <535915157@qq.com> Date: Wed, 17 May 2023 22:58:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9F=BA=E7=A1=80=E8=AE=BE=E5=A4=87api:?= =?UTF-8?q?=E8=AE=BE=E5=A4=87=E5=88=97=E8=A1=A8=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IoTGateway/Areas/API/DeviceController.cs | 38 ++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 IoTGateway/Areas/API/DeviceController.cs diff --git a/IoTGateway/Areas/API/DeviceController.cs b/IoTGateway/Areas/API/DeviceController.cs new file mode 100644 index 0000000..6e0d24d --- /dev/null +++ b/IoTGateway/Areas/API/DeviceController.cs @@ -0,0 +1,38 @@ +using System.Linq; +using System.Threading.Tasks; +using IoTGateway.Model; +using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Logging; +using Plugin; +using WalkingTec.Mvvm.Core; +using WalkingTec.Mvvm.Mvc; + +namespace IoTGateway.Areas.API +{ + [Area("API")] + [ActionDescription("MenuKey.ActionLog")] + public class DeviceController : BaseController + { + private readonly ILogger _logger; + private readonly DeviceService _deviceService; + public DeviceController(ILogger logger, DeviceService deviceService) + { + _logger = logger; + _deviceService = deviceService; + + } + /// + /// 获取设备列表 + /// + /// + [Public] + [HttpGet("Device/GetDevices")] + public async Task GetDevices() + { + return Ok(await DC.Set().Include(x => x.Driver).Where(x => x.ParentId != null).AsNoTracking() + .OrderBy(x => x.Index).ToListAsync()); + + } + } +}