/// <summary> /// 根据终端租户编号获取车辆组 /// </summary> /// <param name="tenantCode"></param> /// <returns></returns> public List<ChangeCusWithOMViewModel> GetVehicleGroupOfEndCus(string tenantCode) { IList<EMVehicleGroup> ltVehGroups = new EMVehicleGroupService().SelectAll(tenantCode); if (ltVehGroups.IsNullOrEmpty() || ltVehGroups.Count < 2) return null; List<ChangeCusWithOMViewModel> res = new List<ChangeCusWithOMViewModel>(); //处理终端用户的车辆组树形结构 var endCusRootVehGroups = ltVehGroups.Where(p => p.ParentGroupID.HasValue == false); if (endCusRootVehGroups.Count() > 0) { foreach (var item in endCusRootVehGroups) { res.Add(new ChangeCusWithOMViewModel { IsVehGroup = true, IsLastCreated = false, IsOM = false, TenantCode = tenantCode, GroupID = item.GroupID.ToString(), TenantName = item.GroupName, OperatorLevel = null, Children = GetVehGroupTree(item.TenantCode, item.GroupID, ltVehGroups), VehicleCount = 0, VehicleOnlineNum = 0, iconSkin = "gIcon" }); } } return res; }