mybatis-plugin

mybatis plugin

Лицензия

Лицензия

Категории

Категории

MyBatis Данные ORM
Группа

Группа

cn.weiecho
Идентификатор

Идентификатор

mybatis-plugin
Последняя версия

Последняя версия

1.0.2
Дата

Дата

Тип

Тип

jar
Описание

Описание

mybatis-plugin
mybatis plugin
Ссылка на сайт

Ссылка на сайт

https://github.com/weiecho/mybatis-plugin
Система контроля версий

Система контроля версий

https://github.com/weiecho/mybatis-plugin

Скачать mybatis-plugin

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/cn.weiecho/mybatis-plugin/ -->
<dependency>
    <groupId>cn.weiecho</groupId>
    <artifactId>mybatis-plugin</artifactId>
    <version>1.0.2</version>
</dependency>
// https://jarcasting.com/artifacts/cn.weiecho/mybatis-plugin/
implementation 'cn.weiecho:mybatis-plugin:1.0.2'
// https://jarcasting.com/artifacts/cn.weiecho/mybatis-plugin/
implementation ("cn.weiecho:mybatis-plugin:1.0.2")
'cn.weiecho:mybatis-plugin:jar:1.0.2'
<dependency org="cn.weiecho" name="mybatis-plugin" rev="1.0.2">
  <artifact name="mybatis-plugin" type="jar" />
</dependency>
@Grapes(
@Grab(group='cn.weiecho', module='mybatis-plugin', version='1.0.2')
)
libraryDependencies += "cn.weiecho" % "mybatis-plugin" % "1.0.2"
[cn.weiecho/mybatis-plugin "1.0.2"]

Зависимости

compile (2)

Идентификатор библиотеки Тип Версия
org.mybatis.spring.boot : mybatis-spring-boot-starter Необязательный jar 2.1.0
org.json : json Необязательный jar 20190722

Модули Проекта

Данный проект не имеет модулей.

mybatis-plugin

根据真实使用场景对mybatis进行的扩展,实现分页、json存储、数组存储、blob存储等支持。

GitHub release Maven Central Repo openjdk License

扩展Mybatis数据类型

1、ArrayTypeHandler 支持数组数据的存储和读取

bean定义格式

private String[] tags;

mapper定义格式

<result property="tags" column="tags" typeHandler="ArrayTypeHandler"/>
2、JsonTypeHandler 支持Json对象数据的存储和读取

bean定义格式

/** 图片 如:[{imageUrl:"/1.jpg"}] **/
private Object imagesUrl;

mapper定义格式

<result property="imagesUrl" column="imagesUrl" typeHandler="JsonTypeHandler"/>
3、BlobTypeHandler 支持Blob数据的存储和读取

bean定义格式

/** 文章内容 **/
private String content;

mapper定义格式

<result property="content" column="content" typeHandler="BlobTypeHandler"/>
4、ListTypeHandler 支持List数据的存储和读取(可以视为Array的升级版)

bean定义格式

private List<String> tags;

mapper定义格式

<result property="tags" column="tags" typeHandler="ListTypeHandler"/>

扩展Mybatis自动执行分页SQL处理

1、MysqlPageInterceptor支持mysql数据的分页
PageInterceptor pageInterceptor = new MysqlPageInterceptor();
sessionFactory.setPlugins(new Interceptor[]{pageInterceptor});
2、OraclePageInterceptor支持oracle数据的分页
PageInterceptor pageInterceptor = new OraclePageInterceptor();
sessionFactory.setPlugins(new Interceptor[]{pageInterceptor});
3、PostgresqlPageInterceptor支持postgresql数据的分页
PageInterceptor pageInterceptor = new PostgresqlPageInterceptor();
sessionFactory.setPlugins(new Interceptor[]{pageInterceptor});

ps:如果分页对应的查询语句中不存在from会throw异常分页查询SQL没有找到[from]关键字,from必须为小写且前后加空格。

cn.weiecho

Wei Echo

Версии библиотеки

Версия
1.0.2
1.0.1