# gs-mybatis **Repository Path**: gs-s/gs-mybatis ## Basic Information - **Project Name**: gs-mybatis - **Description**: Components usage demo - **Primary Language**: Java - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2018-06-02 - **Last Updated**: 2020-12-18 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Components - Mybatis - Common Mapper - PageHelper ## Demo - insert [Common Mapper - 普通插入] - insertBatch [MySqlMapper - 批量插入(一条SQL)] - selectByExample [Common Mapper - 通用Mapper的根据Example查询] - selectAll [Common Mapper - 通用Mapper查询所有] - selectAllByPage [PageHelper - 通用Mapper分页查询所有] - deleteByExample [Common Mapper - 通用Mapper的根据Example删除] - selectByGenderByAnnotation [Select via @Select - Mybatis注解形式查询] - selectByCondition [Dynamic Search - Mybatis的XML形式动态查询] - selectByConditionBySqlProvider [Dynamic Search via SqlProvider - SqlProvider动态查询] - updateByPrimaryKeySelective [Common Mapper - 通用Mapper的根据主键更新] - updateByExample [Common Mapper - 通用Mapper的根据Example更新] ## Documents - [Mybatis ](http://www.mybatis.org/mybatis-3/index.html) - [Common Mapper](https://github.com/abel533/Mapper/wiki) - [PageHelper](https://github.com/pagehelper/Mybatis-PageHelper/blob/master/wikis/en/HowToUse.md) ## BiBi - 在使用枚举的时候,默认枚举不识别,[通用Mapper.typehandler Doc](https://github.com/abel533/Mapper/wiki/7.2.typehandler)中提到使用@ColumnType来指定类型,但是发现通过Mybatis的注解或XML方式查询是无效的,后来看到[spring-boot-starter Doc](http://www.mybatis.org/spring-boot-starter/mybatis-spring-boot-autoconfigure/)中提到了mybatis.type-handlers-package配置项,配置后发现可用,不需要使用@ColumnType,但是在[通用Mapper.typehandler Doc](https://github.com/abel533/Mapper/wiki/7.2.typehandler)中提到如下提示,所以选择通用的在application.properties/yml中添加mapper.enum-as-simple-type=true >- 默认情况下只有简单类型才会被当作表中的字段(useSimpleType=true)。 >- 当字段有 @Column 或者 @ColumnType 注解时,也会被当作表中的字段。 >- 默认情况下,枚举不会当作表中的字段,如果想要自动把枚举作为表中字段,需要配置 enumAsSimpleType=true,这里的例子就启用了这个配置。如果不启用这个功能,也需要加 @Column 或者 @ColumnType 注解。