3 Star 8 Fork 3

yasenagat / daminghu-cli

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
Apache-2.0

daminghu-cli(项目源码生成工具)

项目源码生成工具

生成前后分离的两个项目源码,一个**【服务端】项目,一个【web】**项目。

特点

  • 有源码 =! 项目可以运行起来!!!使用此工具生成的项目,可以运行,可以运行,可以运行

  • 急速生成

  • 不用写一行代码

  • 生成的两个项目源码,编译后都可以独立部署

  • 可以单独生成服务端项目

    • 对应web端的所有CRUD接口
  • 可以单独生成web项目

    • 登录
    • 左侧导航菜单
    • headr面包屑,退出
    • CRUD所有操作
    • 分页查询
    • 首页
    • 图表统计
    • token,登录超时

    在线查看-1

    在线查看-2

    在线查看-3

  • 一键启动查看效果( 点击查看效果 )

只有一个数据库,想查看此软件运行效果, 点击查看操作步骤

只有一个数据库,想直接生成项目源码, 点击查看操作步骤

无数据库,啥也没有就是任性,点击查看效果

大神,技术人员,请继续往下看~

准备工作

  • 安装 go (编译生成的sever项目源码)

    $ go version
    go version go1.9.2 darwin/amd64
  • 安装 npm (编译生成的web项目源码)

    $ npm -version 
    6.7.0
  • 安装 mysql 数据库(或者有一个本地可以访问的mysql数据库)

安装

项目安装提供两种方式,实用党可选择直接下载,理论党可以选择源码安装

  • 直接下载(已经编译好的可执行文件)
  • 源码安装
    # install
    go install gitee.com/godY/daminghu-cli

    最好把gopath下的bin目录加入到系统的path里

使用方法

  1. 新建一个文件夹或者目录(名称随意)

    $ mkdir dmhtest
    $ cd dmhtest
  2. 在刚才新建的目录下创建cfg.json文件

       $ touch cfg.json
       $ ls
         cfg.json
         daminghu-cli-mac
  3. 编辑cfg.json

    {
         "PrefixProjectUri": "gitee.com/godY",
         "ProjectName": "xxxx",
         "Port": "19527",
         "DistPath": "./dist/",
         "DBSchema": "mysql",
         "DBUsername": "root",
         "DBPassword": "root",
         "DBPort": "3306",
         "DBIp": "localhost",
         "DBConnParam": "?charset=utf8&parseTime=true&loc=Local&timeout=10s"
    }
    名称
    PrefixProjectUri go项目的包名
    ProjectName 项目名称
    Port 服务端项目端口号
    DistPath 项目生成目录
    DBSchema 数据库-名称
    DBUsername 数据库-用户名
    DBPassword 数据库-密码
    DBPort 数据库-端口号
    DBIp 数据库-ip地址
    DBConnParam 数据库-连接参数
  4. 运行命令,生成项目

    根据安装方式不同,分为两种情况

    下载-方式

    1. 把下载的文件,放到dmhtest文件夹中
    2. 运行命令
      1. windows -> 双击 daminghu-cli-win.exe
      2. mac -> ./daminghu-cli-mac
      3. linux -> ./daminghu-cli-linux

    源码安装-方式

    1. 如果gopath的bin在系统的path目录下,直接在dmhtest 目录下运行daminghu-cli命令
    2. 如果gopath的bin不在系统的path目录下,找到gopath/bin下面的daminghu-cli文件,放到dmhtest文件夹中,参考上面几行下载-方式,运行命令
  5. 执行结果

$ daminghu-cli
   2019/03/14 14:36:39 [D] MySqlConnStr  root:root@tcp(localhost:3306)/mysql?charset=utf8&parseTime=true&loc=Local&timeout=10s
   2019/03/14 14:36:39 [I] Start Before Handler..............
   2019/03/14 14:36:39 [I] Invoke Before Handler Complete!
   2019/03/14 14:36:39 [I] Start Build Svr Project..............
   2019/03/14 14:36:39 [D] CreateDirHandler
   2019/03/14 14:36:39 [D] DownloadTemplateHandler
   2019/03/14 14:36:40 [D] CreateBaseProjectHandler
   2019/03/14 14:36:40 [D] CreateRouterHandler
   2019/03/14 14:36:40 [D] CreateStructHandler
   2019/03/14 14:36:40 [D] CreateControllerHandler
   2019/03/14 14:36:40 [D] CreateSqlHandler
   2019/03/14 14:36:40 [D] CreateModelHandler
   2019/03/14 14:36:40 [I] Build Svr Project Complete!
   2019/03/14 14:36:40 [I] Start Build Web Project..............
   2019/03/14 14:36:40 [D] CreateDirHandler
   2019/03/14 14:36:40 [D] DownloadHandler
   2019/03/14 14:36:41 [D] DownloadTemplateHandler
   2019/03/14 14:36:41 [D] CreateApiHandler
   2019/03/14 14:36:41 [D] CreateEnvHandler
   2019/03/14 14:36:41 [D] CreateRouterHandler
   2019/03/14 14:36:41 [D] CreateMainHandler
   2019/03/14 14:36:41 [D] CreateHomeHandler
   2019/03/14 14:36:41 [D] CreatePageHandler
   2019/03/14 14:36:41 [I] Build Web Project Complete!
   2019/03/14 14:36:41 [I] Start After Handler..............
   2019/03/14 14:36:41 [D] DeleteTempHandler
   2019/03/14 14:36:41 [I] Invoke After Handler Complete!

生成的项目目录

$ tree -L 2
.
├── cfg.json
└── dist
    ├── xxxx-svr //server项目
    └── xxxx-web //web项目

3 directories, 1 file

运行项目

  • 服务端项目

copy项目到对应的gopath下

举例子

  1. gopath = /Users/nagatyase/goproject
  2. cfg.json中的PrefixProjectUri = gitee.com/godY
  3. 把生成的xxxx-svr项目copy到/Users/nagatyase/goproject/src/gitee.com/godY下
  4. 最终位置 /Users/nagatyase/goproject/src/gitee.com/godY/xxxx-svr
  5. 进入到xxxx-svr/cmd文件夹,运行下面命令
~/src/gitee.com/godY/xxxx-svr/cmd  $ go run main.go
2019/03/14 15:01:19 [D] [db.go:16] db init
[xorm] [info]  2019/03/14 15:01:19.256224 PING DATABASE mysql
2019/03/14 15:01:19 [I] [asm_amd64.s:2337] http rpcserver Running on http://:19527
  • web项目

进入到dist/xxxx-web目录内,运行如下命令

~/dist/xxxx-web  $ npm install && npm run dev

 DONE  Compiled successfully in 20585ms                                                                                                                           下午2:59:05

 I  Your application is running here: http://localhost:19527

自动打开浏览器,开始一波操作吧。

server目录

$ tree
.
├── api
│   ├── api_columns_priv.go
│   ├── api_db.go
│   ├── api_event.go
│   ├── api_func.go
│   ├── api_help_category.go
│   ├── api_help_keyword.go
│   ├── api_help_relation.go
│   ├── api_help_topic.go
│   ├── api_innodb_index_stats.go
│   ├── api_innodb_table_stats.go
│   ├── api_ndb_binlog_index.go
│   ├── api_plugin.go
│   ├── api_proc.go
│   ├── api_procs_priv.go
│   ├── api_proxies_priv.go
│   ├── api_servers.go
│   ├── api_slave_master_info.go
│   ├── api_slave_relay_log_info.go
│   ├── api_slave_worker_info.go
│   ├── api_tables_priv.go
│   ├── api_time_zone.go
│   ├── api_time_zone_leap_second.go
│   ├── api_time_zone_name.go
│   ├── api_time_zone_transition.go
│   ├── api_time_zone_transition_type.go
│   ├── api_user.go
│   ├── base.go
│   └── login.go
├── cmd
│   ├── conf
│   │   ├── app.conf
│   │   ├── db.conf
│   │   └── upload.conf
│   ├── logs
│   ├── main.go
│   └── sql
│       └── mysql
│           ├── columns_priv.base.xsql
│           ├── columns_priv.count.stpl
│           ├── columns_priv.read.stpl
│           ├── db.base.xsql
│           ├── db.count.stpl
│           ├── db.read.stpl
│           ├── event.base.xsql
│           ├── event.count.stpl
│           ├── event.read.stpl
│           ├── func.base.xsql
│           ├── func.count.stpl
│           ├── func.read.stpl
│           ├── help_category.base.xsql
│           ├── help_category.count.stpl
│           ├── help_category.read.stpl
│           ├── help_keyword.base.xsql
│           ├── help_keyword.count.stpl
│           ├── help_keyword.read.stpl
│           ├── help_relation.base.xsql
│           ├── help_relation.count.stpl
│           ├── help_relation.read.stpl
│           ├── help_topic.base.xsql
│           ├── help_topic.count.stpl
│           ├── help_topic.read.stpl
│           ├── innodb_index_stats.base.xsql
│           ├── innodb_index_stats.count.stpl
│           ├── innodb_index_stats.read.stpl
│           ├── innodb_table_stats.base.xsql
│           ├── innodb_table_stats.count.stpl
│           ├── innodb_table_stats.read.stpl
│           ├── ndb_binlog_index.base.xsql
│           ├── ndb_binlog_index.count.stpl
│           ├── ndb_binlog_index.read.stpl
│           ├── plugin.base.xsql
│           ├── plugin.count.stpl
│           ├── plugin.read.stpl
│           ├── proc.base.xsql
│           ├── proc.count.stpl
│           ├── proc.read.stpl
│           ├── procs_priv.base.xsql
│           ├── procs_priv.count.stpl
│           ├── procs_priv.read.stpl
│           ├── proxies_priv.base.xsql
│           ├── proxies_priv.count.stpl
│           ├── proxies_priv.read.stpl
│           ├── servers.base.xsql
│           ├── servers.count.stpl
│           ├── servers.read.stpl
│           ├── slave_master_info.base.xsql
│           ├── slave_master_info.count.stpl
│           ├── slave_master_info.read.stpl
│           ├── slave_relay_log_info.base.xsql
│           ├── slave_relay_log_info.count.stpl
│           ├── slave_relay_log_info.read.stpl
│           ├── slave_worker_info.base.xsql
│           ├── slave_worker_info.count.stpl
│           ├── slave_worker_info.read.stpl
│           ├── tables_priv.base.xsql
│           ├── tables_priv.count.stpl
│           ├── tables_priv.read.stpl
│           ├── time_zone.base.xsql
│           ├── time_zone.count.stpl
│           ├── time_zone.read.stpl
│           ├── time_zone_leap_second.base.xsql
│           ├── time_zone_leap_second.count.stpl
│           ├── time_zone_leap_second.read.stpl
│           ├── time_zone_name.base.xsql
│           ├── time_zone_name.count.stpl
│           ├── time_zone_name.read.stpl
│           ├── time_zone_transition.base.xsql
│           ├── time_zone_transition.count.stpl
│           ├── time_zone_transition.read.stpl
│           ├── time_zone_transition_type.base.xsql
│           ├── time_zone_transition_type.count.stpl
│           ├── time_zone_transition_type.read.stpl
│           ├── user.base.xsql
│           ├── user.count.stpl
│           └── user.read.stpl
├── common
│   └── common.go
├── db
│   ├── db.go
│   ├── db_columns_priv.go
│   ├── db_db.go
│   ├── db_event.go
│   ├── db_func.go
│   ├── db_help_category.go
│   ├── db_help_keyword.go
│   ├── db_help_relation.go
│   ├── db_help_topic.go
│   ├── db_innodb_index_stats.go
│   ├── db_innodb_table_stats.go
│   ├── db_ndb_binlog_index.go
│   ├── db_plugin.go
│   ├── db_proc.go
│   ├── db_procs_priv.go
│   ├── db_proxies_priv.go
│   ├── db_servers.go
│   ├── db_slave_master_info.go
│   ├── db_slave_relay_log_info.go
│   ├── db_slave_worker_info.go
│   ├── db_tables_priv.go
│   ├── db_time_zone.go
│   ├── db_time_zone_leap_second.go
│   ├── db_time_zone_name.go
│   ├── db_time_zone_transition.go
│   ├── db_time_zone_transition_type.go
│   └── db_user.go
├── filter
│   └── filter.go
├── model
│   ├── base.go
│   ├── model_columns_priv.go
│   ├── model_db.go
│   ├── model_event.go
│   ├── model_func.go
│   ├── model_help_category.go
│   ├── model_help_keyword.go
│   ├── model_help_relation.go
│   ├── model_help_topic.go
│   ├── model_innodb_index_stats.go
│   ├── model_innodb_table_stats.go
│   ├── model_ndb_binlog_index.go
│   ├── model_plugin.go
│   ├── model_proc.go
│   ├── model_procs_priv.go
│   ├── model_proxies_priv.go
│   ├── model_servers.go
│   ├── model_slave_master_info.go
│   ├── model_slave_relay_log_info.go
│   ├── model_slave_worker_info.go
│   ├── model_tables_priv.go
│   ├── model_time_zone.go
│   ├── model_time_zone_leap_second.go
│   ├── model_time_zone_name.go
│   ├── model_time_zone_transition.go
│   ├── model_time_zone_transition_type.go
│   └── model_user.go
├── msg
│   └── base.go
└── router
    └── router.go

12 directories, 168 files

web目录

$ tree
.
├── README.md
├── build
│   ├── build.js
│   ├── check-versions.js
│   ├── logo.png
│   ├── utils.js
│   ├── vue-loader.conf.js
│   ├── webpack.base.conf.js
│   ├── webpack.dev.conf.js
│   └── webpack.prod.conf.js
├── config
│   ├── dev.env.js
│   ├── index.js
│   ├── prod.env.js
│   └── test.env.js
├── index.html
├── package.json
├── src
│   ├── App.vue
│   ├── api
│   │   ├── api.js
│   │   ├── http.js
│   │   └── util.js
│   ├── assets
│   │   └── logo.png
│   ├── components
│   │   └── headTop.vue
│   ├── config
│   │   └── env.js
│   ├── main.js
│   ├── mixin
│   ├── pages
│   │   ├── columns_priv.vue
│   │   ├── db.vue
│   │   ├── event.vue
│   │   ├── func.vue
│   │   ├── help_category.vue
│   │   ├── help_keyword.vue
│   │   ├── help_relation.vue
│   │   ├── help_topic.vue
│   │   ├── home.vue
│   │   ├── innodb_index_stats.vue
│   │   ├── innodb_table_stats.vue
│   │   ├── login.vue
│   │   ├── main.vue
│   │   ├── ndb_binlog_index.vue
│   │   ├── plugin.vue
│   │   ├── proc.vue
│   │   ├── procs_priv.vue
│   │   ├── proxies_priv.vue
│   │   ├── servers.vue
│   │   ├── slave_master_info.vue
│   │   ├── slave_relay_log_info.vue
│   │   ├── slave_worker_info.vue
│   │   ├── tables_priv.vue
│   │   ├── time_zone.vue
│   │   ├── time_zone_leap_second.vue
│   │   ├── time_zone_name.vue
│   │   ├── time_zone_transition.vue
│   │   ├── time_zone_transition_type.vue
│   │   └── user.vue
│   ├── router
│   │   └── index.js
│   └── style
│       ├── common.less
│       └── mixin.less
├── static
│   └── img
└── test
    ├── e2e
    │   ├── custom-assertions
    │   │   └── elementCount.js
    │   ├── nightwatch.conf.js
    │   ├── runner.js
    │   └── specs
    │       └── test.js
    └── unit
        ├── jest.conf.js
        ├── setup.js
        └── specs
            └── HelloWorld.spec.js

19 directories, 62 files

命令参数

  • 生成两个项目 -> daminghu-cli -build all

  • 生成server项目 -> daminghu-cli -build svr

  • 生成web项目 -> daminghu-cli -build web

  • 指定配置文件位置-> daminghu-cli -cfg ./cfg.json

  • 生成编译好的项目(可直接运行),需要等待几分钟时间,不要关闭进程 -> daminghu-cli -mode demo

  • 生成编译好的项目(可直接运行),发送到邮箱-> daminghu-cli -mode demo -email yasenagat@163.com

Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [2019] [yasenagat] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

简介

beego 脚手架工具,项目源码生成工具,生成前后分离的两个项目源码,一个服务端(golang,beego)项目,一个web(vue 2.0,vue router,element ui)项目。 展开 收起
Go
Apache-2.0
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Go
1
https://gitee.com/godY/daminghu-cli.git
git@gitee.com:godY/daminghu-cli.git
godY
daminghu-cli
daminghu-cli
master

搜索帮助