Files
tnb.server/extend/Tnb.Extend/ProductCustomerService.cs
2023-05-31 10:19:05 +08:00

65 lines
1.7 KiB
C#

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;
/// <summary>
/// 客户信息.
/// </summary>
[ApiDescriptionSettings(Tag = "Extend", Name = "Customer", Order = 600)]
[Route("api/extend/saleOrder/[controller]")]
public class ProductCustomerService : IDynamicApiController, ITransient
{
/// <summary>
/// 服务基础仓储.
/// </summary>
private readonly ISqlSugarRepository<ProductCustomerEntity> _repository;
/// <summary>
/// 用户管理.
/// </summary>
private readonly IUserManager _userManager;
public ProductCustomerService(
ISqlSugarRepository<ProductCustomerEntity> repository,
IUserManager userManager)
{
_repository = repository;
_userManager = userManager;
}
#region GET
/// <summary>
/// 客户列表.
/// </summary>
/// <returns></returns>
[HttpGet("")]
public async Task<dynamic> 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
}