李昊 4 年之前
父節點
當前提交
3336098901

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

@@ -180,5 +180,11 @@ namespace GxPress.Entity.tede2.Media
         /// <value></value>
         [DataColumn]
         public decimal FreeProportion { get; set; }
+        /// <summary>
+        /// 是否删除
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public bool IsDelete { get; set; }
     }
 }

+ 5 - 0
gx_api/GxPress/Model/GxPress.Request/Media/MediaRequest.cs

@@ -176,5 +176,10 @@ namespace GxPress.Request.Media
         /// </summary>
         /// <value></value>
         public int MediaType { get; set; }
+        /// <summary>
+        /// 是否删除
+        /// </summary>
+        /// <value></value>
+        public int IsDelete { get; set; }
     }
 }

+ 7 - 5
gx_api/GxPress/Repository/GxPress.Repository.Implement/Media/MediaRepository.cs

@@ -66,11 +66,12 @@ namespace GxPress.Repository.Implement.Media
             {
                 using (var transactionScope = new TransactionScope())
                 {
-                    //删除媒体库
-                    await mediaLibraryRepository.DeleteAsync(Q.Where(nameof(Entity.tede2.Media.MediaLibrary.MediaId), id));
-                    //删除媒体标签
-                    await mediaLableRepository.DeleteAsync(Q.Where(nameof(Entity.tede2.Media.MediaLable.MediaId), id));
-                    await _repository.DeleteAsync(id);
+                    // //删除媒体库
+                    // await mediaLibraryRepository.DeleteAsync(Q.Where(nameof(Entity.tede2.Media.MediaLibrary.MediaId), id));
+                    // //删除媒体标签
+                    // await mediaLableRepository.DeleteAsync(Q.Where(nameof(Entity.tede2.Media.MediaLable.MediaId), id));
+
+                    await _repository.UpdateAsync(Q.Where(nameof(Entity.tede2.Media.Media.Id), id).Set(nameof(Entity.tede2.Media.Media.IsDelete), true));
                     transactionScope.Complete();
                 }
             }
@@ -146,6 +147,7 @@ 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);
             result.Total = await _repository.CountAsync(query);
             var item = await _repository.GetAllAsync(query.ForPage(request.Page, request.PerPage).OrderByDesc(nameof(Entity.tede2.Media.Media.Sort)));