/// <summary> /// 新闻列表 /// </summary> /// <param name="searchSetting"></param> /// <returns></returns> public static IPageOfList<CompanyNewsInfo> List(CompanyNewsSearchSetting searchSetting) { return CompanyNewsManage.List(searchSetting); }
/// <summary> /// 分页列表(包含CompanyNews和Articles两个部分) /// </summary> /// <param name="searchSetting"></param> /// <returns></returns> public static IPageOfList<CompanyNewsInfo> List(CompanyNewsSearchSetting searchSetting) { FastPaging fp = new FastPaging(); fp.OverOrderBy = " CN.PublishDateTime DESC"; fp.PageIndex = searchSetting.PageIndex; fp.PageSize = searchSetting.PageSize; fp.QueryFields = "*"; fp.TableName = string.Format(@"( SELECT Id,CompanyId,[Type],Title,Content,Remark,ImageUrl,Tags,PublishDateTime,ModifyDateTime,CreateDateTime,IsDeleted,Url FROM CompanyNews WITH(NOLOCK) WHERE CompanyId = {0} AND [Type] = '{1}' AND IsDeleted = 0 UNION ALL SELECT Id,CompanyId,'article',Title,Content,Remark,ImageUrl,Tags,PublishDateTime,LastModifyDateTime,CreateDateTime,IsDeleted,Url FROM Articles WITH(NOLOCK) WHERE CompanyId = {0} AND IsDeleted = 0)",searchSetting.CompanyId,searchSetting.Type); fp.PrimaryKey = "Id"; fp.TableReName = "CN"; IList<CompanyNewsInfo> list = new List<CompanyNewsInfo>(); CompanyNewsInfo model = null; DataTable dt = SQLPlus.ExecuteDataTable(CommandType.Text, fp.Build2005()); if (dt != null && dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { model = GetByDataRow(dr); if (model != null) { list.Add(model); } } } int count = Convert.ToInt32(SQLPlus.ExecuteScalar(CommandType.Text, fp.BuildCountSQL())); return new PageOfList<CompanyNewsInfo>(list, searchSetting.PageIndex, searchSetting.PageSize, count); }