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 { /// <summary> /// 投稿图文内容仓储层 /// </summary> public class RB_Contribute_InfoRepository : BaseRepository<RB_Contribute_Info> { /// <summary> /// 获取分页列表 /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <param name="count"></param> /// <param name="demodel"></param> /// <returns></returns> public List<RB_Contribute_Info_ViewModel> GetPageList(int pageIndex,int pageSize,out long count, RB_Contribute_Info_ViewModel demodel) { DynamicParameters parameters = new DynamicParameters(); string where = $@" 1=1 and r.{nameof(RB_Contribute_Info_ViewModel.Status)} =0"; if (demodel.Group_Id > 0) { where += $@" and r.{nameof(RB_Contribute_Info_ViewModel.Group_Id)} ={demodel.Group_Id}"; } if (demodel.CreateBy > 0) { where += $@" and r.{nameof(RB_Contribute_Info_ViewModel.CreateBy)} ={demodel.CreateBy}"; } if (demodel.MediaState > 0) { where += $@" and r.{nameof(RB_Contribute_Info_ViewModel.MediaState)} ={demodel.MediaState}"; } if (demodel.AuditState >= 0) { where += $@" and r.{nameof(RB_Contribute_Info_ViewModel.AuditState)} ={(int)demodel.AuditState}"; } if (demodel.Type > 0) { where += $@" and r.{nameof(RB_Contribute_Info_ViewModel.Type)} ={(int)demodel.Type}"; } if (!string.IsNullOrEmpty(demodel.Title)) { where += $@" and r.{nameof(RB_Contribute_Info_ViewModel.Title)} like @Content"; parameters.Add("Content", "%" + demodel.Title + "%"); } string sql = $@" SELECT * From RB_Contribute_Info r WHERE {where} ORDER BY r.Id DESC "; return GetPage<RB_Contribute_Info_ViewModel>(pageIndex, pageSize, out count, sql, parameters).ToList(); } /// <summary> /// 获取列表 /// </summary> /// <param name="demodel"></param> /// <returns></returns> public List<RB_Contribute_Info_ViewModel> GetList(RB_Contribute_Info_ViewModel demodel) { DynamicParameters parameters = new DynamicParameters(); string where = $@" 1=1 and r.{nameof(RB_Contribute_Info_ViewModel.Status)} =0"; if (demodel.Group_Id > 0) { where += $@" and r.{nameof(RB_Contribute_Info_ViewModel.Group_Id)} ={demodel.Group_Id}"; } if (demodel.MediaState > 0) { where += $@" and r.{nameof(RB_Contribute_Info_ViewModel.MediaState)} ={demodel.MediaState}"; } if (demodel.AuditState >= 0) { where += $@" and r.{nameof(RB_Contribute_Info_ViewModel.AuditState)} ={(int)demodel.AuditState}"; } if (demodel.Type > 0) { where += $@" and r.{nameof(RB_Contribute_Info_ViewModel.Type)} ={(int)demodel.Type}"; } if (!string.IsNullOrEmpty(demodel.Q_ContributeIds)) { where += $@" and r.{nameof(RB_Contribute_Info_ViewModel.Id)} in({demodel.Q_ContributeIds})"; } if (!string.IsNullOrEmpty(demodel.Title)) { where += $@" and r.{nameof(RB_Contribute_Info_ViewModel.Title)} like @Content"; parameters.Add("Content", "%" + demodel.Title + "%"); } string sql = $@" SELECT * From RB_Contribute_Info r WHERE {where} ORDER BY r.Id DESC "; return Get<RB_Contribute_Info_ViewModel>(sql, parameters).ToList(); } /// <summary> /// 获取可发放提成的投稿列表 /// </summary> /// <param name="group_Id"></param> /// <param name="eDate"></param> /// <returns></returns> public List<RB_Contribute_Info_ViewModel> GetCanSendCommissionList(int group_Id, string eDate) { string sql = $@"SELECT * FROM rb_contribute_info WHERE `Status` =0 and Group_Id ={group_Id} and AuditState =2 and PublishDate <='{eDate} 23:59:59' and IFNULL(IsSendCommission,0) <>1 and RemunerationState =1"; return Get<RB_Contribute_Info_ViewModel>(sql).ToList(); } } }