using Edu.Common.Enum;
using Edu.Model.Entity.WeChat;
using Edu.Model.ViewModel.WeChat;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VT.FW.DB.Dapper;
namespace Edu.Repository.WeChat
{
///
/// 企业微信渠道活码人员添加上限仓储层
///
public class RB_WeChat_ChannelLimitRepository : BaseRepository
{
///
/// 获取分页列表
///
///
///
///
///
///
public List GetPageList(int pageIndex,int pageSize,out long count, RB_WeChat_ChannelLimit_ViewModel demodel)
{
DynamicParameters parameters = new DynamicParameters();
string where = $@" 1=1 and r.{nameof(RB_WeChat_ChannelLimit_ViewModel.Status)} =0";
if (demodel.Group_Id > 0)
{
where += $@" and r.{nameof(RB_WeChat_ChannelLimit_ViewModel.Group_Id)} ={demodel.Group_Id}";
}
if (demodel.ChannelId > 0)
{
where += $@" and r.{nameof(RB_WeChat_ChannelLimit_ViewModel.ChannelId)} ={demodel.ChannelId}";
}
if (demodel.EmpId > 0)
{
where += $@" and r.{nameof(RB_WeChat_ChannelLimit_ViewModel.EmpId)} ={demodel.EmpId}";
}
string sql = $@"
SELECT * From RB_WeChat_ChannelLimit r
WHERE {where}
ORDER BY r.Id DESC ";
return GetPage(pageIndex, pageSize, out count, sql, parameters).ToList();
}
///
/// 获取列表
///
///
///
public List GetList(RB_WeChat_ChannelLimit_ViewModel demodel)
{
DynamicParameters parameters = new DynamicParameters();
string where = $@" 1=1 and r.{nameof(RB_WeChat_ChannelLimit_ViewModel.Status)} =0";
if (demodel.Group_Id > 0)
{
where += $@" and r.{nameof(RB_WeChat_ChannelLimit_ViewModel.Group_Id)} ={demodel.Group_Id}";
}
if (demodel.ChannelId > 0)
{
where += $@" and r.{nameof(RB_WeChat_ChannelLimit_ViewModel.ChannelId)} ={demodel.ChannelId}";
}
if (demodel.EmpId > 0)
{
where += $@" and r.{nameof(RB_WeChat_ChannelLimit_ViewModel.EmpId)} ={demodel.EmpId}";
}
string sql = $@"
SELECT * From RB_WeChat_ChannelLimit r
WHERE {where}
ORDER BY r.Id DESC ";
return Get(sql, parameters).ToList();
}
///
/// 获取用户所在的人员添加上限列表
///
///
///
///
public List GetChannelLimitForUser(int group_Id, int transferUserId)
{
string sql = $@"select * from rb_wechat_channellimit where `Status` =0 and Group_Id ={group_Id} and EmpId ={transferUserId}";
return Get(sql).ToList();
}
}
}