/// <summary>根据分类状态获取分类索引</summary> /// <param name="whereClause">WHERE 查询条件</param> /// <param name="applicationTag">程序标识</param> /// <returns>分类索引对象</returns> public ICategoryIndex FetchCategoryIndex(string whereClause) { Dictionary <string, object> args = new Dictionary <string, object>(); // args.Add("ApplicationStore", ForumUtility.ToDataTablePrefix(applicationTag)); //ApplicationInfo application = AppsContext.Instance.ApplicationService["Forum"]; //if (!AppsSecurity.IsAdministrator(KernelContext.Current.User, application.ApplicationName)) //{ // StringBuilder bindScope = new StringBuilder(); // bindScope.Append(string.Format(" Id IN (SELECT distinct EntityId from {0}_Category_Scope S,view_AuthObject_Account A", ForumUtility.ToDataTablePrefix(applicationTag))); // bindScope.Append(" where s.AuthorizationObjectId=a.AuthorizationObjectId"); // bindScope.Append(" and s.AuthorizationObjectType = a.AuthorizationObjectType"); // bindScope.Append(" and a.AccountId = '" + KernelContext.Current.User.Id + "')"); // args.Add("BindScope", bindScope); //} args.Add("WhereClause", StringHelper.ToSafeSQL(whereClause)); IList <string> list = ibatisMapper.QueryForList <string>(StringHelper.ToProcedurePrefix(string.Format("{0}_FetchCategoryIndex", tableName)), args); CategoryIndexWriter writer = new CategoryIndexWriter("选择类别"); foreach (string item in list) { if (item != "") { writer.Read(item); } } return(writer.Write()); }
///<summary>根据用户标识获取类别索引</summary> ///<param name="accountIds">用户标识</param> ///<param name="prefixCategoryIndex">类别索引前缀</param> ///<returns>类别索引对象</returns> public ICategoryIndex FetchCategoryIndex(string accountIds, string prefixCategoryIndex) { Dictionary <string, object> args = new Dictionary <string, object>(); args.Add("WhereClause", string.Format(" {0} AND {1} ", string.IsNullOrEmpty(accountIds) ? string.Empty : string.Format(" AccountId IN ('{0}') ", StringHelper.ToSafeSQL(accountIds).Replace(",", "','")), string.IsNullOrEmpty(prefixCategoryIndex) ? string.Empty : string.Format(" CategoryIndex LIKE '{0}%' ", StringHelper.ToSafeSQL(prefixCategoryIndex)))); IList <string> list = ibatisMapper.QueryForList <string>(StringHelper.ToProcedurePrefix(string.Format("{0}_FetchCategoryIndex", tableName)), args); CategoryIndexWriter writer = new CategoryIndexWriter("选择类别"); foreach (string item in list) { writer.Read(item); } return(writer.Write()); }
public void TestWrite() { CategoryIndexWriter writer = new CategoryIndexWriter("选择类别"); writer.Read("一级类别01\\二级类别01\\三级类别01"); writer.Read("一级类别01\\二级类别02\\三级类别02"); writer.Read("一级类别01\\二级类别03\\三级类别03"); writer.Read("一级类别02\\二级类别01\\三级类别01"); writer.Read("一级类别02\\二级类别02\\三级类别02"); writer.Read("一级类别02\\二级类别03\\三级类别03"); //writer.Read("11\\113\\123"); //writer.Read("11\\11\\11"); //writer.Read("11\\1223\\122"); //writer.Read("122\\12234"); writer.Read("22\\12\\2345"); ICategoryIndex index = writer.Write(); Assert.IsNotNull(index); }