using System.Collections.Generic;
using System.Linq;
using Edu.Common.Enum;
using Edu.Model.Entity.Finance;
using Edu.Model.ViewModel.Finance;
namespace Edu.Repository.Finance
{
///
/// 教育轧账仓储层
///
public class RB_RollingAccountRepository : BaseRepository
{
///
/// 获取列表
///
///
///
public List GetList(RB_RollingAccount_Extend model)
{
string where = " WHERE 1=1 ";
if (model.GroupId > 0)
{
where += string.Format(" AND " + nameof(RB_RollingAccount_Extend.GroupId) + "={0} ", model.GroupId);
}
if (model.State > 0)
{
where += string.Format(" AND " + nameof(RB_RollingAccount_Extend.State) + "={0} ", model.State);
}
if (!string.IsNullOrEmpty(model.Month))
{
where += string.Format(" AND " + nameof(RB_RollingAccount_Extend.Month) + "='{0}' ", model.Month);
}
if (model.SchoolId >= 0)
{
where += string.Format(" AND FIND_IN_SET('{0}',"+ nameof(RB_RollingAccount_Extend.SchoolIds) + ") ", model.SchoolId);
}
string sql = "select * from RB_RollingAccount " + where +" order by Id desc";
return Get(sql).ToList();
}
///
/// 分页列表
///
///
///
///
///
///
public List GetPageList(int pageIndex,int pageSize,out long count,RB_RollingAccount_Extend model)
{
string where = " WHERE 1=1 ";
if (model.GroupId > 0)
{
where += string.Format(" AND " + nameof(RB_RollingAccount_Extend.GroupId) + "={0} ", model.GroupId);
}
if (model.State > 0)
{
where += string.Format(" AND " + nameof(RB_RollingAccount_Extend.State) + "={0} ", model.State);
}
if (!string.IsNullOrEmpty(model.Month))
{
where += string.Format(" AND " + nameof(RB_RollingAccount_Extend.Month) + "='{0}' ", model.Month);
}
if (model.SchoolId >= 0)
{
where += string.Format(" AND FIND_IN_SET('{0}'," + nameof(RB_RollingAccount_Extend.SchoolIds) + ") ", model.SchoolId);
}
string sql = "select * from RB_RollingAccount " + where + " order by Id desc";
return GetPage(pageIndex, pageSize, out count, sql).ToList();
}
}
}