李昊 4 years ago
parent
commit
effd045cc4

+ 7 - 1
gx_api/GxPress/Repository/GxPress.Repository.Implement/Group/GroupCategoryRepository.cs

@@ -48,7 +48,11 @@ namespace GxPress.Repository.Implement.Group
         public async Task<int> InsertAsync(Entity.tede2.Group.GroupCategory groupCategory)
         {
             groupCategory.ImageUrls = StringUtils.RemoveDomain(groupCategory.ImageUrls);
-            return await _repository.InsertAsync(groupCategory);
+            var id = await _repository.InsertAsync(groupCategory);
+            groupCategory.Id = id;
+            groupCategory.Sort = id;
+            await UpdateAsync(groupCategory);
+            return id;
         }
 
 
@@ -63,6 +67,8 @@ namespace GxPress.Repository.Implement.Group
                     model.ParentId = groupCategory.ParentId;
                 if (string.IsNullOrEmpty(groupCategory.ImageUrls))
                     model.ImageUrls = StringUtils.RemoveDomain(groupCategory.ImageUrls);
+                if (groupCategory.Sort > 0)
+                    model.Sort = groupCategory.Sort;
                 return await _repository.UpdateAsync(groupCategory);
             }
             return false;