mybatis-helper

Help to improve development speed

License

License

Categories

Categories

MyBatis Data ORM
GroupId

GroupId

io.github.snowthinker
ArtifactId

ArtifactId

mybatis-helper
Last Version

Last Version

0.0.2-RELEASE
Release Date

Release Date

Type

Type

jar
Description

Description

mybatis-helper
Help to improve development speed
Project URL

Project URL

https://github.com/snowyThinker/mybatis-helper
Source Code Management

Source Code Management

https://github.com/snowThinker/mybatis-helper

Download mybatis-helper

How to add to project

<!-- https://jarcasting.com/artifacts/io.github.snowthinker/mybatis-helper/ -->
<dependency>
    <groupId>io.github.snowthinker</groupId>
    <artifactId>mybatis-helper</artifactId>
    <version>0.0.2-RELEASE</version>
</dependency>
// https://jarcasting.com/artifacts/io.github.snowthinker/mybatis-helper/
implementation 'io.github.snowthinker:mybatis-helper:0.0.2-RELEASE'
// https://jarcasting.com/artifacts/io.github.snowthinker/mybatis-helper/
implementation ("io.github.snowthinker:mybatis-helper:0.0.2-RELEASE")
'io.github.snowthinker:mybatis-helper:jar:0.0.2-RELEASE'
<dependency org="io.github.snowthinker" name="mybatis-helper" rev="0.0.2-RELEASE">
  <artifact name="mybatis-helper" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.github.snowthinker', module='mybatis-helper', version='0.0.2-RELEASE')
)
libraryDependencies += "io.github.snowthinker" % "mybatis-helper" % "0.0.2-RELEASE"
[io.github.snowthinker/mybatis-helper "0.0.2-RELEASE"]

Dependencies

compile (4)

Group / Artifact Type Version
org.mybatis : mybatis jar 3.5.1
org.hibernate.validator : hibernate-validator jar 6.1.0.Final
io.swagger : swagger-annotations jar 1.6.0
io.github.snowythinker : pojo-helper jar 0.0.4-SNAPSHOT

provided (1)

Group / Artifact Type Version
org.projectlombok : lombok jar 1.18.6

test (4)

Group / Artifact Type Version
junit : junit jar 4.10
com.h2database : h2 jar 1.4.200
org.apache.commons : commons-lang3 jar 3.9
ch.qos.logback : logback-classic jar 1.2.3

Project Modules

There are no modules declared in this project.

###mybatis-helper(https://github.com/snowThinker/mybatis-helper)

Maven Central License

主要功能

  • MyBatis枚举支持:支持枚举写入/读取数据库
  • 动态获取mapper方法的SQL语句:可根据动态参数获取 MyBatis 格式化好后带参数的SQL

####如何使用 pom 引入jar包

<dependency>
	<groupId>io.github.snowthinker</groupId>
	<artifactId>mybatis-helper</artifactId>
	<version>0.0.1-SNAPSHOT</version>
</dependency>

编写枚举类实现 MyBatisEnum 类

public enum StockMarket implements MyBatisEnum<StockMarket, Integer>{

	US,
	HK,
	CN;

	@Override
	public Integer getValue() {
		return this.ordinal();
	}
}

####字段枚举支持 mybatis.xml 添加typeHandler

<typeHandlers>
    <typeHandler handler="io.github.snowthinker.mh.EnumTypeHandler" javaType="io.github.snowthinkder.mh.test.UserStatus"/>
</typeHandlers>

####获取 mapper.xml 文件方法 SQL语句

String sql = MybatisSqlHelper.getMapperSql("oi.github.snowthinker.mapper.UserMapper", "queryById", 324);
System.out.println(sql);

分页支持

# mybatis.xml 添加如下配置
<plugins>
	<plugin interceptor="io.github.snowythinker.mh.page.interceptor.PageInterceptor" />
</plugins>
	
#java Service 如果调用	
List<Student> queryPageList(PageQueryRequest pageQuery);
    

Versions

Version
0.0.2-RELEASE
0.0.1-RELEASE