fixed 修改服务层列表没使用await问题

This commit is contained in:
lwh 2023-06-12 11:29:37 +08:00
parent 4f17c322cd
commit 747ba75b8e
6 changed files with 94 additions and 24 deletions

View File

@ -62,28 +62,43 @@ namespace ARW.Model.Dto.Business.ShopManager.Shops
/// @author 黎文豪
/// @date 2023-06-09
/// </summary>
public class ShopQueryDto : PagerInfo
public class ShopQueryDto : PagerInfo
{
public string ShopName { get; set; }
public int? ShopAuditStatus { get; set; }
public string ids { get; set; }
}
/// <summary>
///
/// @author 黎文豪
/// @date 2023-06-09
/// 审核对象
/// </summary>
public class ShopAuditDto
{
public int ShopAuditStatus { get; set; }
public string ids { get; set; }
}
/// <summary>
///
/// @author 黎文豪
/// @date 2023-06-09
/// 审核对象
/// </summary>
public class ShopAuditDto
{
public int ShopAuditStatus { get; set; }
public string ids { get; set; }
}
/// <summary>
/// 店铺查询对象
///
/// @author 黎文豪
/// @date 2023-06-09
/// </summary>
public class CustomerWithOutBindQueryDto : PagerInfo
{
public string CustomerNickname { get; set; }
}
}

View File

@ -44,13 +44,13 @@ namespace ARW.Service.Business.BusinessService.Custom.CustomerAddresses
/// <summary>
/// 查询客户收货地址分页列表
/// </summary>
public Task<PagedInfo<CustomerAddressVo>> GetCustomerAddressList(CustomerAddressQueryDto parm)
public async Task<PagedInfo<CustomerAddressVo>> GetCustomerAddressList(CustomerAddressQueryDto parm)
{
//开始拼装查询条件d
var predicate = Expressionable.Create<CustomerAddress>();
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<Customer>((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);
}
/// <summary>

View File

@ -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<Shop>, 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
/// <summary>
/// 查询店铺分页列表
/// </summary>
public Task<PagedInfo<ShopVo>> GetShopList(ShopQueryDto parm)
public async Task<PagedInfo<ShopVo>> GetShopList(ShopQueryDto parm)
{
//开始拼装查询条件d
var predicate = Expressionable.Create<Shop>();
@ -68,7 +74,7 @@ namespace ARW.Service.Business.BusinessService.ShopManager.Shops
});
return query.ToPageAsync(parm);
return await query.ToPageAsync(parm);
}
/// <summary>
@ -103,6 +109,35 @@ namespace ARW.Service.Business.BusinessService.ShopManager.Shops
#endregion
/// <summary>
/// 获取未绑定的客户列表
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public async Task<PagedInfo<CustomerWithOutBindVo>> GetCustomerWithOutBindList(CustomerWithOutBindQueryDto parm)
{
//开始拼装查询条件d
var predicate = Expressionable.Create<Customer>();
predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.CustomerNickname), s => s.CustomerNickname .Contains(parm.CustomerNickname));
var query = _CustomerRepository
.Queryable()
.Where(predicate.ToExpression())
.Where(s => SqlFunc.Subqueryable<Shop>().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);
}
/// <summary>
/// 审核
/// </summary>

View File

@ -25,6 +25,14 @@ namespace ARW.Service.Business.IBusinessService.ShopManager.Shops
/// <returns></returns>
Task<PagedInfo<ShopVo>> GetShopList(ShopQueryDto parm);
/// <summary>
/// 获取未绑定的客户列表
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
Task<PagedInfo<CustomerWithOutBindVo>> GetCustomerWithOutBindList(CustomerWithOutBindQueryDto parm);
/// <summary>
/// 添加或修改店铺

View File

@ -54,6 +54,18 @@ namespace ARW.WebApi.Controllers.Business.ShopManager.Shops
return SUCCESS(res);
}
/// <summary>
/// 获取未绑定的客户列表
/// </summary>
/// <param name="parm">查询参数</param>
/// <returns></returns>
[HttpGet("getCustomerWithOutBindList")]
public async Task<IActionResult> GetCustomerWithOutBindList([FromQuery] CustomerWithOutBindQueryDto parm)
{
var res = await _ShopService.GetCustomerWithOutBindList(parm);
return SUCCESS(res);
}
/// <summary>
/// 添加或修改店铺
/// </summary>

View File

@ -84,7 +84,7 @@ $end
/// <summary>
/// 查询${genTable.FunctionName}列表
/// </summary>
public Task<List<${replaceDto.ModelTypeName}Vo>> Get${replaceDto.ModelTypeName}List(${replaceDto.ModelTypeName}QueryDto parm)
public async Task<List<${replaceDto.ModelTypeName}Vo>> 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
/// <summary>
/// 查询${genTable.FunctionName}分页列表
/// </summary>
public Task<PagedInfo<${replaceDto.ModelTypeName}Vo>> Get${replaceDto.ModelTypeName}List(${replaceDto.ModelTypeName}QueryDto parm)
public async Task<PagedInfo<${replaceDto.ModelTypeName}Vo>> 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