/java-code-generator

Sloth 是一个生成脚手架代码的工具。你只需要设置好业务应用所需要用的 Mysql 数据源即可。如果你用过 Ruby on Rails 的代码生成器的话,那么 Sloth 也同样适用于这样的场景, 它使用 Java 语言构建,生成的脚手架代码亦是 Java。旨在为开发者提供一系列健壮的工具、程序库和工作流,帮助他们快速构建出漂亮、引人注目的SpringBoot Web应用

Primary LanguageJavaApache License 2.0Apache-2.0

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/dee1024/code-generator.git
  • Step 3: Into The Sloth Root Directory
cd code-generator
  • 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.dee1024.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:ssd=SpringBoot + SpringData,ssm=SpringMVC + Spring+MyBatis,sss=SpringBoot + SpringJDBC,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");