字典bug修复
This commit is contained in:
@@ -42,7 +42,7 @@ namespace IRaCIS.Application.Contracts
|
||||
|
||||
|
||||
//有父亲 就有值
|
||||
public Guid ParentId { get; set; }
|
||||
public Guid? ParentId { get; set; }
|
||||
|
||||
public bool IsEnable { get; set; }
|
||||
|
||||
|
||||
@@ -59,26 +59,25 @@ namespace IRaCIS.Application.Services
|
||||
[HttpPost]
|
||||
public async Task<IResponseOutput> AddOrUpdateBasicDic(AddOrEditBasicDic addOrEditBasic)
|
||||
{
|
||||
if (addOrEditBasic.Id == null)
|
||||
{
|
||||
var entity = await _dicRepository.InsertDictionaryAsync(addOrEditBasic);
|
||||
//if (addOrEditBasic.Id == null)
|
||||
//{
|
||||
// var entity = await _dicRepository.InsertDictionaryAsync(addOrEditBasic);
|
||||
|
||||
await _dicRepository.UpdateFromQueryAsync(t => t.ParentId == Guid.Empty,
|
||||
u => new Dictionary() { ParentId = null });
|
||||
// await _dicRepository.UpdateFromQueryAsync(t => t.ParentId == Guid.Empty,
|
||||
// u => new Dictionary() { ParentId = null });
|
||||
|
||||
return ResponseOutput.Ok(entity.Id.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
var entity = await _dicRepository.InsertOrUpdateAsync(addOrEditBasic, true);
|
||||
await _dicRepository.UpdateFromQueryAsync(t => t.ParentId == Guid.Empty,
|
||||
u => new Dictionary() { ParentId = null });
|
||||
// return ResponseOutput.Ok(entity.Id.ToString());
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// var entity = await _dicRepository.InsertOrUpdateAsync(addOrEditBasic, true);
|
||||
|
||||
return ResponseOutput.Ok(entity.Id.ToString());
|
||||
}
|
||||
//var entity = await _dicRepository.InsertOrUpdateAsync(addOrEditBasic, true);
|
||||
|
||||
//return ResponseOutput.Ok(entity.Id.ToString());
|
||||
// return ResponseOutput.Ok(entity.Id.ToString());
|
||||
//}
|
||||
var entity = await _dicRepository.InsertOrUpdateAsync(addOrEditBasic, true);
|
||||
|
||||
return ResponseOutput.Ok(entity.Id.ToString());
|
||||
}
|
||||
|
||||
|
||||
@@ -100,6 +99,11 @@ namespace IRaCIS.Application.Services
|
||||
[HttpDelete("{id:guid}")]
|
||||
public async Task<IResponseOutput> DeleteDictionary(Guid id)
|
||||
{
|
||||
if ( await _dicRepository.AnyAsync(t => t.ParentId == id))
|
||||
{
|
||||
return ResponseOutput.NotOk("有子项数据,不允许直接删除!");
|
||||
}
|
||||
|
||||
if ((await _doctorDictionaryRepository.AnyAsync(t => t.DictionaryId == id)) ||
|
||||
(await _doctorRepository.AnyAsync(t => t.SpecialityId == id || t.PositionId == id || t.DepartmentId == id || t.RankId == id))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user