using Attribute;
using Model;
using Model.Base;
using Repository;
using Service;
using Microsoft.AspNetCore.Mvc;
using Vo.Admin;
namespace Services
{
///
/// 奖励配置Service业务层处理
///
[AppService(ServiceType = typeof(IPriListService), ServiceLifetime = LifeTime.Transient)]
public class PriListService : BaseService, IPriListService
{
///
/// 奖励配置-列表
///
/// 参数请求体
/// 分页参数
/// 列表
public PagedInfo getPriListList([FromQuery] PagerInfo page, [FromQuery] PriList param)
{
//拼装查询条件
var predicate = Expressionable.Create();
predicate = predicate.AndIF(param.projectId > 0, m => m.projectId == param.projectId);
predicate = predicate.AndIF(!string.IsNullOrEmpty(param.prizeName), m => m.prizeName.Contains(param.prizeName));
predicate = predicate.AndIF(!string.IsNullOrEmpty(param.conditionMode), m => m.conditionMode.Contains(param.conditionMode));
predicate = predicate.AndIF(!string.IsNullOrEmpty(param.prizeContent), m => m.prizeContent.Contains(param.prizeContent));
var response = Queryable()
.Where(predicate.ToExpression())
.OrderBy(m => m.kind)
.OrderByDescending(m => m.id)
.ToPage(page);
return response;
}
///
/// 奖励配置-下拉框数据
///
/// 分页参数
/// 下拉框数据
public PagedInfo getPriListDic([FromQuery] PagerInfo page)
{
//拼装查询条件
var predicate = Expressionable.Create();
var response = Queryable()
.Where(predicate.ToExpression())
.OrderByDescending(m => m.id)
.ToPage(page);
return response;
}
}
}