/// <summary> /// 根据父级类别ID获取所哟类别 /// </summary> /// <param name="supclassid"></param> /// <returns></returns> public List <Mproductclass> GetProductclassesBySupclassid(int supclassid) { try { List <Mproductclass> modelList = new ProductclassService().GetMproductclasses(supclassid); if (modelList != null && modelList.Exists(p => p.supclassid != 0)) { //// 数据产品分类按照上下关系排列 List <Mproductclass> supList = modelList.FindAll(p => p.supclassid == 0); if (supList != null) { List <Mproductclass> result = new List <Mproductclass>(); foreach (var item in supList) { result.Add(item); if (modelList.Exists(p => p.supclassid == item.classid)) { result.AddRange(modelList.FindAll(p => p.supclassid == item.classid)); } } return(result); } } return(modelList); } catch (Exception ex) { return(null); } }
/// <summary> /// 根据父级类别ID获取所哟类别 /// </summary> /// <param name="supclassid"></param> /// <returns></returns> public List <Mproductclass> GetAllSupProductclassList(int supId = 0) { try { List <Mproductclass> modelList = new ProductclassService().GetMproductclasses(supId); return(modelList); } catch (Exception ex) { return(null); } }