72 lines
2.5 KiB
C#
72 lines
2.5 KiB
C#
using Infrastructure.Attribute;
|
|
using Microsoft.AspNetCore.Http;
|
|
using SqlSugar;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using ARW.Model;
|
|
using ARW.Repository;
|
|
using ARW.Repository.Business.Customers;
|
|
using ARW.Service.Business.IBusinessService.Customers;
|
|
using ARW.Model.Dto.Business.Customers;
|
|
using ARW.Model.Models.Business.Customers;
|
|
using ARW.Model.Vo.Business.Customers;
|
|
|
|
namespace ARW.Service.Business.BusinessService.Customers
|
|
{
|
|
/// <summary>
|
|
/// 小程序客户接口实现类
|
|
/// </summary>
|
|
[AppService(ServiceType = typeof(ICustomerService), ServiceLifetime = LifeTime.Transient)]
|
|
public class CustomerServiceImpl : BaseService<Customer>, ICustomerService
|
|
{
|
|
private readonly CustomerRepository _CustomerRepository;
|
|
|
|
public CustomerServiceImpl(CustomerRepository CustomerRepository)
|
|
{
|
|
this._CustomerRepository = CustomerRepository;
|
|
}
|
|
|
|
#region 业务逻辑代码
|
|
|
|
/// <summary>
|
|
/// 查询小程序客户列表
|
|
/// </summary>
|
|
/// <param name="parm"></param>
|
|
/// <returns></returns>
|
|
public Task<PagedInfo<CustomerVo>> GetCustomerList(CustomerQueryDto parm)
|
|
{
|
|
//开始拼装查询条件d
|
|
var predicate = Expressionable.Create<Customer>();
|
|
|
|
predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.CustomerName), it => it.CustomerName.Contains(parm.CustomerName));
|
|
predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.CustomerXcxName), it => it.CustomerXcxName.Contains(parm.CustomerXcxName));
|
|
var query = _CustomerRepository
|
|
.Queryable()
|
|
.Where(predicate.ToExpression())
|
|
.OrderBy(s => s.Create_time,OrderByType.Desc)
|
|
.Select(s => new CustomerVo
|
|
{
|
|
CustomerId = s.CustomerId,
|
|
CustomerGuid = s.CustomerGuid,
|
|
CustomerName = s.CustomerName,
|
|
CustomerPhone = s.CustomerPhone,
|
|
CustomerBrithday = s.CustomerBirth,
|
|
CustomerImg = s.CustomerImg,
|
|
CustomerSex = s.CustomerSex,
|
|
CustomerXcxOpenid = s.CustomerXcxOpenid,
|
|
CustomerXcxName = s.CustomerXcxName,
|
|
CustomerXcxImg = s.CustomerXcxImg,
|
|
});
|
|
|
|
|
|
return query.ToPageAsync(parm);
|
|
}
|
|
|
|
#endregion
|
|
|
|
}
|
|
}
|