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.Notices;
|
|
using ARW.Service.Api.IBusinessService.Advertisement.Notices;
|
|
using ARW.Model.Dto.Api.Advertisement.Notices;
|
|
using ARW.Model.Models.Business.Advertisement.Notices;
|
|
using ARW.Model.Vo.Api.Advertisement.Notices;
|
|
|
|
namespace ARW.Service.Api.BusinessService.Advertisement.Notices
|
|
{
|
|
/// <summary>
|
|
/// 公告接口实现类Api
|
|
///
|
|
/// @author lwh
|
|
/// @date 2023-10-09
|
|
/// </summary>
|
|
[AppService(ServiceType = typeof(INoticeServiceApi), ServiceLifetime = LifeTime.Transient)]
|
|
public class NoticeServiceImplApi : BaseService<Notice>, INoticeServiceApi
|
|
{
|
|
private readonly NoticeRepository _NoticeRepository;
|
|
|
|
public NoticeServiceImplApi(NoticeRepository NoticeRepository)
|
|
{
|
|
this._NoticeRepository = NoticeRepository;
|
|
}
|
|
|
|
#region Api接口代码
|
|
|
|
|
|
/// <summary>
|
|
/// 查询公告列表(Api)
|
|
/// </summary>
|
|
/// <param name="parm"></param>
|
|
/// <returns></returns>
|
|
public async Task<List<NoticeVoApi>> GetNoticeListApi(NoticeQueryDtoApi parm)
|
|
{
|
|
//开始拼装查询条件d
|
|
var predicate = Expressionable.Create<Notice>();
|
|
|
|
var query = _NoticeRepository
|
|
.Queryable()
|
|
.Where(predicate.ToExpression())
|
|
.OrderBy(s => s.NoticeSort, OrderByType.Asc)
|
|
.Select(s => new NoticeVoApi
|
|
{
|
|
NoticeId = s.NoticeId,
|
|
NoticeGuid = s.NoticeGuid,
|
|
NoticeTitle = s.NoticeTitle,
|
|
NoticeContent = s.NoticeContent,
|
|
NoticeSort = s.NoticeSort,
|
|
});
|
|
|
|
|
|
return await query.ToListAsync();
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
}
|
|
}
|