Beispiel #1
0
 /// <summary>
 /// 帖子管理时查询帖子分页集合
 /// </summary>
 /// <param name="query">帖子查询条件</param>
 /// <param name="pageSize">每页多少条数据</param>
 /// <param name="pageIndex">页码</param>
 /// <returns>帖子分页集合</returns>
 public PagingDataSet <BarThread> Gets(string tenantTypeId, BarThreadQuery query, int pageSize, int pageIndex)
 {
     //当SubjectKeyword、StartDate、EndDate为null时,进行缓存
     //当SectionId不为null时,使用分区版本,分区名为:SectionId,否则使用全局版本
     //缓存周期:对象集合,需要维护即时性
     //使用用户选择器设置query.UserId参数
     return(barThreadRepository.Gets(tenantTypeId, query, pageSize, pageIndex));
 }
Beispiel #2
0
        /// <summary>
        /// 帖子管理时查询帖子分页集合
        /// </summary>
        /// <param name="tenantTypeId">租户类型Id</param>
        /// <param name="query">帖子查询条件</param>
        /// <param name="pageSize">每页多少条数据</param>
        /// <param name="pageIndex">页码</param>
        /// <returns>帖子分页集合</returns>
        public PagingDataSet <BarThread> Gets(string tenantTypeId, BarThreadQuery query, int pageSize, int pageIndex)
        {
            var sql = Sql.Builder;

            sql.Select("*")
            .From("spb_BarThreads");

            if (query.CategoryId.HasValue && query.CategoryId.Value > 0)
            {
                sql.InnerJoin("tn_ItemsInCategories")
                .On("ThreadId = tn_ItemsInCategories.ItemId");
                sql.Where("tn_ItemsInCategories.CategoryId=@0", query.CategoryId.Value);
            }

            if (!string.IsNullOrEmpty(tenantTypeId))
            {
                sql.Where("TenantTypeId = @0", tenantTypeId);
            }

            if (query.UserId != null && query.UserId > 0)
            {
                sql.Where("UserId = @0", query.UserId);
            }

            if (query.SectionId != null && query.SectionId > 0)
            {
                sql.Where("SectionId = @0", query.SectionId);
            }

            if (query.AuditStatus != null)
            {
                sql.Where("AuditStatus = @0", query.AuditStatus);
            }

            if (!string.IsNullOrEmpty(query.SubjectKeyword))
            {
                sql.Where("Subject like @0", StringUtility.StripSQLInjection(query.SubjectKeyword) + "%");
            }

            if (query.IsEssential.HasValue)
            {
                sql.Where("IsEssential = @0", query.IsEssential.Value);
            }

            if (query.IsSticky.HasValue)
            {
                sql.Where("IsSticky = @0", query.IsSticky.Value);
            }

            if (query.StartDate != null)
            {
                sql.Where("DateCreated >= @0", query.StartDate);
            }
            if (query.EndDate != null)
            {
                sql.Where("DateCreated < @0", query.EndDate.Value.AddDays(1));
            }
            sql.OrderBy("ThreadId desc");

            return(GetPagingEntities(pageSize, pageIndex, sql));
        }
 /// <summary>
 /// 帖子管理时查询帖子分页集合
 /// </summary>
 /// <param name="query">帖子查询条件</param>
 /// <param name="pageSize">每页多少条数据</param>
 /// <param name="pageIndex">页码</param>
 /// <returns>帖子分页集合</returns>
 public PagingDataSet<BarThread> Gets(string tenantTypeId, BarThreadQuery query, int pageSize, int pageIndex)
 {
     //当SubjectKeyword、StartDate、EndDate为null时,进行缓存
     //当SectionId不为null时,使用分区版本,分区名为:SectionId,否则使用全局版本
     //缓存周期:对象集合,需要维护即时性
     //使用用户选择器设置query.UserId参数
     return barThreadRepository.Gets(tenantTypeId, query, pageSize, pageIndex);
 }