李昊 4 rokov pred
rodič
commit
10bf912b2d

+ 18 - 0
gx_api/GxPress/Model/GxPress.Entity/tede2/Media/Media.cs

@@ -201,5 +201,23 @@ namespace GxPress.Entity.tede2.Media
         /// <value></value>
         [DataColumn]
         public int AttachId { get; set; }
+        /// <summary>
+        /// 关联的媒体ID
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public int MediaId { get; set; }
+        /// <summary>
+        /// 关联的媒体标题
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public string MediaTitle { get; set; }
+        /// <summary>
+        /// 是否有库
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public bool IsLibrary { get; set; }
     }
 }

+ 9 - 2
gx_api/GxPress/Model/GxPress.Request/Media/MediaRequest.cs

@@ -172,14 +172,21 @@ namespace GxPress.Request.Media
     public class MediaSearchRequest : PageParameter
     {
         /// <summary>
-        /// 
+        /// 0全部
         /// </summary>
         /// <value></value>
         public int MediaType { get; set; }
         /// <summary>
-        /// 是否删除
+        /// 0 全部 1删除 2未删除
         /// </summary>
         /// <value></value>
         public int IsDelete { get; set; }
+
+        /// <summary>
+        /// 0 全部 1 包含 2 未包含
+        /// </summary>
+        /// <value></value>
+        public int LibraryType { get; set; }
+
     }
 }

+ 6 - 2
gx_api/GxPress/Repository/GxPress.Repository.Implement/Media/MediaRepository.cs

@@ -154,8 +154,12 @@ namespace GxPress.Repository.Implement.Media
         {
             var result = new PagedList<Entity.tede2.Media.Media>();
             var query = Q.NewQuery();
-            query.Where(nameof(Entity.tede2.Media.Media.IsDelete), request.IsDelete);
-            query.Where(nameof(Entity.tede2.Media.Media.MediaType), request.MediaType);
+            if (request.IsDelete > 0)
+                query.Where(nameof(Entity.tede2.Media.Media.IsDelete), request.IsDelete);
+            if (request.MediaType > 0)
+                query.Where(nameof(Entity.tede2.Media.Media.MediaType), request.MediaType);
+            if (request.LibraryType > 0)
+                query.Where(nameof(Entity.tede2.Media.Media.IsLibrary), request.LibraryType == 1);
             result.Total = await _repository.CountAsync(query);
             var item = await _repository.GetAllAsync(query.ForPage(request.Page, request.PerPage).OrderByDesc(nameof(Entity.tede2.Media.Media.Sort)));
             result.Items = item;