using Edu.Common.Enum;
using Edu.Model.Entity.Customer;
using Edu.Model.ViewModel.Customer;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Edu.Repository.Customer
{
///
/// 学员跟进仓储层
///
public class RB_Student_FollowRepository : BaseRepository
{
///
/// 获取学员跟进分页列表
///
///
///
///
///
///
public List GetStudentFollowPageRepository(int pageIndex, int pageSize, out long rowsCount, RB_Student_Follow_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT A.*
FROM RB_Student_Follow AS A
WHERE 1=1
");
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Student_Follow_Extend.Status), (int)DateStateEnum.Normal);
if (query != null)
{
if (query.Group_Id > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Student_Follow_Extend.Group_Id), query.Group_Id);
}
if (query.StuId > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Student_Follow_Extend.StuId), query.StuId);
}
}
builder.AppendFormat(" ORDER BY A.{0} DESC ", nameof(RB_Student_Follow_Extend.Id));
return GetPage(pageIndex, pageSize, out rowsCount, builder.ToString()).ToList();
}
///
/// 获取学员跟进列表
///
///
///
public List GetStudentFollowListRepository( RB_Student_Follow_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT A.*
FROM RB_Student_Follow AS A
WHERE 1=1
");
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Student_Follow_Extend.Status), (int)DateStateEnum.Normal);
if (query != null)
{
if (query.Group_Id > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Student_Follow_Extend.Group_Id), query.Group_Id);
}
if (query.StuId > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Student_Follow_Extend.StuId), query.StuId);
}
if (!string.IsNullOrEmpty(query.QStuIds))
{
builder.AppendFormat(" AND A.{0} IN({1}) ", nameof(RB_Student_Follow_Extend.StuId), query.QStuIds);
}
}
builder.AppendFormat(" ORDER BY A.{0} DESC ", nameof(RB_Student_Follow_Extend.Id));
return Get(builder.ToString()).ToList();
}
}
}