Browse Source

优化部门删除为级联删除
新增岗位数据导入

zhontai 3 năm trước cách đây
mục cha
commit
1bd1c4d511

+ 1 - 0
Admin.Core.Repository/Base/Data.cs

@@ -22,6 +22,7 @@ namespace Admin.Core.Repository
         public TenantPermissionEntity[] TenantPermissions { get; set; }
         public PermissionApiEntity[] PermissionApis { get; set; }
 
+        public PositionEntity[] Positions { get; set; }
         public OrganizationEntity[] OrganizationTree { get; set; }
     }
 }

+ 2 - 1
Admin.Core.Repository/Base/DbHelper.cs

@@ -428,6 +428,7 @@ namespace Admin.Core.Repository
                     await InitDtDataAsync(db, uow, tran, data.PermissionApis, dbConfig);
 
                     //人事
+                    await InitDtDataAsync(db, uow, tran, data.Positions, dbConfig);
                     await InitDtDataAsync(db, uow, tran, data.OrganizationTree, dbConfig);
 
                     uow.Commit();
@@ -602,7 +603,7 @@ namespace Admin.Core.Repository
                 #endregion
 
                 //人事
-                #region 组织机构
+                #region 部门
 
                 var organizations = await db.Queryable<OrganizationEntity>().ToListAsync<OrganizationDataOutput>();
                 var organizationTree = organizations.ToTree((r, c) =>

+ 2 - 6
Admin.Core.Service/Personnel/Organization/OrganizationService.cs

@@ -61,18 +61,14 @@ namespace Admin.Core.Service.Personnel.Organization
 
         public async Task<IResponseOutput> DeleteAsync(long id)
         {
-            var result = false;
-            if (id > 0)
-            {
-                result = (await _organizationRepository.DeleteAsync(m => m.Id == id)) > 0;
-            }
+            var result = await _organizationRepository.DeleteRecursiveAsync(a => a.Id == id);
 
             return ResponseOutput.Result(result);
         }
 
         public async Task<IResponseOutput> SoftDeleteAsync(long id)
         {
-            var result = await _organizationRepository.SoftDeleteAsync(id);
+            var result = await _organizationRepository.SoftDeleteRecursiveAsync(a => a.Id == id);
 
             return ResponseOutput.Result(result);
         }