|
|
|
@ -14,7 +14,7 @@ namespace Myshipping.Core.Service
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 接口授权服务
|
|
|
|
|
/// </summary>
|
|
|
|
|
[ApiDescriptionSettings("Application",Name = "DjyApiAuth", Order = 1)]
|
|
|
|
|
[ApiDescriptionSettings(Name = "DjyApiAuth", Order = 1)]
|
|
|
|
|
public class DjyApiAuthService : IDjyApiAuthService, IDynamicApiController, ITransient
|
|
|
|
|
{
|
|
|
|
|
private readonly SqlSugarRepository<DjyApiAuth> _rep;
|
|
|
|
@ -37,37 +37,34 @@ namespace Myshipping.Core.Service
|
|
|
|
|
var entities = await _rep.AsQueryable()
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.ApiCode), u => u.ApiCode == input.ApiCode)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.ApiName), u => u.ApiName == input.ApiName)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.ApiKey), u => u.ApiKey == input.ApiKey)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.ApiSecret), u => u.ApiSecret == input.ApiSecret)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.TenantName), u => u.TenantName == input.TenantName)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.UserCode), u => u.UserCode == input.UserCode)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.UserName), u => u.UserName == input.UserName)
|
|
|
|
|
.WhereIF(input.IsDisable.HasValue, u => u.IsDisable == input.IsDisable.Value)
|
|
|
|
|
.ToPagedListAsync(input.PageNo, input.PageSize);
|
|
|
|
|
return entities.XnPagedResult();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 增加接口授权
|
|
|
|
|
/// 保存授权
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="input"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost("/DjyApiAuth/add")]
|
|
|
|
|
public async Task Add(AddDjyApiAuthInput input)
|
|
|
|
|
[HttpPost("/DjyApiAuth/sava")]
|
|
|
|
|
public async Task<long> Save(SaveDjyApiAuthInput input)
|
|
|
|
|
{
|
|
|
|
|
var entity = input.Adapt<DjyApiAuth>();
|
|
|
|
|
await _rep.InsertAsync(entity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 更新接口授权
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="input"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost("/DjyApiAuth/edit")]
|
|
|
|
|
public async Task Update(UpdateDjyApiAuthInput input)
|
|
|
|
|
{
|
|
|
|
|
var entity = input.Adapt<DjyApiAuth>();
|
|
|
|
|
await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns:true).ExecuteCommandAsync();
|
|
|
|
|
DjyApiAuth entity = null;
|
|
|
|
|
if (input.Id > 0)
|
|
|
|
|
{
|
|
|
|
|
entity = input.Adapt<DjyApiAuth>();
|
|
|
|
|
await _rep.InsertAsync(entity);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
entity = _rep.AsQueryable().Filter(null, true).First(x => x.Id == input.Id);
|
|
|
|
|
input.Adapt(entity);
|
|
|
|
|
await _rep.UpdateAsync(entity);
|
|
|
|
|
}
|
|
|
|
|
return entity.Id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|