添加项目文件。
This commit is contained in:
73
HT.Cloud.Service/DevicesManage/MetaTagService.cs
Normal file
73
HT.Cloud.Service/DevicesManage/MetaTagService.cs
Normal file
@ -0,0 +1,73 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using HT.Cloud.Code;
|
||||
using HT.Cloud.Domain.DevicesManage;
|
||||
using SqlSugar;
|
||||
|
||||
namespace HT.Cloud.Service.DevicesManage
|
||||
{
|
||||
/// <summary>
|
||||
/// 创 建:cdl
|
||||
/// 日 期:2023-03-01 15:24
|
||||
/// 描 述:变量维护服务类
|
||||
/// </summary>
|
||||
public class MetaTagService : BaseService<MetaTagEntity>, IDenpendency
|
||||
{
|
||||
public MetaTagService(ISqlSugarClient context) : base(context)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取服务器中设备与变量组信息树列表和子节点
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<string> GetALLNode()
|
||||
{
|
||||
var list_drive = _context.Queryable<MetaDriverEntity>().ToList();
|
||||
var list_argument = _context.Queryable<ArgumentEntity>().ToList();
|
||||
var list_group = _context.Queryable<MetaGroupEntity>().ToList();
|
||||
|
||||
|
||||
var ts = list_drive.Select(a => new
|
||||
{
|
||||
title = a.DriverName,
|
||||
id = a.DriverID,
|
||||
children = new[] {
|
||||
new Children
|
||||
{
|
||||
id = "T" + a.DriverID,
|
||||
title = "通讯参数",
|
||||
},
|
||||
new Children
|
||||
{
|
||||
id = "B" + a.DriverID,
|
||||
title = "变量配置",
|
||||
children = list_group.Where(aa=>aa.DriverID == a.DriverID).Select(aa=>new Children
|
||||
{
|
||||
title = aa.GroupName,
|
||||
id = aa.GroupID.ToString(),
|
||||
}).ToList()
|
||||
|
||||
}
|
||||
}.ToList()
|
||||
//children= list_group.Where(aa=>aa.DriverID == a.DriverID).Select(aa => new
|
||||
//{
|
||||
// title = aa.GroupName,
|
||||
// id = aa.GroupID,
|
||||
//}).ToList()
|
||||
}).ToList();
|
||||
|
||||
return ts.ToJsonNullValueHandling();
|
||||
}
|
||||
|
||||
public class Children
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string title { get; set; }
|
||||
public List<Children> children { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user