77 lines
2.9 KiB
C#
77 lines
2.9 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.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
|
|
{
|
|
/// <summary>
|
|
/// 表情包接口实现类Api
|
|
///
|
|
/// @author lwh
|
|
/// @date 2023-10-29
|
|
/// </summary>
|
|
[AppService(ServiceType = typeof(IEmoticonDataServiceApi), ServiceLifetime = LifeTime.Transient)]
|
|
public class EmoticonDataServiceImplApi : BaseService<EmoticonData>, IEmoticonDataServiceApi
|
|
{
|
|
private readonly EmoticonDataRepository _EmoticonDataRepository;
|
|
|
|
public EmoticonDataServiceImplApi(EmoticonDataRepository EmoticonDataRepository)
|
|
{
|
|
this._EmoticonDataRepository = EmoticonDataRepository;
|
|
}
|
|
|
|
#region Api接口代码
|
|
|
|
|
|
/// <summary>
|
|
/// 查询表情包列表(Api)
|
|
/// </summary>
|
|
/// <param name="parm"></param>
|
|
/// <returns></returns>
|
|
public async Task<PagedInfo<EmoticonDataVoApi>> GetEmoticonDataListApi(EmoticonDataQueryDtoApi parm)
|
|
{
|
|
//开始拼装查询条件d
|
|
var predicate = Expressionable.Create<EmoticonData>();
|
|
|
|
predicate = predicate.AndIF(parm.EmoticonCategoryGuid != 0, s => s.EmoticonCategoryGuid == parm.EmoticonCategoryGuid);
|
|
var query = _EmoticonDataRepository
|
|
.Queryable()
|
|
.LeftJoin<EmotionCategory>((s, c) => s.EmoticonCategoryGuid == c.EmotionCategoryGuid)
|
|
.WhereIF(!string.IsNullOrEmpty(parm.Search), (s, c) => s.EmoticonDataName.Contains(parm.Search) || c.EmotionCategoryName.Contains(parm.Search) || s.GetNum == parm.Search)
|
|
.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
|
|
|
|
}
|
|
}
|