timor

SpringBoot快速开发脚手架

Usage no npm install needed!

<script type="module">
  import timor from 'https://cdn.skypack.dev/timor';
</script>

README

Timor

What's timor

SpringBoot快速开发脚手架

  • 支持基于Mybatis的Entity、Mapper、Service、Controller的代码生成
  • 支持包含createAtcreatedByupdateAtupdateBy等通用字段的处理
  • 支持数据软删除
  • 支持自动生成建表语句
  • 支持Swagger自动生成接口文档 http://localhost:8080/swagger-ui.html

Quick Start

Install

$ npm install --global timor

Run command with timor(or tm)

tm --init

➜  Desktop mkdir timor
➜  Desktop cd timor
➜  timor tm --init
? 请输入author puke
? 请输入项目名称 timor-demo
? 请输入groupId io.github.timor
? 请输入basePackage io.github.timor
? 请输入artifactId timor-demo
   create .gitignore
   create .timor/dna.timor
   create HELP.md
   create mvnw
   create mvnw.cmd
   create pom.xml
   create src/main/java/io/github/timor/Application.java
   create src/main/java/io/github/timor/aop/MybatisMapperAop.java
   create src/main/java/io/github/timor/base/BaseEntity.java
   create src/main/java/io/github/timor/base/CrossFilter.java
   create src/main/java/io/github/timor/base/CurrentServiceImpl.java
   create src/main/java/io/github/timor/base/ICurrentService.java
   create src/main/java/io/github/timor/base/R.java
   create src/main/java/io/github/timor/base/Result.java
   create src/main/java/io/github/timor/base/ResultAdapter.java
   create src/main/java/io/github/timor/base/SpringBeanFactory.java
   create src/main/java/io/github/timor/config/MybatisConfiguration.java
   create src/main/java/io/github/timor/config/SecurityConfiguration.java
   create src/main/java/io/github/timor/config/SpringJPAConfiguration.java
   create src/main/java/io/github/timor/config/SwaggerConfiguration.java
   create src/main/java/io/github/timor/exception/ControllerExceptionHandler.java
   create src/main/java/io/github/timor/exception/ServerException.java
   create src/main/java/io/github/timor/query/PageQuery.java
   create src/main/resources/application.yml
   create src/test/java/io/github/timor/AtmDemoApplicationTests.java

tm --dna

➜  timor tm --dna
? 请选择要执行的操作 同步DNA到数据库
? 请输入数据库连接host localhost
? 请输入数据库用户名 root
? 请输入数据库密码 [hidden]
? 请输入数据库名称 atm_demo
测试连接成功
? 是否强制同步 No

CREATE TABLE IF NOT EXISTS `content` (
    `id` BIGINT(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID主键',
    `created_at` DATETIME DEFAULT NULL COMMENT '创建时间',
    `created_by` VARCHAR(50) DEFAULT NULL COMMENT '创建者',
    `updated_at` DATETIME DEFAULT NULL COMMENT '创建时间',
    `updated_by` VARCHAR(50) DEFAULT NULL COMMENT '修改者',
    `deleted_at` DATETIME DEFAULT NULL COMMENT '删除时间',
    `deleted_by` VARCHAR(50) DEFAULT NULL COMMENT '删除者',
    `deleted` INT(1) DEFAULT NULL COMMENT '是否删除',
    `text` VARCHAR(255) DEFAULT NULL COMMENT '文本内容',
    `address` VARCHAR(255) DEFAULT NULL COMMENT 'address',
    `description` VARCHAR(1024) DEFAULT '0' COMMENT 'description',
    `like_count` BIGINT(20) DEFAULT NULL COMMENT 'likeCount',
    PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='内容';

CREATE TABLE IF NOT EXISTS `comment` (
    `id` BIGINT(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID主键',
    `created_at` DATETIME DEFAULT NULL COMMENT '创建时间',
    `created_by` VARCHAR(50) DEFAULT NULL COMMENT '创建者',
    `updated_at` DATETIME DEFAULT NULL COMMENT '创建时间',
    `updated_by` VARCHAR(50) DEFAULT NULL COMMENT '修改者',
    `deleted_at` DATETIME DEFAULT NULL COMMENT '删除时间',
    `deleted_by` VARCHAR(50) DEFAULT NULL COMMENT '删除者',
    `deleted` INT(1) DEFAULT NULL COMMENT '是否删除',
    `text` VARCHAR(255) DEFAULT NULL COMMENT 'text',
    `address` VARCHAR(255) DEFAULT NULL COMMENT '描述',
    `description` VARCHAR(1024) DEFAULT NULL COMMENT '描述',
    `like_count` BIGINT(20) DEFAULT NULL COMMENT 'likeCount',
    PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='评论';

CREATE TABLE IF NOT EXISTS `user` (
    `id` BIGINT(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID主键',
    `created_at` DATETIME DEFAULT NULL COMMENT '创建时间',
    `created_by` VARCHAR(50) DEFAULT NULL COMMENT '创建者',
    `updated_at` DATETIME DEFAULT NULL COMMENT '创建时间',
    `updated_by` VARCHAR(50) DEFAULT NULL COMMENT '修改者',
    `deleted_at` DATETIME DEFAULT NULL COMMENT '删除时间',
    `deleted_by` VARCHAR(50) DEFAULT NULL COMMENT '删除者',
    `deleted` INT(1) DEFAULT NULL COMMENT '是否删除',
    `text` VARCHAR(255) DEFAULT NULL COMMENT 'text',
    `address` VARCHAR(255) DEFAULT NULL COMMENT 'address',
    `description` VARCHAR(1024) DEFAULT NULL COMMENT 'description',
    `like_count` BIGINT(20) DEFAULT NULL COMMENT 'likeCount',
    PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='用户';

同步数据库完成
➜  timor tm --dna
? 请选择要执行的操作 同步DNA到项目
? 请输入接口前缀 api
   create src/main/java/io/github/timor/entity/ContentEntity.java
   create src/main/java/io/github/timor/mapper/ContentMapper.java
   create src/main/java/io/github/timor/service/ContentService.java
   create src/main/java/io/github/timor/service/impl/ContentServiceImpl.java
   create src/main/java/io/github/timor/controller/ContentController.java
   create src/main/java/io/github/timor/entity/CommentEntity.java
   create src/main/java/io/github/timor/mapper/CommentMapper.java
   create src/main/java/io/github/timor/service/CommentService.java
   create src/main/java/io/github/timor/service/impl/CommentServiceImpl.java
   create src/main/java/io/github/timor/controller/CommentController.java
   create src/main/java/io/github/timor/entity/UserEntity.java
   create src/main/java/io/github/timor/mapper/UserMapper.java
   create src/main/java/io/github/timor/service/UserService.java
   create src/main/java/io/github/timor/service/impl/UserServiceImpl.java
   create src/main/java/io/github/timor/controller/UserController.java