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