74 lines
2.7 KiB
C#
74 lines
2.7 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.CustomerServices;
|
|
using ARW.Service.Api.IBusinessService.CustomerServices;
|
|
using ARW.Model.Dto.Api.CustomerServices;
|
|
using ARW.Model.Models.Business.CustomerServices;
|
|
using ARW.Model.Vo.Api.CustomerServices;
|
|
|
|
namespace ARW.Service.Api.BusinessService.CustomerServices
|
|
{
|
|
/// <summary>
|
|
/// 客服接口实现类Api
|
|
///
|
|
/// @author lwh
|
|
/// @date 2023-10-21
|
|
/// </summary>
|
|
[AppService(ServiceType = typeof(ICustomerServiceServiceApi), ServiceLifetime = LifeTime.Transient)]
|
|
public class CustomerServiceServiceImplApi : BaseService<CustomerService>, ICustomerServiceServiceApi
|
|
{
|
|
private readonly CustomerServiceRepository _CustomerServiceRepository;
|
|
|
|
public CustomerServiceServiceImplApi(CustomerServiceRepository CustomerServiceRepository)
|
|
{
|
|
this._CustomerServiceRepository = CustomerServiceRepository;
|
|
}
|
|
|
|
#region Api接口代码
|
|
|
|
|
|
/// <summary>
|
|
/// 查询客服列表(Api)
|
|
/// </summary>
|
|
/// <param name="parm"></param>
|
|
/// <returns></returns>
|
|
public async Task<List<CustomerServiceVoApi>> GetCustomerServiceListApi(CustomerServiceQueryDtoApi parm)
|
|
{
|
|
//开始拼装查询条件d
|
|
var predicate = Expressionable.Create<CustomerService>();
|
|
|
|
predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.CustomerServiceName), s => s.CustomerServiceName.Contains(parm.CustomerServiceName));
|
|
predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.CustomerServicePhone), s => s.CustomerServicePhone.Contains(parm.CustomerServicePhone));
|
|
var query = _CustomerServiceRepository
|
|
.Queryable()
|
|
.Where(predicate.ToExpression())
|
|
.OrderBy(s => s.CustomerServiceSort, OrderByType.Desc)
|
|
.Select(s => new CustomerServiceVoApi
|
|
{
|
|
CustomerServiceId = s.CustomerServiceId,
|
|
CustomerServiceGuid = s.CustomerServiceGuid,
|
|
CustomerServiceName = s.CustomerServiceName,
|
|
CustomerServicePhone = s.CustomerServicePhone,
|
|
CustomerServiceImg = s.CustomerServiceImg,
|
|
WorkingHoursBeginTime = s.WorkingHoursBeginTime,
|
|
WorkingHoursEndTime = s.WorkingHoursEndTime,
|
|
CustomerServiceSort = s.CustomerServiceSort,
|
|
});
|
|
|
|
|
|
return await query.ToListAsync();
|
|
}
|
|
|
|
#endregion
|
|
|
|
}
|
|
}
|