/// <summary> /// 获得前几行数据 /// </summary> public IList <Wuyiju.Model.Article> GetList(Wuyiju.Model.Article.Query query, int?limit = null) { using (var db = new DataContext()) { var _dao = this.GetDao(db); return(_dao.GetList(query, limit)); } }
/// <summary> /// 获得数据列表 /// </summary> public IList <Wuyiju.Model.Article> GetList(Wuyiju.Model.Article.Query filter) { StringBuilder sql = new StringBuilder(@"select * from ec_article where 1 = 1 "); DynamicParameters param = new DynamicParameters(); sql.AndEquals("cate_id").AndEquals("status").AndEquals("is_hot").AndEquals("is_best"); if (filter != null) { param.AddDynamicParams(filter); } return(db.GetList <Wuyiju.Model.Article>(sql, param)); }
public int TodayNewCount() { var today = DateTime.Now; var query = new Wuyiju.Model.Article.Query { StartDate = new DateTime(today.Year, today.Month, today.Day, 0, 0, 0), EndDate = new DateTime(today.Year, today.Month, today.Day, 23, 59, 59) }; using (var db = new DataContext()) { var _dao = this.GetDao(db); return(_dao.GetCount(query)); } }
public int GetCount(Wuyiju.Model.Article.Query query) { StringBuilder sql = new StringBuilder(@"select count(*) from ec_article where 1=1 "); sql.AndDateBetween("add_time", "startdate", "enddate"); DynamicParameters param = new DynamicParameters(); if (query != null) { param.AddDynamicParams(query); } return(db.ExecuteScalar <int>(sql.ToString(), param)); }