|
@@ -1,4 +1,6 @@
|
|
|
-using Hotline.Configurations;
|
|
|
+using Hotline.Api.Filter;
|
|
|
+using Hotline.Caching.Interfaces;
|
|
|
+using Hotline.Configurations;
|
|
|
using Hotline.Permissions;
|
|
|
using Hotline.Settings;
|
|
|
using Hotline.Share.Dtos.Org;
|
|
@@ -154,6 +156,25 @@ namespace Hotline.Api.Controllers
|
|
|
await _systemOrganizeRepository.UpdateAsync(org, HttpContext.RequestAborted);
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 删除组织数据
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="id"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpDelete("delete-org/{id}")]
|
|
|
+ [LogFilter("删除组织")]
|
|
|
+ public async Task DeleteOrg(string id)
|
|
|
+ {
|
|
|
+ var org = await _systemOrganizeRepository.GetAsync(id, HttpContext.RequestAborted);
|
|
|
+ if (org is null)
|
|
|
+ throw UserFriendlyException.SameMessage("无效组织架构");
|
|
|
+ var chail= await _systemOrganizeRepository.AnyAsync(p => p.ParentId == org.Id);
|
|
|
+ if(chail==true)
|
|
|
+ throw UserFriendlyException.SameMessage("存在下级部门,请先删除下级部门数据!");
|
|
|
+
|
|
|
+ await _systemOrganizeRepository.RemoveAsync(org, true, HttpContext.RequestAborted);
|
|
|
+ }
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 获取组织
|
|
|
/// </summary>
|