81 lines
2.5 KiB
C#
81 lines
2.5 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_SystemNotificationsService), ServiceLifetime = LifeTime.Transient)]
|
|
public class T_SystemNotificationsService : BaseService<T_SystemNotifications>, IT_SystemNotificationsService
|
|
{
|
|
/// <summary>
|
|
/// 查询系统公告列表
|
|
/// </summary>
|
|
/// <param name="parm"></param>
|
|
/// <returns></returns>
|
|
public PagedInfo<T_SystemNotificationsDto> GetList(T_SystemNotificationsQueryDto parm)
|
|
{
|
|
var predicate = QueryExp(parm);
|
|
|
|
var response = Queryable()
|
|
//.OrderBy("Id desc")
|
|
.Where(predicate.ToExpression())
|
|
.ToPage<T_SystemNotifications, T_SystemNotificationsDto>(parm);
|
|
|
|
return response;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 获取详情
|
|
/// </summary>
|
|
/// <param name="Id"></param>
|
|
/// <returns></returns>
|
|
public T_SystemNotifications GetInfo(long Id)
|
|
{
|
|
var response = Queryable()
|
|
.Where(x => x.Id == Id)
|
|
.First();
|
|
|
|
return response;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加系统公告
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
/// <returns></returns>
|
|
public T_SystemNotifications AddT_SystemNotifications(T_SystemNotifications model)
|
|
{
|
|
return Insertable(model).ExecuteReturnEntity();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改系统公告
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
/// <returns></returns>
|
|
public int UpdateT_SystemNotifications(T_SystemNotifications model)
|
|
{
|
|
return Update(model, true);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 查询导出表达式
|
|
/// </summary>
|
|
/// <param name="parm"></param>
|
|
/// <returns></returns>
|
|
private static Expressionable<T_SystemNotifications> QueryExp(T_SystemNotificationsQueryDto parm)
|
|
{
|
|
var predicate = Expressionable.Create<T_SystemNotifications>();
|
|
|
|
predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.Title), it => it.Title.Contains(parm.Title));
|
|
return predicate;
|
|
}
|
|
}
|
|
} |