|
@@ -100,8 +100,13 @@ public class RoleController : BaseController
|
|
|
[HttpPost("allocationauthority")]
|
|
|
public async Task AllocationAuthority(RoleAuthorityDto dto)
|
|
|
{
|
|
|
- var list = _mapper.Map<SystemAuthority>(dto);
|
|
|
- await _systemAuthorityRepository.AddAsync(list);
|
|
|
+ //判断是否存在,如果存在就做更新
|
|
|
+ var ishas =await _systemAuthorityRepository.AnyAsync(x => x.RoleId == dto.RoleId);
|
|
|
+ var model = _mapper.Map<SystemAuthority>(dto);
|
|
|
+ if (!ishas)
|
|
|
+ await _systemAuthorityRepository.AddAsync(model);
|
|
|
+ else
|
|
|
+ await _systemAuthorityRepository.UpdateAsync(model);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|