1 Star 0 Fork 47

吕小乖 / TableGo

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

TableGo

介绍

  TableGo是基于数据库的代码自动生成工具,低代码编程技术的实现,可以零代码自动生成SpringBoot项目工程、生成JavaBean、生成前后端分离的CRUD代码、生成MyBaits的Mapper映射配置文件、生成数据库设计文档(Word、Excel)、生成Swagger2离线API文档、生成前后端代码、能查出数据库数据生成各种代码和文档等,更重要的是可以根据每个项目的不同开发框架编写自定义模板与项目框架适配生成各模块增删查改的前后端代码,让开发人员的开发效率提高60%以上,并且可以通过模板定义开发规范统一开发风格和标准,提高代码的规范性和可维护性。
  只要设计好数据库并且添加好备注,就能通过自定义模板生成任意编程语言的任何程序代码,并且能够生成各种代码备注。实现只要把数据数据库设计好,整个项目就完成了很大一部分代码的编写,大大节省了项目的开发成本。支持MySQL、Oracle、SQL Server、PostgreSQL、MariaDB、DB2 六种数据库,支持Window、Linux、Mac OS等多种操作系统。
  TableGo原生不支持的数据库可以通过配置自定义扩展数据库获得支持,可通过配置database.ini配置文件让TableGo支持更多关系型数据库,在新的database.ini配置文件已经包含对武汉达梦、人大金仓V8、神舟通用、南大通用等四种数据库的扩展支持配置。
  TableGo还可以通过服务器接连终端功能使用SSH2连接Linux服务器,实现命令执行、上传下载文件、按指定顺序自动执行各种命令和操作,实现一键自动化部署项目工程到DEV、TEST、SIT、UAT环境。
  使用自定义模板功能可以根据数据库表结构信息生成你想要的任何代码,例如:Java、C#、C++、Golang、Rust、Python、Objective-C、Swift、Kotlin、VB、VC、SQL、HTML、JSP、JS、PHP、Vue、React、Word、Excel等等,没有做不到只有想不到……
  可以生成Java、C#、C++、Golang、Rust、Python、Objective-C、Swift、iOS等各种不同平台编程语言的数据模型或结构体,对应的自定义模板示例已提供。

  TableGo官网:http://www.tablego.cn
  在CSDN博客可下载Jar包版本的TableGo,可在Linux和Mac OS上运行:https://blog.csdn.net/vipbooks

运行环境

  要想运行TableGo必须要安装JDK8及以上版本的Java环境,不再支持JDK7,并且要配置好JAVA_HOME或者JRE_HOME,如果是运行Jar包版本的还要把 %JAVA_HOME%\bin 也配置到path变量中去。
  在JDK9及以上版本环境中运行TableGo.jar必须要使用脚本运行,在程序压缩包中已提供了TableGo.bat和TableGo.sh的运行脚本,可根据系统环境自行选择运行的脚本。
  如果在Mac OS系统中用TableGo.sh脚本运行TableGo报第三方包的类找不到的话可以尝试运行TableGo-all.sh脚本,会动态加载所有的第三方Jar包,一般就能运行起来了,如果还报错可以尝试更新到最新版本的JDK8或JDK9及以上的版本。
  因为从JDK9开始不能再使用URLClassLoader动态加载Jar包了,所以数据库驱动无法远能动态加载,经过长时间研究发现可以使用Instrumentation.appendToSystemClassLoaderSearch方法来动态加载Jar包,并且测试没有问题,所以就写了一个tablego-agent.jar来动态加载数据库驱动包。
  tablego-agent.jar需要在TableGo.jar运行前使用Java Agent技术加载,相当于JVM级别的AOP,在TableGo.jar运行前先执行,动态加载完Jar包以后再运行TableGo.jar,所以现在运行TableGo.jar的命令就是这样的:java -jar -javaagent:./lib/tablego-agent.jar TableGo.jar
  JDK8的版本运行TableGo.jar无需使用Java Agent,可直接双击运行,在代码中做了处理,如果是JDK8的版本还是会使用URLClassLoader动态加载一次数据库驱动包。
  EXE版本的TableGo在进行EXE打包的时候就已经配置好了Java Agent,可直接运行。

MySQL关键字表名问题

MySQL关键字做表名导致生成代码或文档报错的解决方法,以order表名为例:

  1. 先在公共参数中配置精确匹配(包含)参数,把表名order填入进去,记得一定要加键盘左上角的“`”引号。
  2. 切换到生成工具中生成代码或文档,先把所有关键字表名的表单独生成完。
  3. 生成完成以后再到公共参数中把精确匹配(包含)参数中的内容清空。
  4. 在公共参数中配置精确匹配(排除)参数,把表名order填入进去,记得一定不能加“`”引号。
  5. 切换到生成工具中生成代码或文档,生成所有非关键字命名的表,到这里数据库中所有的表就都生成完了。

自定义模板的写法提示

  写自定义最简单的方法就是在你的项目代码里找出一套前后台增删查改的标准流程代码出来,把这套代码拷到IDE另一个专门用来写模板的项目中去,直接把文件的后缀都改成ftl,然后在这套标准流程代码上把动态的内容都改成变量,改完之后一套完全适配你项目的模板就做完了。
  我已经把SpringMVC、SpringBoot和一些页面的模板示例都写好了,你们可以参考我的模板示例再根据自己的项目框架编写完全适配你们项目的自定义模板就可以了。
  在贡献者群会提供我在一些真实项目中写的全套自定义模板代码,如果某个项目的自定义模板与你的项目框架一致,则只需要简单改改就能使用了。
  程序中的模板都是用FreeMarker写的,如果不会可以去官网点击下载,进到百度网盘里面有视频教程,很容易学会,学会FreeMarker再参考使用手册和模板示例就能写完全适配自己项目框架的代码模板了。

关于生成的Word和Excel打不开的问题

  如果生成的Word和Excel文件用MS Office打不开,可以用WPS打开再另存为一次就可以用MS Office打开了(MS Word的容错性不太好),如果没有装WPS也可以用写字板打开Word,然后另存为docx文件就可以了,推荐用WPS打开或转存,这样文件样式不会受到影响,ER图也会更清楚。Word文档是用docx4j生成的,不知道是基于哪个版本的Word开发出来的,所以多少会有点兼容性问题。

关于升级新版本TableGo的问题

  一般情况下用新版本直接覆盖老版本是没有问题的,但有时候配置信息改动比较大就会有问题,所以在更新新版本的时候最好先把老版本拷贝到另一个地方临时备份一下,然后再把新版本拷贝进来,dbConfig.xml和paramConfig.xml两个配置文件可以复用,把老的database.ini和paramConfig.ini配置文件删除,再打开新版本的TableGo自动生成database.ini和paramConfig.ini这两个配置文件,因为有的版本配置信息改动比较大,用老版本的配置会有问题。如果老版本有配置如果拷到新版本中来,这时可以同时打开新老版本,在界面上把老版本的配置信息拷贝到新版本的界面上来,完成后再点右上角的关闭按钮正常关闭就会自动保存了界面上的配置信息了。

TableGo功能一览

参与贡献

  1. Fork 本仓库
  2. 新建 Feat_xxx 分支
  3. 提交代码
  4. 新建 Pull Request

码云特技

  1. 使用 Readme_XXX.md 来支持不同的语言,例如 Readme_en.md, Readme_zh.md
  2. 码云官方博客 blog.gitee.com
  3. 你可以 https://gitee.com/explore 这个地址来了解码云上的优秀开源项目
  4. GVP 全称是码云最有价值开源项目,是码云综合评定出的优秀开源项目
  5. 码云官方提供的使用手册 https://gitee.com/help
  6. 码云封面人物是一档用来展示码云会员风采的栏目 https://gitee.com/gitee-stars/
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 [yyyy] [name of copyright owner] 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.

简介

TableGo是基于数据库的代码自动生成工具,低代码编程技术的实现,可以零代码自动生成SpringBoot项目工程、生成JavaBean、生成MyBaits的Mapper映射配置文件、生成数据库设计文档(Word、Excel)、生成Swagger2离线API文档、生成前后端代码、能查出数据库数据生成各种代码和文档等,更重要的是可以根据每个项目的不同开发框架编写自定义模板与项目框架适配生成各模块增删查改的前后端代码,让开发人员的开发效率提高60%以上,并且可以通过模板定义开发规范统一开发风格和标准,提高代码的规范性和可维护性。 展开 收起
Java
Apache-2.0
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Java
1
https://gitee.com/lvxiaoguai/TableGo.git
git@gitee.com:lvxiaoguai/TableGo.git
lvxiaoguai
TableGo
TableGo
master

搜索帮助