public DataTable QueryPageStore(WebContentTypeSetup model) { model.Replace4MySQL(); StringBuilder str = new StringBuilder(@"select DISTINCT (ws.page_id) , t_page.parameterName as page_name "); try { str.Append(" from web_content_type_setup ws left join t_parametersrc t_site on t_site.parameterType='site_id' and t_site.parameterCode=ws.site_id "); str.Append(" left join t_parametersrc t_page on t_page.parameterType='page_id' and t_page.parameterCode=ws.page_id and t_page.topValue=t_site.rowid "); str.Append(" where 1=1 and ws.content_status=1"); if (!string.IsNullOrEmpty(model.web_content_type)) { str.AppendFormat(" and ws.web_content_type='{0}'", model.web_content_type); } if (model.site_id != 0) { str.AppendFormat(" and ws.site_id='{0}'", model.site_id); } if (model.page_id != 0) { str.AppendFormat(" and ws.page_id='{0}'", model.page_id); } if (model.area_id != 0) { str.AppendFormat(" and ws.area_id='{0}'", model.area_id); } return _access.getDataTable(str.ToString()); } catch (Exception ex) { throw new Exception("WebContentTypeSetupDao.QueryPageStore-->" + ex.Message + str.ToString(), ex); } }
public List<WebContentTypeSetup> Query(WebContentTypeSetup model) { model.Replace4MySQL(); string s = string.Format(@"select * from web_content_type_setup where 1=1 and content_status=1"); try { if (!string.IsNullOrEmpty(model.web_content_type)) { s += string.Format(" and web_content_type='{0}'", model.web_content_type); } if (model.site_id != 0) { s += string.Format(" and site_id='{0}'", model.site_id); } if (model.page_id != 0) { s += string.Format(" and page_id='{0}'", model.page_id); } if (model.area_id != 0) { s += string.Format(" and area_id='{0}'", model.area_id); } return _access.getDataTableForObj<WebContentTypeSetup>(s.ToString()); } catch (Exception ex) { throw new Exception("WebContentTypeSetupDao.Query-->" + ex.Message + s.ToString(), ex); } }