public async Task <MessageModel> OutTemplateCodeAsync(CodeView codeView)
        {
            try
            {
                var menus = await menuServices.Query(p => p.url.ToLower() == codeView.url || p.title == codeView.title);

                if (!menus.Any())
                {
                    var result = await menuServices.Add(new Menu()
                    {
                        menuid   = codeView.menuId == 0 ? 999 : codeView.menuId,
                        title    = codeView.title,
                        explain  = codeView.description,
                        icon     = codeView.icon,
                        menutype = menuType.Menu,
                        method   = "#",
                        state    = 200,
                        no       = codeView.sort,
                        url      = codeView.url
                    });

                    var menu = (await menuServices.Query(p => p.url.ToLower() == codeView.url.ToLower() && p.title == codeView.title)).FirstOrDefault();
                    if (menu != null)
                    {
                        unitOfWork.BeginTran();
                        var ListMenu = new List <Menu>();
                        for (int i = 0; i < 4; i++)
                        {
                            var menutitle  = string.Empty;
                            var menumethod = string.Empty;
                            if (i == 0)
                            {
                                menumethod = "get";
                                menutitle  = $"{ codeView.title}-查询";
                            }
                            else if (i == 1)
                            {
                                menumethod = "put";
                                menutitle  = $"{ codeView.title}-修改";
                            }
                            else if (i == 2)
                            {
                                menumethod = "post";
                                menutitle  = $"{ codeView.title}-添加";
                            }
                            else if (i == 3)
                            {
                                menumethod = "delete";
                                menutitle  = $"{ codeView.title}-删除";
                            }
                            ListMenu.Add(new Menu()
                            {
                                menuid   = menu.Id,
                                title    = menutitle,
                                explain  = "",
                                icon     = codeView.icon,
                                menutype = menuType.Button,
                                method   = menumethod,
                                state    = 200,
                                no       = codeView.sort,
                                url      = $"/api/{codeView.model.modelName}"
                            });
                        }
                        await menuServices.Add(ListMenu);

                        unitOfWork.CommitTran();
                        await codeContext.OutTemplateCode(codeView);

                        return(new MessageModel());
                    }
                    else
                    {
                        return(new MessageModel(false, "失败"));
                    }
                }
                return(new MessageModel(false, "已存在"));
            }
            catch (Exception ex)
            {
                unitOfWork.RollbackTran();
                return(new MessageModel(false, ex.Message));
            }
        }