64 lines
2.0 KiB
C#
64 lines
2.0 KiB
C#
|
|
using APT.BaseData.Domain.Entities;
|
|||
|
|
using APT.BaseData.Domain.Entities.BD;
|
|||
|
|
using APT.BaseData.Domain.Enums;
|
|||
|
|
using APT.BaseData.Domain.IServices.BD;
|
|||
|
|
using APT.Infrastructure.Core;
|
|||
|
|
using APT.Utility;
|
|||
|
|
using Microsoft.AspNetCore.Mvc;
|
|||
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.ComponentModel;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Threading.Tasks;
|
|||
|
|
|
|||
|
|
namespace APT.BD.WebApi.Controllers.Api
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// 实体类型表
|
|||
|
|
/// </summary>
|
|||
|
|
[Route("api/PF/Entity")]
|
|||
|
|
public partial class EntityController : AuthorizeTreeApiController<T_PF_MENU>
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 实体属性列表(只显示一级)
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="filter">过滤实体</param>
|
|||
|
|
/// <param name="Parameter1">省份ID</param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
[HttpGet, Route("Props")]
|
|||
|
|
public JsonActionResult<IEnumerable<dynamic>> Props(string name)
|
|||
|
|
{
|
|||
|
|
return SafeExecute<IEnumerable<dynamic>>(() =>
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
var retProps = new List<dynamic>();
|
|||
|
|
var entityType = APT.Infrastructure.Core.Refctor.ReflectHelper.FindTypeInCurrentDomain(name);
|
|||
|
|
if (entityType == null)
|
|||
|
|
return retProps;
|
|||
|
|
var fields = entityType.GetProperties();
|
|||
|
|
List<dynamic> attrs = new List<dynamic>();
|
|||
|
|
foreach (var fi in fields)
|
|||
|
|
{
|
|||
|
|
dynamic obj = new System.Dynamic.ExpandoObject();
|
|||
|
|
obj.CODE = fi.Name;
|
|||
|
|
obj.ID = fi.Name;
|
|||
|
|
var descAtrr = fi.GetAttribute<DescriptionAttribute>();
|
|||
|
|
if (descAtrr != null)
|
|||
|
|
{
|
|||
|
|
obj.NAME = descAtrr.Description;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
obj.NAME = "";
|
|||
|
|
}
|
|||
|
|
attrs.Add(obj);
|
|||
|
|
}
|
|||
|
|
return attrs;
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|