|
@@ -18,6 +18,7 @@ using Microsoft.Extensions.Options;
|
|
using XF.Utility.AppIdentityModel;
|
|
using XF.Utility.AppIdentityModel;
|
|
using XF.Utility.UnifyResponse;
|
|
using XF.Utility.UnifyResponse;
|
|
using Hotline.Settings;
|
|
using Hotline.Settings;
|
|
|
|
+using Microsoft.AspNetCore.Mvc.Formatters;
|
|
|
|
|
|
namespace Hotline.Api.Controllers;
|
|
namespace Hotline.Api.Controllers;
|
|
|
|
|
|
@@ -129,13 +130,28 @@ public class UserController : BaseController
|
|
await _userRepository.UpdateAsync(user, HttpContext.RequestAborted);
|
|
await _userRepository.UpdateAsync(user, HttpContext.RequestAborted);
|
|
//查询用户组织架构
|
|
//查询用户组织架构
|
|
var orgUser = await _orgUserRepository.GetAsync(x => x.UserId == user.Id);
|
|
var orgUser = await _orgUserRepository.GetAsync(x => x.UserId == user.Id);
|
|
- if (orgUser!=null)
|
|
|
|
|
|
+ if (orgUser is null)
|
|
{
|
|
{
|
|
-
|
|
|
|
|
|
+ //新增
|
|
|
|
+ if (!string.IsNullOrEmpty(userDto.OrgId) && !string.IsNullOrEmpty(userDto.OrgCode))
|
|
|
|
+ {
|
|
|
|
+ await _orgUserRepository.AddAsync(new OrgUser() { OrgId = userDto.OrgId, OrgCode = userDto.OrgCode, UserId = user.Id });
|
|
|
|
+ }
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
-
|
|
|
|
|
|
+ //修改
|
|
|
|
+ if (!string.IsNullOrEmpty(userDto.OrgId) && !string.IsNullOrEmpty(userDto.OrgCode))
|
|
|
|
+ {
|
|
|
|
+ orgUser.OrgId = orgUser.Id;
|
|
|
|
+ orgUser.OrgCode = orgUser.OrgCode;
|
|
|
|
+ await _orgUserRepository.UpdateAsync(orgUser, HttpContext.RequestAborted);
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ //删除
|
|
|
|
+ await _orgUserRepository.RemoveAsync(orgUser.Id, false, HttpContext.RequestAborted);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|