public BS_Template Get2(string templateId, Enums.TemplateType templateType) { StringBuilder sql = new StringBuilder(string.Format(@" select * from BS_Template where id='{0}' and type='{1}'", templateId, (int)templateType)); return(DBHelper.FindBySql <BS_Template>(sql.ToString())); }
/// <summary> /// 分页获取模板集合 /// </summary> public List <BS_Template> GetList(ref PagerModel pager, string noticeType, string coreType, string name, Enums.TemplateType templateType) { StringBuilder sql = new StringBuilder(string.Format(@" select * from BS_Template t where 1=1 ")); if (!string.IsNullOrWhiteSpace(noticeType)) { sql.AppendFormat(" and nt.name like '%{0}%'", noticeType); } if (!string.IsNullOrWhiteSpace(coreType)) { sql.AppendFormat(" and ct.name like '%{0}%'", coreType); } if (!string.IsNullOrWhiteSpace(name)) { sql.AppendFormat(" and t.name like '%{0}%'", name); } sql.AppendFormat(" and t.type = '{0}'", (int)templateType); string orderby = "order by cast(id as int)"; pager = DBHelper.FindPageBySql <BS_Template>(sql.ToString(), orderby, pager.rows, pager.page); return(pager.result as List <BS_Template>); }