ZrAdminNetCore/ZR.Service/Liveforum/TBannersService.cs
2025-11-16 18:50:32 +08:00

80 lines
2.3 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using Infrastructure.Attribute;
using Infrastructure.Extensions;
using ZR.LiveForum.Model.Liveforum.Dto;
using ZR.LiveForum.Model.Liveforum;
using ZR.Repository;
using ZR.Service.Liveforum.ILiveforumService;
namespace ZR.Service.Liveforum
{
/// <summary>
/// 轮播图表存储首页轮播图配置信息Service业务层处理
/// </summary>
[AppService(ServiceType = typeof(ITBannersService), ServiceLifetime = LifeTime.Transient)]
public class TBannersService : BaseService<TBanners>, ITBannersService
{
/// <summary>
/// 查询轮播图表,存储首页轮播图配置信息列表
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
public PagedInfo<TBannersDto> GetList(TBannersQueryDto parm)
{
var predicate = QueryExp(parm);
var response = Queryable()
//.OrderBy("Id desc")
.Where(predicate.ToExpression())
.ToPage<TBanners, TBannersDto>(parm);
return response;
}
/// <summary>
/// 获取详情
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public TBanners GetInfo(int Id)
{
var response = Queryable()
.Where(x => x.Id == Id)
.First();
return response;
}
/// <summary>
/// 添加轮播图表,存储首页轮播图配置信息
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public TBanners AddTBanners(TBanners model)
{
return Insertable(model).ExecuteReturnEntity();
}
/// <summary>
/// 修改轮播图表,存储首页轮播图配置信息
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public int UpdateTBanners(TBanners model)
{
return Update(model, true);
}
/// <summary>
/// 查询导出表达式
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
private static Expressionable<TBanners> QueryExp(TBannersQueryDto parm)
{
var predicate = Expressionable.Create<TBanners>();
return predicate;
}
}
}