using JNPF.Common.Core.Manager;
using JNPF.Common.Filter;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
using JNPF.DynamicApiController;
using JNPF.DependencyInjection;
using JNPF.Common.Extension;
using JNPF.Extend.Entitys.Entity;
using JNPF.Extend.Entitys.Dto.Customer;
namespace JNPF.Extend;
///
/// 客户信息.
///
[ApiDescriptionSettings(Tag = "Extend", Name = "Customer", Order = 600)]
[Route("api/extend/saleOrder/[controller]")]
public class ProductCustomerService : IDynamicApiController, ITransient
{
///
/// 服务基础仓储.
///
private readonly ISqlSugarRepository _repository;
///
/// 用户管理.
///
private readonly IUserManager _userManager;
public ProductCustomerService(
ISqlSugarRepository repository,
IUserManager userManager)
{
_repository = repository;
_userManager = userManager;
}
#region GET
///
/// 客户列表.
///
///
[HttpGet("")]
public async Task GetList([FromQuery] PageInputBase input)
{
var data = await _repository.AsQueryable()
.Where(it => it.Deletemark == null)
.WhereIF(input.keyword.IsNotEmptyOrNull(), x => x.Name.Contains(input.keyword))
.Select(x => new ProductCustomerListOutput
{
id = x.Id,
code = x.Code,
name = x.Name,
customerName = x.Customername,
address = x.Address,
contactTel = x.ContactTel
})
.ToListAsync();
return new { list = data };
}
#endregion
}