81 lines
2.3 KiB
C#
81 lines
2.3 KiB
C#
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(IT_BannersService), ServiceLifetime = LifeTime.Transient)]
|
|
public class T_BannersService : BaseService<T_Banners>, IT_BannersService
|
|
{
|
|
/// <summary>
|
|
/// 查询首页轮播图列表
|
|
/// </summary>
|
|
/// <param name="parm"></param>
|
|
/// <returns></returns>
|
|
public PagedInfo<T_BannersDto> GetList(T_BannersQueryDto parm)
|
|
{
|
|
var predicate = QueryExp(parm);
|
|
|
|
var response = Queryable()
|
|
//.OrderBy("SortOrder desc")
|
|
.Where(predicate.ToExpression())
|
|
.ToPage<T_Banners, T_BannersDto>(parm);
|
|
|
|
return response;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 获取详情
|
|
/// </summary>
|
|
/// <param name="Id"></param>
|
|
/// <returns></returns>
|
|
public T_Banners GetInfo(int Id)
|
|
{
|
|
var response = Queryable()
|
|
.Where(x => x.Id == Id)
|
|
.First();
|
|
|
|
return response;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加首页轮播图
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
/// <returns></returns>
|
|
public T_Banners AddT_Banners(T_Banners model)
|
|
{
|
|
return Insertable(model).ExecuteReturnEntity();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改首页轮播图
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
/// <returns></returns>
|
|
public int UpdateT_Banners(T_Banners model)
|
|
{
|
|
return Update(model, true);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 查询导出表达式
|
|
/// </summary>
|
|
/// <param name="parm"></param>
|
|
/// <returns></returns>
|
|
private static Expressionable<T_Banners> QueryExp(T_BannersQueryDto parm)
|
|
{
|
|
var predicate = Expressionable.Create<T_Banners>();
|
|
|
|
predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.Title), it => it.Title == parm.Title);
|
|
return predicate;
|
|
}
|
|
}
|
|
} |