using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Edu.Model.Entity.Course;
using Edu.Model.Entity.Sell;
using Edu.Model.ViewModel.Course;
using Edu.Model.ViewModel.Sell;
namespace Edu.Repository.Sell
{
///
/// 点数商品
///
public class RB_Point_GoodsRepository:BaseRepository
{
///
/// 表名称
///
public string TableName { get { return nameof(RB_Point_Goods); } }
///
/// 获取列表
///
///
///
public List GetPointGoodsList(RB_Point_Goods_Extend where)
{
StringBuilder sb = new StringBuilder();
sb.Append($@"SELECT * from RB_Point_Goods where state=0");
if (where != null)
{
if (where.Group_Id > 0)
{
sb.AppendFormat(" and Group_Id={0}", where.Group_Id);
}
if (where.School_Id > 0)
{
sb.AppendFormat(" and School_Id={0}", where.School_Id);
}
if (where.ID > 0)
{
sb.AppendFormat(" and ID={0}", where.ID);
}
if (!string.IsNullOrWhiteSpace(where.GoodsName))
{
sb.AppendFormat(" and GoodsName like'%{0}%'", where.GoodsName);
}
}
return Get(sb.ToString()).ToList();
}
///
/// 分页列表
///
///
///
///
///
///
public List GetPointGoodsPageList(int pageIndex, int pageSize, out long rowsCount, RB_Point_Goods_Extend where)
{
StringBuilder sb = new StringBuilder();
sb.Append($@"SELECT * from RB_Point_Goods where state=0");
if (where != null)
{
if (where.Group_Id > 0)
{
sb.AppendFormat(" and Group_Id={0}", where.Group_Id);
}
if (where.School_Id > 0)
{
sb.AppendFormat(" and School_Id={0}", where.School_Id);
}
if (where.ID > 0)
{
sb.AppendFormat(" and ID={0}", where.ID);
}
if (!string.IsNullOrWhiteSpace(where.GoodsName))
{
sb.AppendFormat(" and GoodsName like'%{0}%'", where.GoodsName);
}
}
return GetPage(pageIndex, pageSize, out rowsCount, sb.ToString()).ToList();
}
}
}