using Edu.Common.Enum;
using Edu.Model.Entity.Course;
using Edu.Model.Entity.Sell;
using Edu.Model.ViewModel.Course;
using Edu.Model.ViewModel.Sell;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VT.FW.DB.Dapper;
namespace Edu.Repository.Sell
{
///
/// 销售提成期数仓储层
///
public class RB_Sell_Commission_PeriodsRepository : BaseRepository
{
///
/// 获取列表
///
///
///
public List GetList(RB_Sell_Commission_Periods_ViewModel demodel)
{
string where = $@" 1=1";
if (demodel.Group_Id > 0)
{
where += $@" and r.{nameof(RB_Sell_Commission_Periods_ViewModel.Group_Id)} ={demodel.Group_Id}";
}
if (!string.IsNullOrEmpty(demodel.Name))
{
where += $@" and r.{nameof(RB_Sell_Commission_Periods_ViewModel.Name)} like '%{demodel.Name}%'";
}
if (!string.IsNullOrEmpty(demodel.Periods))
{
where += $@" and r.{nameof(RB_Sell_Commission_Periods_ViewModel.Periods)} ='{demodel.Periods}'";
}
string sql = $@" select r.* from RB_Sell_Commission_Periods r where {where} order by r.Id desc";
return Get(sql).ToList();
}
///
/// 获取分页列表
///
///
///
///
///
///
public List GetPageList(int pageIndex,int pageSize,out long count,RB_Sell_Commission_Periods_ViewModel demodel)
{
string where = $@" 1=1";
if (demodel.Group_Id > 0)
{
where += $@" and r.{nameof(RB_Sell_Commission_Periods_ViewModel.Group_Id)} ={demodel.Group_Id}";
}
if (!string.IsNullOrEmpty(demodel.Name))
{
where += $@" and r.{nameof(RB_Sell_Commission_Periods_ViewModel.Name)} like '%{demodel.Name}%'";
}
string sql = $@" select r.* from RB_Sell_Commission_Periods r where {where} order by r.Id desc";
return GetPage(pageIndex, pageSize, out count, sql).ToList();
}
}
}