Sloth is A tool to generate scaffold code from SQL databases.You just need to specify your application database may be used. It allows for rapidly getting started on new projects. If you know what the code generator does in Ruby on Rails (RoR), Sloth works just like that, and itβs specific to JAVA language now. Sloth is always the right choice for your scaffolding needs.Sloth can help developers quickly build beautiful web applications. Read this in other languages: δΈζ
- Generate Stand-Alone SpringBoot Applications
- Rapidly create a new project executable
- Generate ModelβViewβController Code
- Generate API DOC
- Provide Many Kinds Of Data Access With JDBCγ
- Reduce repetitive coding
- Never copy and paste boilerplate between projects again
- Generate your code in less time with fewer bugs
- OTHERS
- Target project generated integrate SpringbootγGuavaγHikariCPγApache Commonsγfastjsonγswagger2γFlywaydb
Before useing Sloth, you will need the following:
- JDKγ(Java Development Kit), version 1.7 and above
- Maven (Project Management Tool), version 3.0 and above
- GIT
-
Step 1: Prepare Your Database And Create Your Database Structure
| host | port | username | password | dbname | |-----------|------|----------|----------|--------| | 127.0.0.1 | 3306 | root | 123456 | test |
-
Step 2: Clone Sloth
git clone https://github.com/coolcooldee/sloth.git
- Step 3: Into The Sloth Root Directory
cd sloth
- Step 4: Maven Install
mvn clean install
- Step 5: Sloth Generating
mvn exec:java -Dexec.args="-path/workspaces/mySlothProject -packagecom.test -h127.0.0.1 -P3306 -uroot -p123456 -dtest -strategyssm" -Dexec.cleanupDaemonThreads=false -Dexec.mainClass="com.github.coolcooldee.sloth.Application"
generate args| e.g | description
:------------| --------------------------| ----
-path |/workspaces/mySlothProject | the path where code generate
-projectname | mySlothProject | the target project name
-package | com.test | tell sloth to use the package name
-help | --------------------------| to see which options are available
-strategy | ssm | generattion strategy:<br/>ssd=SpringBoot SpringData<br/>ssm=SpringMVC Spring MyBatis<br/>sss=SpringBoot SpringJDBC<br/>ssj=SpringBoot JOOQ
-h | 127.0.0.1 | database host
-P | 3306 | database port
-u | root | database username
-p | 123456 | database password
-d | test | database name
- Step 6: Into Sloth Target Project Generated
cd /workspaces/mySlothProject
- Step 7: Runngin Sloth Target Project
mvn clean install
mvn exec:java -Dexec.mainClass=βcom.test.Applicationβ -Dexec.cleanupDaemonThreads=false
- Step 8: Open a new tab in your web browser on http://localhost:8081/apis-docs-by-sloth.html
-
Database Tables Source
TableName | --------- | game | gameRole | gameServer |
-
Target Project Code
βββ deploy.sh
βββ mvn.sh
βββ pom.xml
βββ src
β βββ main
β β βββ assembly
β β β βββ assembly.xml
β β βββ java
β β β βββ com
β β β β βββ sloth
β β β β β βββ aop
β β β β β β βββ LogAspect.java
β β β β β βββ Application.java
β β β β β βββ common
β β β β β β βββ Page.java
β β β β β βββ config
β β β β β β βββ database
β β β β β β β βββ DB.java
β β β β β β β βββ DBConfig.java
β β β β β β βββ redis
β β β β β β β βββ RedisConfig.java
β β β β β βββ controller
β β β β β β βββ restfulapi
β β β β β β β βββ GameController.java
β β β β β β β βββ GameRoleController.java
β β β β β β β βββ GameServerController.java
β β β β β βββ mapper
β β β β β β βββ GameMapper.java
β β β β β β βββ GameRoleMapper.java
β β β β β β βββ GameServerMapper.java
β β β β β βββ model
β β β β β β βββ Game.java
β β β β β β βββ GameRole.java
β β β β β β βββ GameServer.java
β β β β β βββ service
β β β β β β βββ GameRoleService.java
β β β β β β βββ GameServerService.java
β β β β β β βββ GameService.java
β β β β β β βββ impl
β β β β β β β βββ GameRoleServiceImpl.java
β β β β β β β βββ GameServerServiceImpl.java
β β β β β β β βββ GameServiceImpl.java
β β βββ resources
β β β βββ application.properties
β β β βββ static
β β β β βββ apis-docs-by-sloth.html
β β β β βββ css
β β β β βββ fonts
β β β β βββ html
β β β β βββ js
β β β βββ template
βββ start.sh
βββ stop.sh
- Target Project Api Webpage
If you want to contribute code, we are waiting for your pull requests !
- Dee Qiu [email protected]
- QQ Group 570997546
Sloth is licensed under the Apache License, Version 2.0 (the "License");