From 747ba75b8e3bd8b40adc627994c7bc9aa2934679 Mon Sep 17 00:00:00 2001 From: lwh <2679599887@qq.com> Date: Mon, 12 Jun 2023 11:29:37 +0800 Subject: [PATCH] =?UTF-8?q?fixed=20=E4=BF=AE=E6=94=B9=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E5=B1=82=E5=88=97=E8=A1=A8=E6=B2=A1=E4=BD=BF=E7=94=A8await?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dto/Business/ShopManager/Shops/ShopDto.cs | 41 +++++++++++++------ .../CustomerAddressService.cs | 8 ++-- .../ShopManager/Shops/ShopService.cs | 41 +++++++++++++++++-- .../ShopManager/Shops/IShopService.cs | 8 ++++ .../ShopManager/Shops/ShopController.cs | 12 ++++++ .../wwwroot/CodeGenTemplate/TplService.txt | 8 ++-- 6 files changed, 94 insertions(+), 24 deletions(-) diff --git a/ARW.Model/Dto/Business/ShopManager/Shops/ShopDto.cs b/ARW.Model/Dto/Business/ShopManager/Shops/ShopDto.cs index cc1c5e4..07d00a3 100644 --- a/ARW.Model/Dto/Business/ShopManager/Shops/ShopDto.cs +++ b/ARW.Model/Dto/Business/ShopManager/Shops/ShopDto.cs @@ -62,28 +62,43 @@ namespace ARW.Model.Dto.Business.ShopManager.Shops /// @author 黎文豪 /// @date 2023-06-09 /// - public class ShopQueryDto : PagerInfo + public class ShopQueryDto : PagerInfo { public string ShopName { get; set; } public int? ShopAuditStatus { get; set; } - + public string ids { get; set; } } - /// - /// - /// @author 黎文豪 - /// @date 2023-06-09 - /// 审核对象 - /// - public class ShopAuditDto - { - public int ShopAuditStatus { get; set; } - public string ids { get; set; } - } + /// + /// + /// @author 黎文豪 + /// @date 2023-06-09 + /// 审核对象 + /// + public class ShopAuditDto + { + public int ShopAuditStatus { get; set; } + public string ids { get; set; } + } + + + + /// + /// 店铺查询对象 + /// + /// @author 黎文豪 + /// @date 2023-06-09 + /// + public class CustomerWithOutBindQueryDto : PagerInfo + { + + public string CustomerNickname { get; set; } + + } } diff --git a/ARW.Service/Business/BusinessService/Custom/CustomerAddresses/CustomerAddressService.cs b/ARW.Service/Business/BusinessService/Custom/CustomerAddresses/CustomerAddressService.cs index 68e9932..4f1e7cf 100644 --- a/ARW.Service/Business/BusinessService/Custom/CustomerAddresses/CustomerAddressService.cs +++ b/ARW.Service/Business/BusinessService/Custom/CustomerAddresses/CustomerAddressService.cs @@ -44,13 +44,13 @@ namespace ARW.Service.Business.BusinessService.Custom.CustomerAddresses /// /// 查询客户收货地址分页列表 /// - public Task> GetCustomerAddressList(CustomerAddressQueryDto parm) + public async Task> GetCustomerAddressList(CustomerAddressQueryDto parm) { //开始拼装查询条件d var predicate = Expressionable.Create(); - predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.CustomerAddressName), it => it.CustomerAddressName.Contains(parm.CustomerAddressName)); - predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.CustomerAddressPhone), it => it.CustomerAddressPhone.Contains(parm.CustomerAddressPhone)); + predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.CustomerAddressName), s => s.CustomerAddressName.Contains(parm.CustomerAddressName)); + predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.CustomerAddressPhone), s => s.CustomerAddressPhone.Contains(parm.CustomerAddressPhone)); var query = _CustomerAddressRepository .Queryable() .LeftJoin((s, c) => s.CustomerAddressCustomerGuid == c.CustomerGuid) @@ -75,7 +75,7 @@ namespace ARW.Service.Business.BusinessService.Custom.CustomerAddresses }); - return query.ToPageAsync(parm); + return await query.ToPageAsync(parm); } /// diff --git a/ARW.Service/Business/BusinessService/ShopManager/Shops/ShopService.cs b/ARW.Service/Business/BusinessService/ShopManager/Shops/ShopService.cs index 78ce3d7..df299e4 100644 --- a/ARW.Service/Business/BusinessService/ShopManager/Shops/ShopService.cs +++ b/ARW.Service/Business/BusinessService/ShopManager/Shops/ShopService.cs @@ -14,6 +14,9 @@ using ARW.Service.Business.IBusinessService.ShopManager.Shops; using ARW.Model.Dto.Business.ShopManager.Shops; using ARW.Model.Models.Business.ShopManager.Shops; using ARW.Model.Vo.Business.ShopManager.Shops; +using MimeKit; +using ARW.Model.Models.Business.Custom.Customers; +using ARW.Repository.Business.Custom.Customers; namespace ARW.Service.Business.BusinessService.ShopManager.Shops { @@ -27,10 +30,13 @@ namespace ARW.Service.Business.BusinessService.ShopManager.Shops public class ShopServiceImpl : BaseService, IShopService { private readonly ShopRepository _ShopRepository; + private readonly CustomerRepository _CustomerRepository; - public ShopServiceImpl(ShopRepository ShopRepository) + + public ShopServiceImpl(ShopRepository ShopRepository, CustomerRepository customerRepository) { this._ShopRepository = ShopRepository; + _CustomerRepository = customerRepository; } #region 业务逻辑代码 @@ -39,7 +45,7 @@ namespace ARW.Service.Business.BusinessService.ShopManager.Shops /// /// 查询店铺分页列表 /// - public Task> GetShopList(ShopQueryDto parm) + public async Task> GetShopList(ShopQueryDto parm) { //开始拼装查询条件d var predicate = Expressionable.Create(); @@ -68,7 +74,7 @@ namespace ARW.Service.Business.BusinessService.ShopManager.Shops }); - return query.ToPageAsync(parm); + return await query.ToPageAsync(parm); } /// @@ -103,6 +109,35 @@ namespace ARW.Service.Business.BusinessService.ShopManager.Shops #endregion + + /// + /// 获取未绑定的客户列表 + /// + /// + /// + /// + public async Task> GetCustomerWithOutBindList(CustomerWithOutBindQueryDto parm) + { + //开始拼装查询条件d + var predicate = Expressionable.Create(); + + predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.CustomerNickname), s => s.CustomerNickname .Contains(parm.CustomerNickname)); + + var query = _CustomerRepository + .Queryable() + .Where(predicate.ToExpression()) + .Where(s => SqlFunc.Subqueryable().Where(it => it.ShopCustomerGuid == s.CustomerGuid).NotAny()) + .OrderBy(s => s.Update_time, OrderByType.Desc) + .Select((s) => new CustomerWithOutBindVo + { + CustomerGuid = s.CustomerGuid, + CustomerNickname = s.CustomerNickname, + }); + + return await query.ToPageAsync(parm); + } + + /// /// 审核 /// diff --git a/ARW.Service/Business/IBusinessService/ShopManager/Shops/IShopService.cs b/ARW.Service/Business/IBusinessService/ShopManager/Shops/IShopService.cs index dea0e5f..a5bc3c7 100644 --- a/ARW.Service/Business/IBusinessService/ShopManager/Shops/IShopService.cs +++ b/ARW.Service/Business/IBusinessService/ShopManager/Shops/IShopService.cs @@ -25,6 +25,14 @@ namespace ARW.Service.Business.IBusinessService.ShopManager.Shops /// Task> GetShopList(ShopQueryDto parm); + + /// + /// 获取未绑定的客户列表 + /// + /// + /// + Task> GetCustomerWithOutBindList(CustomerWithOutBindQueryDto parm); + /// /// 添加或修改店铺 diff --git a/ARW.WebApi/Controllers/Business/ShopManager/Shops/ShopController.cs b/ARW.WebApi/Controllers/Business/ShopManager/Shops/ShopController.cs index c489375..f70e024 100644 --- a/ARW.WebApi/Controllers/Business/ShopManager/Shops/ShopController.cs +++ b/ARW.WebApi/Controllers/Business/ShopManager/Shops/ShopController.cs @@ -54,6 +54,18 @@ namespace ARW.WebApi.Controllers.Business.ShopManager.Shops return SUCCESS(res); } + /// + /// 获取未绑定的客户列表 + /// + /// 查询参数 + /// + [HttpGet("getCustomerWithOutBindList")] + public async Task GetCustomerWithOutBindList([FromQuery] CustomerWithOutBindQueryDto parm) + { + var res = await _ShopService.GetCustomerWithOutBindList(parm); + return SUCCESS(res); + } + /// /// 添加或修改店铺 /// diff --git a/ARW.WebApi/wwwroot/CodeGenTemplate/TplService.txt b/ARW.WebApi/wwwroot/CodeGenTemplate/TplService.txt index 293812a..e893937 100644 --- a/ARW.WebApi/wwwroot/CodeGenTemplate/TplService.txt +++ b/ARW.WebApi/wwwroot/CodeGenTemplate/TplService.txt @@ -84,7 +84,7 @@ $end /// /// 查询${genTable.FunctionName}列表 /// - public Task> Get${replaceDto.ModelTypeName}List(${replaceDto.ModelTypeName}QueryDto parm) + public async Task> Get${replaceDto.ModelTypeName}List(${replaceDto.ModelTypeName}QueryDto parm) { //开始拼装查询条件d var predicate = Expressionable.Create<${replaceDto.ModelTypeName}>(); @@ -118,13 +118,13 @@ $end }); - return query.ToListAsync(); + return await query.ToListAsync(); } $else /// /// 查询${genTable.FunctionName}分页列表 /// - public Task> Get${replaceDto.ModelTypeName}List(${replaceDto.ModelTypeName}QueryDto parm) + public async Task> Get${replaceDto.ModelTypeName}List(${replaceDto.ModelTypeName}QueryDto parm) { //开始拼装查询条件d var predicate = Expressionable.Create<${replaceDto.ModelTypeName}>(); @@ -158,7 +158,7 @@ $end }); - return query.ToPageAsync(parm); + return await query.ToPageAsync(parm); } $end