From e4f3f20340cdd5ef16cc273eadc72ac559994988 Mon Sep 17 00:00:00 2001
From: Rodney Chen <rodney.chen@hotmail.com>
Date: 星期五, 26 七月 2024 15:36:08 +0800
Subject: [PATCH] 忘记new

---
 Tiger.Api/Controllers/Base/SystemController.cs |   31 +++++++++++++++++++++++--------
 1 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/Tiger.Api/Controllers/Base/SystemController.cs b/Tiger.Api/Controllers/Base/SystemController.cs
index 04d0f00..5e506d3 100644
--- a/Tiger.Api/Controllers/Base/SystemController.cs
+++ b/Tiger.Api/Controllers/Base/SystemController.cs
@@ -8,6 +8,9 @@
 using Tiger.IBusiness;
 using System.Threading;
 using System.Linq;
+using Tiger.Model;
+using System.Xml.Linq;
+using System.ComponentModel;
 
 namespace Tiger.Api.Controllers.Base
 {
@@ -100,18 +103,30 @@
         /// </summary>
         /// <returns></returns>
         [HttpGet]
-        [Route("System/Base/[action]")]
-        public IActionResult GetEntitys()
+        [Route("System/Entitys/Get")]
+        public IActionResult GetEntitys(string Namespace, string StartWith)
         {
             Assembly assembly = Assembly.Load("Tiger.Model");
             Type[] types = assembly.GetTypes();
-            var entitys = types.Where(q => q.GetInterfaces().Contains(typeof(Model.iEntity)) && q.IsClass).ToList();
-            var data = entitys.Select(q => new
+            var entitys = types.Where(q => q.IsClass && q.GetInterfaces().Contains(typeof(Model.iEntity)) //&& q.Namespace != "Tiger.Model.Minsun"
+                                                       && (Namespace.IsNullOrEmpty() || q.Namespace == Namespace) 
+                                                       && (StartWith.IsNullOrEmpty() || q.Name.StartsWith(StartWith))
+                                                       && !q.GetCustomAttributes(typeof(EntityBase), false).Any()).ToList();
+            var data = new
             {
-                q.Namespace,
-                q.FullName,
-                Properties = q.GetProperties().Select(p => new { p.Name, Type = p.PropertyType.Name }).ToList()
-            });
+                Total = entitys.Count,
+                Data = entitys.Select(q => new
+                {
+                    q.FullName,
+                    q.Namespace,
+                    q.Name,
+                    DisplayName = (q.GetCustomAttribute(typeof(DisplayNameAttribute)) as DisplayNameAttribute)?.DisplayName,
+                    Properties = q.GetProperties().Select(p => new { 
+                        p.Name, 
+                        DisplayName = (p.GetCustomAttribute(typeof(DisplayNameAttribute)) as DisplayNameAttribute)?.DisplayName,
+                        Type = p.PropertyType.Name }).ToList()
+                })
+            };
             return Ok(data);
         }
 

--
Gitblit v1.9.3