基础设备api:设备列表查询
This commit is contained in:
parent
1abcce164f
commit
05a19473ea
38
IoTGateway/Areas/API/DeviceController.cs
Normal file
38
IoTGateway/Areas/API/DeviceController.cs
Normal file
@ -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<DeviceController> _logger;
|
||||
private readonly DeviceService _deviceService;
|
||||
public DeviceController(ILogger<DeviceController> logger, DeviceService deviceService)
|
||||
{
|
||||
_logger = logger;
|
||||
_deviceService = deviceService;
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取设备列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[Public]
|
||||
[HttpGet("Device/GetDevices")]
|
||||
public async Task<IActionResult> GetDevices()
|
||||
{
|
||||
return Ok(await DC.Set<Device>().Include(x => x.Driver).Where(x => x.ParentId != null).AsNoTracking()
|
||||
.OrderBy(x => x.Index).ToListAsync());
|
||||
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user