mybatis-help

generate mybatis template

License

License

Categories

Categories

MyBatis Data ORM
GroupId

GroupId

xyz.redrain
ArtifactId

ArtifactId

mybatis-help
Last Version

Last Version

1.0.6
Release Date

Release Date

Type

Type

jar
Description

Description

mybatis-help
generate mybatis template
Project URL

Project URL

https://github.com/redrainz/mybatis-help
Source Code Management

Source Code Management

https://github.com/redrainz/mybatis-help

Download mybatis-help

How to add to project

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

Dependencies

provided (1)

Group / Artifact Type Version
org.mybatis : mybatis jar 3.5.0

test (2)

Group / Artifact Type Version
mysql : mysql-connector-java jar 8.0.18
junit : junit jar 4.12

Project Modules

There are no modules declared in this project.

mybatis-help

  1. 功能

    1. 自动生成简单的增删改查功能。
    2. 侵入性低,使用简单,继承BaseMapper即可
  2. 要求

    1. mybatis:3.4.0+
  3. maven引入

      <dependency>
        <groupId>xyz.redrain</groupId>
        <artifactId>mybatis-help</artifactId>
        <version>1.0.6</version>
      </dependency>
  4. mapper 接口继承

    public interface UserMapper extends BaseMapper<User> {
    
    }
  5. POJO对象与表映射

    1. 非必填 主键属性名必须为id,可加上@Id注解
    2. 非必填 @Table为表名 可选表名或属性名是否映射成下划线模式
    3. 非必填 @Column 为列名
    4. 非必填 @Ignore不映射
    5. 非必填 @JavaType设置Java类型
         @Table("t_user")
         public class User {
             @Id()
             private Integer id;
             private String userName;
             @Column(jdbcType = "varchar")
             private String password;
             @UpdateSetNull
             private Date time;
             @Ignore
             private Date time1;
            //getter,setter
         }
  6. 1.0.2 增加了 是否选择映射下划线模式,当Table为空时,取默认值

    public @interface Table {
       /**
         * 属性是否映射成下划线模式
         * true  aB -> a_b
         * false aB -> aB
         *
         */
        boolean propertyUseUnderlineStitching() default true;
    
        /**
         * 表名是否映射成下划线模式
         * true  aB -> a_b
         * false aB -> aB
         */
        boolean tableUseUnderlineStitching() default true;
    }
    
  7. 1.0.5 增加了 countByParams方法

Versions

Version
1.0.6
1.0.5
1.0.4
1.0.3
1.0.2
1.0.0-RELEASE