diff --git a/Myshipping.Core/Myshipping.Core.xml b/Myshipping.Core/Myshipping.Core.xml index 001c0415..539b294e 100644 --- a/Myshipping.Core/Myshipping.Core.xml +++ b/Myshipping.Core/Myshipping.Core.xml @@ -9285,16 +9285,9 @@ - + - 增加接口授权 - - - - - - - 更新接口授权 + 保存授权 @@ -9408,11 +9401,6 @@ 有效截止日期 - - - 禁用标志 - - 租户Id @@ -9438,17 +9426,12 @@ 用户姓名 - - - 接口授权新增输入参数 - - - + - 接口授权修改输入参数 + 接口授权修改保存参数 - + 主键Id @@ -9468,11 +9451,6 @@ 接口授权查询输入参数 - - - 主键Id - - 接口代码 @@ -9483,46 +9461,16 @@ 接口名称 - - - 接口KEY - - - - - 接口秘钥 - - - - - 有效截止日期 - - 禁用标志 - - - 租户Id - - 租户名称 - - - 用户ID - - - - - 用户代码 - - 用户姓名 diff --git a/Myshipping.Core/Service/DjyApiAuth/DjyApiAuthService.cs b/Myshipping.Core/Service/DjyApiAuth/DjyApiAuthService.cs index c9390ce9..f2a5c522 100644 --- a/Myshipping.Core/Service/DjyApiAuth/DjyApiAuthService.cs +++ b/Myshipping.Core/Service/DjyApiAuth/DjyApiAuthService.cs @@ -14,7 +14,7 @@ namespace Myshipping.Core.Service /// /// 接口授权服务 /// - [ApiDescriptionSettings("Application",Name = "DjyApiAuth", Order = 1)] + [ApiDescriptionSettings(Name = "DjyApiAuth", Order = 1)] public class DjyApiAuthService : IDjyApiAuthService, IDynamicApiController, ITransient { private readonly SqlSugarRepository _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(); } /// - /// 增加接口授权 + /// 保存授权 /// /// /// - [HttpPost("/DjyApiAuth/add")] - public async Task Add(AddDjyApiAuthInput input) + [HttpPost("/DjyApiAuth/sava")] + public async Task Save(SaveDjyApiAuthInput input) { - var entity = input.Adapt(); - await _rep.InsertAsync(entity); - } - - /// - /// 更新接口授权 - /// - /// - /// - [HttpPost("/DjyApiAuth/edit")] - public async Task Update(UpdateDjyApiAuthInput input) - { - var entity = input.Adapt(); - await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns:true).ExecuteCommandAsync(); + DjyApiAuth entity = null; + if (input.Id > 0) + { + entity = input.Adapt(); + 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; } /// diff --git a/Myshipping.Core/Service/DjyApiAuth/Dto/DjyApiAuthInput.cs b/Myshipping.Core/Service/DjyApiAuth/Dto/DjyApiAuthInput.cs index 2cfcca1e..cc0331f7 100644 --- a/Myshipping.Core/Service/DjyApiAuth/Dto/DjyApiAuthInput.cs +++ b/Myshipping.Core/Service/DjyApiAuth/Dto/DjyApiAuthInput.cs @@ -32,12 +32,7 @@ namespace Myshipping.Core.Service /// /// 有效截止日期 /// - public virtual DateTime ExpireDate { get; set; } - - /// - /// 禁用标志 - /// - public virtual bool IsDisable { get; set; } + public virtual DateTime? ExpireDate { get; set; } /// /// 租户Id @@ -67,16 +62,9 @@ namespace Myshipping.Core.Service } /// - /// 接口授权新增输入参数 + /// 接口授权修改保存参数 /// - public class AddDjyApiAuthInput : DjyApiAuthInput - { - } - - /// - /// 接口授权修改输入参数 - /// - public class UpdateDjyApiAuthInput : DjyApiAuthInput + public class SaveDjyApiAuthInput : DjyApiAuthInput { /// /// 主键Id @@ -103,12 +91,7 @@ namespace Myshipping.Core.Service /// 接口授权查询输入参数 /// public class QueryDjyApiAuthInput : PageInputBase - { - /// - /// 主键Id - /// - public virtual long Id { get; set; } - + { /// /// 接口代码 /// @@ -119,46 +102,16 @@ namespace Myshipping.Core.Service /// public virtual string ApiName { get; set; } - /// - /// 接口KEY - /// - public virtual string ApiKey { get; set; } - - /// - /// 接口秘钥 - /// - public virtual string ApiSecret { get; set; } - - /// - /// 有效截止日期 - /// - public virtual DateTime ExpireDate { get; set; } - /// /// 禁用标志 /// - public virtual bool IsDisable { get; set; } - - /// - /// 租户Id - /// - public virtual long TenantId { get; set; } + public virtual bool? IsDisable { get; set; } /// /// 租户名称 /// public virtual string TenantName { get; set; } - /// - /// 用户ID - /// - public virtual long UserId { get; set; } - - /// - /// 用户代码 - /// - public virtual string UserCode { get; set; } - /// /// 用户姓名 /// diff --git a/Myshipping.Core/Service/DjyApiAuth/IDjyApiAuthService.cs b/Myshipping.Core/Service/DjyApiAuth/IDjyApiAuthService.cs index 1d5d469c..0599b248 100644 --- a/Myshipping.Core/Service/DjyApiAuth/IDjyApiAuthService.cs +++ b/Myshipping.Core/Service/DjyApiAuth/IDjyApiAuthService.cs @@ -9,8 +9,7 @@ namespace Myshipping.Core.Service public interface IDjyApiAuthService { Task Page([FromQuery] QueryDjyApiAuthInput input); - Task Add(AddDjyApiAuthInput input); - Task Update(UpdateDjyApiAuthInput input); + Task Save(SaveDjyApiAuthInput input); Task Delete(GetDjyApiAuthInput input); Task Get([FromQuery] GetDjyApiAuthInput input); //Task List([FromQuery] QueryDjyApiAuthInput input);