public JsonResult QueryAppConfig(AppConfigQueryModel model) { var result = new QueryResultModel(); int totalCount = 0; var appConfigService = this.GetService <IAppConfigService>(); var list = appConfigService.QueryAppConfig(model, out totalCount); list.ForEach(p => { if (p.ValueType == "richtext" || p.ValueType == "text") { p.Value = Server.HtmlEncode(p.Value); } }); result.Data = list; result.Total = totalCount; return(Json(result)); }
/// <summary> /// 查询系统配置 /// </summary> /// <param name="model">翻页查询基本条件</param> /// <param name="totalCount">整体查询结果件数</param> /// <returns></returns> public List <AppConfig> QueryAppConfig(AppConfigQueryModel model, out int totalCount) { //查询数据 var searchKey = (string.IsNullOrEmpty(model.Key) ? "%" : "%" + model.Key.Trim() + "%"); string sql = "select * from pub.App_Config where LogicDeleteFlag=0 and ([Key] like @p0 or [Value] like @p0) and AppId=@p1 "; //分页查询必须要有排序字段 model.SortField = string.IsNullOrEmpty(model.SortField) ? "[Key]" : model.SortField; var appConfigs = this.LoadPageEntitiesBySql <AppConfig>( model.PageIndex, model.PageSize, out totalCount, sql, model.SortField + " " + model.SortOrder, searchKey, model.AppId ).ToList(); return(appConfigs); }
/// <summary> /// 查询系统配置 /// </summary> /// <param name="model">翻页查询基本条件</param> /// <param name="totalCount">整体查询结果件数</param> /// <returns></returns> public List <AppConfig> QueryAppConfig(AppConfigQueryModel model, out int totalCount) { return(appConfigRepository.QueryAppConfig(model, out totalCount)); }