修改单位
parent
6c94077b93
commit
6cf4381c53
|
@ -143,3 +143,16 @@ public class QueryByIdSysUnitGroupInput : DeleteSysUnitGroupInput
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 单位组检查输入参数
|
||||||
|
/// </summary>
|
||||||
|
public class CheckSysUnitGroupInput : SysUnitGroupBaseInput
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 主键Id
|
||||||
|
/// </summary>
|
||||||
|
[Required(ErrorMessage = "主键Id不能为空")]
|
||||||
|
public long Id { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -11,9 +11,14 @@ namespace Admin.NET.Application;
|
||||||
public class SysUnitGroupService : IDynamicApiController, ITransient
|
public class SysUnitGroupService : IDynamicApiController, ITransient
|
||||||
{
|
{
|
||||||
private readonly SqlSugarRepository<SysUnitGroup> _rep;
|
private readonly SqlSugarRepository<SysUnitGroup> _rep;
|
||||||
public SysUnitGroupService(SqlSugarRepository<SysUnitGroup> rep)
|
|
||||||
|
private readonly SysUnitService _sysUnitService;
|
||||||
|
|
||||||
|
public SysUnitGroupService(SqlSugarRepository<SysUnitGroup> rep,
|
||||||
|
SysUnitService sysUnitService )
|
||||||
{
|
{
|
||||||
_rep = rep;
|
_rep = rep;
|
||||||
|
_sysUnitService = sysUnitService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -101,9 +106,17 @@ public class SysUnitGroupService : IDynamicApiController, ITransient
|
||||||
return await _rep.AsQueryable().Where(a => !a.IsDelete).Select<SysUnitGroupOutput>().ToListAsync();
|
return await _rep.AsQueryable().Where(a => !a.IsDelete).Select<SysUnitGroupOutput>().ToListAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 检查单位是否存在数据
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
[ApiDescriptionSettings(Name = "CheckUnitList")]
|
||||||
|
public async Task<bool> CheckUnitList(CheckSysUnitGroupInput input)
|
||||||
|
{
|
||||||
|
var sysUnits = await _sysUnitService.ListByGroupId(input.Id);
|
||||||
|
return sysUnits.Any();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
using Admin.NET.Application.Const;
|
using Admin.NET.Application.Const;
|
||||||
using Admin.NET.Application.Entity;
|
using Admin.NET.Application.Entity;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.AspNetCore.Mvc.ViewFeatures;
|
||||||
namespace Admin.NET.Application;
|
namespace Admin.NET.Application;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 单位服务
|
/// 单位服务
|
||||||
|
@ -171,5 +172,21 @@ public class SysUnitService : IDynamicApiController, ITransient
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 校验基本单位是否唯一
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
[ApiDescriptionSettings(Name = "checkBaseUnit")]
|
||||||
|
public async Task<SysUnit> CheckBaseUnit(AddSysUnitInput input)
|
||||||
|
{
|
||||||
|
var result = await _rep.AsQueryable()
|
||||||
|
.Where(a => !a.IsDelete && a.IsBaseUnit==true)
|
||||||
|
.WhereIF(input.GroupUnitId > 0, u => u.GroupUnitId == input.GroupUnitId)
|
||||||
|
.FirstAsync();
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Remove="Admin.NET.Core.xml" />
|
<None Remove="Admin.NET.Core.xml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="AlibabaCloud.SDK.Dysmsapi20170525" Version="2.0.24" />
|
<PackageReference Include="AlibabaCloud.SDK.Dysmsapi20170525" Version="2.0.24" />
|
||||||
<PackageReference Include="AngleSharp" Version="1.1.2" />
|
<PackageReference Include="AngleSharp" Version="1.1.2" />
|
||||||
|
|
Loading…
Reference in New Issue