using Edu.Common.Enum;
using Edu.Model.Entity.WeChat;
using Edu.Model.ViewModel.WeChat;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VT.FW.DB.Dapper;
namespace Edu.Repository.WeChat
{
///
/// 投稿小程序信息仓储层
///
public class RB_Contribute_AppletRepository : BaseRepository
{
///
/// 获取分页列表
///
///
///
///
///
///
public List GetPageList(int pageIndex,int pageSize,out long count, RB_Contribute_Applet_ViewModel demodel)
{
DynamicParameters parameters = new DynamicParameters();
string where = $@" 1=1 and r.{nameof(RB_Contribute_Applet_ViewModel.Status)} =0";
if (demodel.Group_Id > 0)
{
where += $@" and r.{nameof(RB_Contribute_Applet_ViewModel.Group_Id)} ={demodel.Group_Id}";
}
if (!string.IsNullOrEmpty(demodel.Name))
{
where += $@" and r.{nameof(RB_Contribute_Applet_ViewModel.Name)} like @Name";
parameters.Add("Name", "%" + demodel.Name + "%");
}
if (!string.IsNullOrEmpty(demodel.AppID))
{
where += $@" and r.{nameof(RB_Contribute_Applet_ViewModel.AppID)} like @AppID";
parameters.Add("AppID", "%" + demodel.AppID + "%");
}
string sql = $@"
SELECT * From RB_Contribute_Applet r
WHERE {where}
ORDER BY r.Id DESC ";
return GetPage(pageIndex, pageSize, out count, sql, parameters).ToList();
}
///
/// 获取列表
///
///
///
public List GetList(RB_Contribute_Applet_ViewModel demodel)
{
DynamicParameters parameters = new DynamicParameters();
string where = $@" 1=1 and r.{nameof(RB_Contribute_Applet_ViewModel.Status)} =0";
if (demodel.Group_Id > 0)
{
where += $@" and r.{nameof(RB_Contribute_Applet_ViewModel.Group_Id)} ={demodel.Group_Id}";
}
if (!string.IsNullOrEmpty(demodel.Name))
{
where += $@" and r.{nameof(RB_Contribute_Applet_ViewModel.Name)} like @Name";
parameters.Add("Name", "%" + demodel.Name + "%");
}
if (!string.IsNullOrEmpty(demodel.AppID))
{
where += $@" and r.{nameof(RB_Contribute_Applet_ViewModel.AppID)} like @AppID";
parameters.Add("AppID", "%" + demodel.AppID + "%");
}
string sql = $@"
SELECT * From RB_Contribute_Applet r
WHERE {where}
ORDER BY r.Id DESC ";
return Get(sql, parameters).ToList();
}
}
}