李昊 %!s(int64=4) %!d(string=hai) anos
pai
achega
1b4ffd7905

+ 6 - 0
gx_api/GxPress/Model/GxPress.Entity/SystemLabel/SystemLableMedia.cs

@@ -20,5 +20,11 @@ namespace GxPress.Entity.SystemLabel
         /// <value></value>
         [DataColumn]
         public int MediaId { get; set; }
+        /// <summary>
+        /// 0标签 1 分类
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public int TypeValue { get; set; }
     }
 }

+ 23 - 0
gx_api/GxPress/Model/GxPress.Request/SystemLabel/SystemLableMediaRequest.cs

@@ -17,5 +17,28 @@ namespace GxPress.Request.SystemLabel
         /// </summary>
         /// <value></value>
         public List<int> MediaIds { get; set; }
+        /// <summary>
+        /// 类型 0 标签 1 分类 
+        /// </summary>
+        /// <value></value>
+
+        public int TypeValue { get; set; }
+    }
+    /// <summary>
+    /// 查询
+    /// </summary>
+    public class SystemLableMediaSearchRequest:Common.Page.PageParameter
+    {
+        /// <summary>
+        /// 标签ID
+        /// </summary>
+        /// <value></value>
+        public int LableId { get; set; }
+        /// <summary>
+        /// 类型 0 标签 1 分类 
+        /// </summary>
+        /// <value></value>
+
+        public int TypeValue { get; set; }
     }
 }

+ 4 - 4
gx_api/GxPress/Repository/GxPress.Repository.Implement/SystemLabel/SystemLableMediaRepository.cs

@@ -43,9 +43,9 @@ namespace GxPress.Repository.Implement.SystemLabel
         /// </summary>
         /// <param name="lableId"></param>
         /// <returns></returns>
-        public async Task<IEnumerable<int>> GetMediaIdsAsync(int lableId)
+        public async Task<IEnumerable<int>> GetMediaIdsAsync(int lableId, int typeValue)
         {
-            return await _repository.GetAllAsync<int>(Q.Where(nameof(Entity.SystemLabel.SystemLableMedia.LableId), lableId).Select(nameof(Entity.SystemLabel.SystemLableMedia.MediaId)));
+            return await _repository.GetAllAsync<int>(Q.Where(nameof(Entity.SystemLabel.SystemLableMedia.LableId), lableId).Where(nameof(Entity.SystemLabel.SystemLableMedia.TypeValue), typeValue).Select(nameof(Entity.SystemLabel.SystemLableMedia.MediaId)));
         }
         public async Task<bool> DeleteAsync(List<int> ids)
         {
@@ -63,12 +63,12 @@ namespace GxPress.Repository.Implement.SystemLabel
                 using (var transactions = new TransactionScope())
                 {
                     await _repository.DeleteAsync(Q.Where(nameof(Entity.SystemLabel.SystemLableMedia.LableId), request.LableId));
-                    var sql = $@"INSERT INTO `tede_system_lable_media`(`Guid`,`CreatedDate`,`LastModifiedDate`,`LableId`,`MediaId`) VALUES";
+                    var sql = $@"INSERT INTO `tede_system_lable_media`(`Guid`,`CreatedDate`,`LastModifiedDate`,`LableId`,`MediaId`,`TypeValue`) VALUES";
                     var createdDate = System.DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
                     foreach (var item in request.MediaIds)
                     {
                         var guid = System.Guid.NewGuid().ToString();
-                        sql += $@"('{guid}','{createdDate}','{createdDate}',{request.LableId},{item}),";
+                        sql += $@"('{guid}','{createdDate}','{createdDate}',{request.LableId},{item},{request.TypeValue}),";
                     }
                     sql = sql.Remove(sql.Length - 1, 1);
                     var databaseType = _databaseTypestr.ToEnum<DatabaseType>(DatabaseType.MySql);

+ 1 - 1
gx_api/GxPress/Repository/GxPress.Repository.Interface/SystemLabel/ISystemLableMediaRepository.cs

@@ -13,7 +13,7 @@ namespace GxPress.Repository.Interface.SystemLabel
         /// </summary>
         /// <param name="lableId"></param>
         /// <returns></returns>
-        Task<IEnumerable<int>> GetMediaIdsAsync(int lableId);
+        Task<IEnumerable<int>> GetMediaIdsAsync(int lableId, int typeValue);
         Task<bool> DeleteAsync(List<int> ids);
         /// <summary>
         /// 添加

+ 1 - 1
gx_api/GxPress/Service/GxPress.Service.Implement/SystemLabel/SystemLabelService.cs

@@ -21,7 +21,7 @@ namespace GxPress.Service.Implement.SystemLabel
             var result = await systemLabelRepository.GetAllAsync(request);
             foreach (var item in result.Items)
             {
-                item.MediaIds = await systemLableMediaRepository.GetMediaIdsAsync(item.Id);
+                item.MediaIds = await systemLableMediaRepository.GetMediaIdsAsync(item.Id,0);
             }
             return result;
         }