/// <summary>
        ///
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        public async Task <dynamic> AddRoutePage(DTOAPI_RoutePages item)
        {
            Int64           result = 0;
            Int64           NewID;
            DTOIn_PageRoute obj = this.mapper.Map <DTOIn_PageRoute>(item);

            if (item.parentId != null)
            {
                var parentPageRoutes = this.accesser.Get(item.parentId.Value);

                if (parentPageRoutes == null)
                {
                    //父类不存在
                    return(-1);
                }

                NewID             = this.IDGenerator.GetNewID <RoutePages>();
                obj.Id            = NewID;
                obj.HierarchyPath = TreeHelper.GenerateHierarchyPath(parentPageRoutes.HierarchyPath, NewID);
            }
            else
            {
                NewID             = this.IDGenerator.GetNewID <RoutePages>();
                obj.Id            = NewID;
                obj.HierarchyPath = TreeHelper.GenerateHierarchyPath("", NewID);
            }

            await this.publishEndpoint.Publish(new AddPageRouteCommand
            {
                data = obj
            });

            result = NewID;
            return(result);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="routepage"></param>
        /// <returns></returns>
        public async Task <dynamic> UpdateRoutePage(DTOAPI_RoutePages routepage)
        {
            var cmd = new UpdatePageRouteCommand
            {
                data = this.mapper.Map <DTOIn_PageRoute>(routepage)
            };

            await this.publishEndpoint.Publish(cmd);

            return(1);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="routepage"></param>
        /// <returns></returns>
        public async Task <dynamic> AddRoutePages(DTOAPI_RoutePages item)
        {
            IList <DTOIn_PageRoute> list = new List <DTOIn_PageRoute>();

            Int64 result = 0;

            TreeItem <long> data = new TreeItem <long>();

            item.Foreach(x => x.children, (parent, x) =>
            {
                long NewID = this.IDGenerator.GetNewID <RoutePages>();

                DTOIn_PageRoute obj = this.mapper.Map <DTOIn_PageRoute>(x);

                if (parent == null)
                {
                    if (item == x)
                    {
                        result = NewID;
                        // 确保 根节点 HierarchyPath 的正确性
                        if (item.parentId != null)
                        {
                            RoutePages routepage = this.accesser.Get(item.parentId.Value);
                            if (routepage != null)
                            {
                                item.hierarchyPath = TreeHelper.GenerateHierarchyPath(routepage.HierarchyPath, NewID);

                                obj.HierarchyPath = item.hierarchyPath;
                            }
                        }
                    }

                    if (item == x)
                    {
                        result = NewID;
                    }
                }
                else
                {
                    obj.HierarchyPath = TreeHelper.GenerateHierarchyPath(parent.hierarchyPath, NewID);
                }

                list.Add(obj);
            });
            await this.publishEndpoint.Publish(new AddPageRoutesCommand
            {
                routes = list
            });

            return(result);
        }