/// <summary> /// 分页列表 /// </summary> public PagedList <BsSMS> GetPaging(SMSQueryRequeest requeest) { requeest.Tables = "bssms bs"; requeest.Tablefields = "bs.*"; requeest.OrderBy = "bs.SysNo desc"; var row = DBContext.Select <BsSMS>(requeest.Tablefields).From(requeest.Tables); var count = DBContext.Select <int>("count(0)").From(requeest.Tables); //条件查询委托 Action <string, string, object> setWhere = (@where, name, value) => { row.AndWhere(where).Parameter(name, value); count.AndWhere(where).Parameter(name, value); }; if (requeest.Status.HasValue) { setWhere("bs.Status=@Status", "Status", requeest.Status); } var list = new PagedList <BsSMS> { TData = row.Paging(requeest.CurrentPageIndex.GetHashCode(), requeest.PageSize.GetHashCode()).OrderBy(requeest.OrderBy).QueryMany(), CurrentPageIndex = requeest.CurrentPageIndex.GetHashCode(), TotalCount = count.QuerySingle(), }; return(list); }
/// <summary> /// 查询某个时间段发送短信数量 /// </summary> /// <param name="requeest">参数</param> public List <BsSMS> GetSendingTimes(SMSQueryRequeest requeest) { //测试SQL:SELECT * FROM bssms WHERE PhoneNumber='15008228718' AND CreatedDate>='2017-11-22 00:00:00' AND CreatedDate<='2017-11-22 23:59:59' var strSql = "SELECT * FROM bssms WHERE PhoneNumber=@PhoneNumber AND CreatedDate>='@StartTime' AND CreatedDate<='@EndTime'"; var result = DBContext.Sql(strSql) .Parameter("PhoneNumber", requeest.PhoneNumber) .Parameter("StartTime", requeest.StartTime) .Parameter("EndTime", requeest.EndTime) .QueryMany <BsSMS>(); return(result); }
/// <summary> /// 分页列表 /// </summary> public PagedList <BsSMS> GetPaging(SMSQueryRequeest requeest) { return(Using <ISMS>().GetPaging(requeest)); }
/// <summary> /// 查询某个时间段发送短信数量 /// </summary> /// <param name="requeest">参数</param> public List <BsSMS> GetSendingTimes(SMSQueryRequeest requeest) { return(Using <ISMS>().GetSendingTimes(requeest)); }