1 Star 0 Fork 713

welfsen / spring-boot-plus

forked from geekidea / spring-boot-plus 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

spring-boot-plus logo

Everyone can develop projects independently, quickly and efficiently!

spring-boot-plus version spring boot version spring boot version code style

spring-boot-plus是一套集成spring boot常用开发组件的后台快速开发框架

Spring-Boot-Plus是易于使用,快速,高效,功能丰富,开源的spring boot 脚手架.

目标

每个人都可以独立、快速、高效地开发项目!

开源协议 MIT-License

任何个人或公司,均可基于此框架进行二次开发后,进行商业使用,无需授权!

GITHUB | GITEE

springboot.plus

主要特性

  • 集成spring boot 常用开发组件集、公共配置、AOP日志等
  • Maven单模块架构,更快更简单
  • 集成mybatis plus快速dao操作
  • 快速生成后台代码: entity/dto/query/vo/controller/service/mapper/xml
  • 集成Swagger/Knife4j,可自动生成api文档
  • 集成Redis缓存
  • 集成HikariCP连接池,JDBC性能和慢查询检测

源代码目录结构

spring-boot-plus
├── main
│ ├── java
│ │ └── io
│ │   └── geekidea
│ │     └── boot
│ │       └── auth
│ │       └── config
│ │       └── foobar
│ │       └── framework
│ │       └── system
│ │       └── SpringBootPlusApplication.java
│ └── resources
│     ├── application-dev.yml
│     ├── application-prod.yml
│     ├── application-test.yml
│     ├── application.yml
│     ├── banner.txt
│     ├── mapper
│     └── static
└── test
    ├── java
    │ └── io
    └── resources
        └── templates

项目环境

名称 版本 备注
JDK 1.8+ JDK1.8及以上
MySQL 5.7+ 5.7及以上
Redis 3.2+

技术选型

技术 版本 备注
spring boot 2.7.12
mybatis-plus 3.5.3.1 mybatis增强框架
fastjson2 2.0.33 JSON处理工具集
Swagger V3 Swagger文档
knife4j 4.1.0 api文档生成工具
commons-lang3 3.12.0 常用工具包
commons-io 2.11.0 IO工具包
commons-codec 1.15 加密解密等工具包
commons-collections4 4.4.4 集合工具包
hibernate-validator 6.2.5.Final 后台参数校验注解
hutool-all 5.8.16 常用工具集
lombok 1.18.26 注解生成Java Bean等工具

项目链路图

项目调用链路图

CHANGELOG

快速开始

克隆 spring-boot-plus

git clone https://gitee.com/geekidea/spring-boot-plus.git
cd spring-boot-plus

Maven 构建

默认使用dev环境,对应配置文件:application-dev.yml

mvn clean package -Pdev

5分钟完成增删改查

1. 创建数据库表

-- ----------------------------
-- Table structure for foo_bar
-- ----------------------------
DROP TABLE IF EXISTS `foo_bar`;
create table foo_bar
(
    id          bigint                               not null comment '主键'
        primary key,
    name        varchar(20)                          not null comment '名称',
    foo         varchar(100)                         null comment 'Foo',
    bar         varchar(100)                         null comment 'Bar',
    remark      varchar(200)                         null comment '备注',
    status      tinyint(1) default 1                 not null comment '状态,0:禁用,1:启用',
    create_time timestamp  default CURRENT_TIMESTAMP null comment '创建时间',
    update_time timestamp                            null comment '修改时间'
)
    comment 'FooBar';

-- ----------------------------
-- Records of foo_bar
-- ----------------------------
INSERT INTO foo_bar (id, name, foo, bar, remark, status, create_time, update_time) VALUES (1, 'FooBar', 'Foo', 'Bar', null, 1, '2023-07-01 21:01:10', null);

2.使用代码生成器生成增删改查代码

代码生成入口类,在generator模块中

src/test/java/io/geekidea/boot/generator/Generator.java
/**
 * Spring Boot Plus 代码生成器
 *
 * @author geekidea
 * @date 2022/3/16
 **/
public class Generator {

    public static void main(String[] args) throws Exception {
        GeneratorConfig config = new GeneratorConfig();
        // 项目信息配置
        config.setParentPackage("io.geekidea.boot" )
                .setModuleName("foobar" )
                .setAuthor("geekidea" );
        // 表名称和需要去掉的表前缀
        config.setTableNames("foo_bar" )
                .setTablePrefix("");
        // 是否覆盖已有文件
        config.setFileOverride(true);
        // 是否只更新实体类
        config.setOnlyOverrideEntity(false);
        GenerateHandler handler = new GenerateHandler();
        handler.generator(config);
    }
}

生成的代码结构

├── controller
│ └── FooBarController.java
├── dto
│ ├── FooBarAddDto.java
│ └── FooBarUpdateDto.java
├── entity
│ └── FooBar.java
├── mapper
│ └── FooBarMapper.java
├── query
│ └── FooBarQuery.java
├── service
│ ├── FooBarService.java
│ └── impl
│     └── FooBarServiceImp.java
└── vo
    ├── FooBarInfoVo.java
    └── FooBarVo.java

resources
└── mapper
    └── foobar
        └── FooBarMapper.xml    
    

代码生成模版

使用Velocity模版生成代码,可自定义修改代码生成模版

src/test/resources
└── templates
    ├── addDto.java.vm          添加DTO代码生成模版
    ├── controller.java.vm      控制器代码生成模版
    ├── entity.java.vm          实体类代码生成模版
    ├── infoVo.java.vm          详情VO代码生成模版
    ├── mapper.java.vm          Mapper代码生成模版
    ├── mapper.xml.vm           Mapper xml 代码生成模版
    ├── query.java.vm           分页参数代码生成模版
    ├── service.java.vm         服务接口代码生成模版
    ├── serviceImpl.java.vm     服务实现代码生成模版
    ├── updateDto.java.vm       修改DTO代码生成模版
    └── vo.java.vm              列表VO代码生成模版

3. 启动项目

项目入口类: SpringBootPlusApplication http://localhost:8888

src/main/java/io/geekidea/boot/SpringBootPlusApplication.java
/**
 * 启动类
 *
 * @author geekidea
 * @date 2022-3-16
 */
@EnableAsync
@SpringBootApplication
public class SpringBootPlusApplication {

    private static final String BACKSLASH = "/";

    public static void main(String[] args) throws Exception {
        ConfigurableApplicationContext context = SpringApplication.run(SpringBootPlusApplication.class, args);
        // 打印项目信息
        printlnProjectInfo(context);
        System.out.println("  _____ _______       _____ _______    _____ _    _  _____ _____ ______  _____ _____ \n" +
                " / ____|__   __|/\\   |  __ \\__   __|  / ____| |  | |/ ____/ ____|  ____|/ ____/ ____|\n" +
                "| (___    | |  /  \\  | |__) | | |    | (___ | |  | | |   | |    | |__  | (___| (___  \n" +
                " \\___ \\   | | / /\\ \\ |  _  /  | |     \\___ \\| |  | | |   | |    |  __|  \\___ \\\\___ \\ \n" +
                " ____) |  | |/ ____ \\| | \\ \\  | |     ____) | |__| | |___| |____| |____ ____) |___) |\n" +
                "|_____/   |_/_/    \\_\\_|  \\_\\ |_|    |_____/ \\____/ \\_____\\_____|______|_____/_____/ \n");
    }
}

4. 访问项目Swagger文档

http://localhost:8888/swagger-ui/index.html swagger-ui.png

5. 访问Knife4j文档

http://localhost:8888/doc.html knife4j.png

spring-boot-plus-vue 前端项目

GITHUB-REPO

系统用户列表

系统用户列表

系统角色列表

系统角色列表

系统菜单列表

系统菜单列表

系统部门列表

系统部门列表

系统日志

系统日志列表 系统日志详情

个人中心

个人中心

spring-boot-plus 视频 :movie_camera:

联系

QQ 625301326 微信公众号 geekideaio 今日头条 GeekIdea
spring-boot-plus QQ Group Wechat Official Account toutiao

赞赏

请作者喝咖啡,让代码飞一会儿!

geekidea-wechat-donate

License

spring-boot-plus is under the MIT-License. See the LICENSE file for details.

MIT License Copyright (c) 2023 geekidea Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

spring-boot-plus是一套集成spring boot常用开发组件的后台快速开发框架,每个人都可以独立、快速、高效地开发项目! 开源协议 MIT-License,任何个人或公司,均可基于此框架进行二次开发后,进行商业使用,无需授权! 展开 收起
Java
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Java
1
https://gitee.com/welfsen/spring-boot-plus.git
git@gitee.com:welfsen/spring-boot-plus.git
welfsen
spring-boot-plus
spring-boot-plus
master

搜索帮助