70 lines
2.0 KiB
C#
70 lines
2.0 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.Advertisement.Banners;
|
|
using ARW.Service.Api.IBusinessService.Advertisement.Banners;
|
|
using ARW.Model.Dto.Api.Advertisement.Banners;
|
|
using ARW.Model.Models.Business.Advertisement.Banners;
|
|
using ARW.Model.Vo.Api.Advertisement.Banners;
|
|
|
|
namespace ARW.Service.Api.BusinessService.Advertisement.Banners
|
|
{
|
|
/// <summary>
|
|
/// 轮播图接口实现类Api
|
|
///
|
|
/// @author lwh
|
|
/// @date 2023-10-09
|
|
/// </summary>
|
|
[AppService(ServiceType = typeof(IBannerServiceApi), ServiceLifetime = LifeTime.Transient)]
|
|
public class BannerServiceImplApi : BaseService<Banner>, IBannerServiceApi
|
|
{
|
|
private readonly BannerRepository _BannerRepository;
|
|
|
|
public BannerServiceImplApi(BannerRepository BannerRepository)
|
|
{
|
|
this._BannerRepository = BannerRepository;
|
|
}
|
|
|
|
#region Api接口代码
|
|
|
|
|
|
/// <summary>
|
|
/// 查询轮播图列表(Api)
|
|
/// </summary>
|
|
/// <param name="parm"></param>
|
|
/// <returns></returns>
|
|
public async Task<List<BannerVoApi>> GetBannerListApi(BannerQueryDtoApi parm)
|
|
{
|
|
//开始拼装查询条件d
|
|
var predicate = Expressionable.Create<Banner>();
|
|
|
|
predicate = predicate.AndIF(parm.BannerPosition != null, s => s.BannerPosition == parm.BannerPosition);
|
|
var query = _BannerRepository
|
|
.Queryable()
|
|
.Where(predicate.ToExpression())
|
|
.OrderBy(s => s.BannerSort, OrderByType.Asc)
|
|
.Select(s => new BannerVoApi
|
|
{
|
|
BannerPosition = s.BannerPosition,
|
|
BannerImg = s.BannerImg,
|
|
BannerSort = s.BannerSort,
|
|
});
|
|
|
|
|
|
return await query.ToListAsync();
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
}
|
|
}
|