[Open Source] A code generation tool that supports custom templates for generating different types of code and works with mainstream databases.
![[Open Source] A code generation tool that supports custom templates for generating different types of code and works with mainstream databases.](https://yy123.ink/api/img/1782589396820-mph7jx.jpg)
1. Project OverviewA code generation tool that supports custom templates for generating different types of code. Supports MySQL, Oracle, SQL Server, and PostgreSQL.
2. Open Source License
Licensed under MIT
3. Screenshots
Effect picture


4. Feature Overview
- Requires only a Java 8 environment. Download and run it directly.
- Simple steps: configure a data source, select a template, and generate code.
- Comes with general-purpose entity class, MyBatis interface, and MyBatis configuration file templates, enabling rapid development of MyBatis applications.
5. Tech Stack
Technologies used: SpringBoot + Mybatis + Vue
Usage Instructions
- Go to the Releases page and download the latest ZIP file.
- Extract the ZIP file. If you are using macOS/Linux, runstartup.shthe file to start the application. On Windows, open CMD and enterjava -jar gen.jarStart
- Open the following URL in your browser:http://localhost:6969/
The default port is 6969. To change the port, follow these instructions:
- macOS/Linux: Open thestartup.shfile and modify the--server.portparameter value.
- Windows: Run the following command:java -jar gen.jar --server.port=PORT
Running with Docker
- Method 1: Pull the public image
docker pull tanghc2020/gen:latest
After downloading, execute:docker run --name gen -p 6969:6969 -d <IMAGE_ID>
Open the following URL in your browser:http://ip:6969/
For subsequent updates, simply replace the JAR file and the view folder.
- Method 2: Build the image locally
Clone the code, then execute:docker-build.shScript
Executedocker run --name gen -p 6969:6969 -d <IMAGE_ID>
Other Information
For detailed information, please refer to the README.md document.
- Quickly build SpringBoot + Mybatis applications
- More Templates
- How the Code Generator Works
Project Structure
- front: Front-end Vue application
- gen: Back-end service
- db: Database initialization files
- script: Utility scripts
Local development
- RungenUndercom.gitee.gen.GenApplication(SpringBoot project)
- RunfrontThe front-end project under this directory. See: readme
Contributing
Contributions are welcome to improve the functionality. Please submit PRs to theprbranch
Build Locally
Maven 3 and Java 8 must be installed.
- Automatic Build [Recommended]:
On Mac/Linux, simply executebuild.shto build. The build output is located in thedist/genfolder.
- Manual Build:
Prerequisites: Install Node.js, Java 8, and Maven 3.
- cd front
- Executenpm install --registry=https://registry.npm.taobao.org
- Executenpm run build:prod
- cd ..
- Executemvn clean package, undergen/targetagen-1.0.0-SNAPSHOT.jarwill be generated (xx represents the version number).
- Placegen-1.0.0-SNAPSHOT.jarunderdist/genand ensure that the JAR andvieware in the same directory.
- Executejava -jar gen-xx-SNAPSHOT.jar
- Open the following URL in your browser:http://localhost:6969/
Multi-Platform Builds
- Install multi-platform buildx: docker buildx create --use --name m1_builder
- View and start the builder instance:docker buildx inspect --bootstrap
- Build multi-platform images and push them in a single operation.
- Build and push multi-platform images:docker buildx build -t tanghc2020/gen --platform=linux/amd64,linux/arm64/v8 . --push
- Or build and save them locally.
- Build an x64 platform image locally:docker buildx build -t tanghc2020/gen --platform=linux/amd64 -o type=docker .
- Build an arm64 platform image locally:docker buildx build -t tanghc2020/gen --platform=linux/arm64/v8 -o type=docker .
- Quick Start:docker run -d -p 6969:6969 tanghc2020/gen