# springboot-mybatis-demo **Repository Path**: duanxq/springboot-mybatis-demo ## Basic Information - **Project Name**: springboot-mybatis-demo - **Description**: springboot、mybatis、swagger 、tk.mapper、pageHelper、lombok - **Primary Language**: Java - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 2 - **Forks**: 4 - **Created**: 2017-12-15 - **Last Updated**: 2021-10-27 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ![Licence](https://img.shields.io/badge/licence-none-green.svg) ## 简介 基于Spring Boot & MyBatis的项目,用于快速构建中小型Restful API项目,减少重复劳动,专注于业务代码的编写。 ## 特征 & 提供 - 代码生成器(一键生成代码) - 集成MyBatis、通用Mapper插件、PageHelper分页插件,实现单表零SQL - 集成Druid数据库连接池与监控 - 日志拦截、登录拦截 - 统一异常处理 - 统一响应结果封装 - 统一的API接口文档 - 常用工具类 - 其他 ## 快速开始 1. 克隆项目 2. 执行 db/data.sql 3. 修改 application-local.yml、 config.properties中数据库用户、密码 4. 运行```CodeGenerator.main()```方法生成代码 5. 启动项目 访问 [http://localhost/doc.html](http://localhost/doc.html) ![效果](https://github.com/duanxq1994/springboot-mybatis-demo/blob/master/image/example.png?raw=true) ## 开发建议 - 表名小写,多个单词使用下划线分隔 - Model内成员变量DO与表字段对应,VO对外展示,DTO用于项目中信息的传输,之间使用dozer转换 - 业务失败直接抛出```BizException("message")```,由统一异常处理器来封装业务失败的响应结果,比如```throw new BizException("该手机号已被注册")``` - 需要工具类的话先从```apache-commons-*```和```guava```中找,没有再造轮子或引入类库,尽量精简项目 - 开发规范遵循阿里巴巴Java开发手册([最新版下载](https://github.com/alibaba/p3c)) - 使用Swagger2([官网](https://swagger.io/)、[简介](https://www.cnblogs.com/JoiT/p/6378086.html)) 管理API文档 ## 技术选型 & 文档 - [Spring Boot](http://www.jianshu.com/p/1a9fd8936bd8) - [MyBatis](http://www.mybatis.org/mybatis-3/zh/index.html) - [MyBatisb 通用Mapper插件](https://github.com/abel533/Mapper) - [MyBatis PageHelper分页插件](https://github.com/pagehelper/Mybatis-PageHelper) - [Druid Spring Boot Starter](https://github.com/alibaba/druid/tree/master/druid-spring-boot-starter/) - 其他 ## 其他 - 代码质量分析([查看](https://sonarcloud.io/dashboard?id=duanxq1994_springboot-mybatis-demo)) - 代码分享,欢迎 [Star](https://github.com/duanxq1994/springboot-mybatis-demo/stargazers) & [Fork](https://github.com/duanxq1994/springboot-mybatis-demo/network/members)