/sloth

🐨 sloth is a code generator tool and web's scaffolding tool for modern webapps ( likes Ruby on Rails ) 。

Primary LanguageJava

SLOTH 1.0

Chrome Web Store version issues Licence

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: δΈ­ζ–‡

Features

Prerequisites

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

Quick Start

  • 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

Example

  • 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

Contributing

If you want to contribute code, we are waiting for your pull requests !

Author

Others

  • QQ Group 570997546

License

Sloth is licensed under the Apache License, Version 2.0 (the "License");