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.EmotionManage.EmoticonDatas; using ARW.Service.Api.IBusinessService.EmotionManage.EmoticonDatas; using ARW.Model.Dto.Api.EmotionManage.EmoticonDatas; using ARW.Model.Models.Business.EmotionManage.EmoticonDatas; using ARW.Model.Vo.Api.EmotionManage.EmoticonDatas; using ARW.Model.Models.Business.EmotionManage.EmotionCategorys; namespace ARW.Service.Api.BusinessService.EmotionManage.EmoticonDatas { /// /// 表情包接口实现类Api /// /// @author lwh /// @date 2023-10-29 /// [AppService(ServiceType = typeof(IEmoticonDataServiceApi), ServiceLifetime = LifeTime.Transient)] public class EmoticonDataServiceImplApi : BaseService, IEmoticonDataServiceApi { private readonly EmoticonDataRepository _EmoticonDataRepository; public EmoticonDataServiceImplApi(EmoticonDataRepository EmoticonDataRepository) { this._EmoticonDataRepository = EmoticonDataRepository; } #region Api接口代码 /// /// 查询表情包列表(Api) /// /// /// public async Task> GetEmoticonDataListApi(EmoticonDataQueryDtoApi parm) { //开始拼装查询条件d var predicate = Expressionable.Create(); predicate = predicate.AndIF(parm.EmoticonCategoryGuid != 0, s => s.EmoticonCategoryGuid == parm.EmoticonCategoryGuid); var query = _EmoticonDataRepository .Queryable() .LeftJoin((s,c) => s.EmoticonCategoryGuid == c.EmotionCategoryGuid) .WhereIF(!string.IsNullOrEmpty(parm.EmoticonDataName), (s,c) => s.EmoticonDataName.Contains(parm.EmoticonDataName) || c.EmotionCategoryName.Contains(parm.EmoticonDataName)) .Where(predicate.ToExpression()) .OrderByIF(parm.IsLastUpdate == false, s => s.EmoticonDataSort, OrderByType.Asc) .OrderByIF(parm.IsLastUpdate == true, s => s.Create_time, OrderByType.Desc) .Select(s => new EmoticonDataVoApi { EmoticonDataId = s.EmoticonDataId, EmoticonDataGuid = s.EmoticonDataGuid, EmoticonCategoryGuid = s.EmoticonCategoryGuid, EmoticonDataName = s.EmoticonDataName, EmoticonDataImg = s.EmoticonDataImg, EmoticonDataSort = s.EmoticonDataSort, }); return await query.ToPageAsync(parm); } #endregion } }