gitmyhub

Mapper

Java ★ 7.4k updated 2mo ago

Mybatis Common Mapper - Easy to use

A MyBatis plugin for Java that provides ready-made database operations (fetch, save, update, delete) for single tables, so developers don't have to write the same boilerplate for every table in their app.

JavaMyBatisSpring Bootsetup: moderatecomplexity 2/5

This repository is a plugin for MyBatis, a Java library that helps applications read from and write to databases. The plugin is called MyBatis Common Mapper, and its purpose is to cut down on repetitive code. When using plain MyBatis, developers must write specific instructions for every basic database action: fetching a record, saving a new one, updating an existing one, deleting one. This plugin provides ready-made versions of all those common operations so developers do not have to write them from scratch for every database table.

The plugin works with single-table operations only. Queries that pull data from multiple tables at once (called joins) are not covered; those still need to be written manually. This is a deliberate scope decision, keeping the plugin focused and simple.

There are three maintained versions corresponding to different generations of the Spring Boot framework, a popular tool for building Java web applications. The newest branch supports Spring Boot 4 and requires Java 17 or newer. An older branch supports Spring Boot 3, and a further branch supports Spring Boot 2 with Java 8. The README notes that developers starting new projects should consider a newer sibling project called mybatis-mapper, which achieves the same goals with a cleaner architecture that does not require modifying the underlying MyBatis libraries.

The README is written in Chinese and is aimed at Chinese-speaking Java developers. It links to documentation on both GitHub and Gitee (a Chinese code hosting platform), as well as a book about MyBatis written by the same author. The project is open source under the MIT license and has been maintained across multiple major versions of the Spring ecosystem. The author also maintains a pagination plugin for MyBatis called PageHelper, which is mentioned as a companion tool.

Where it fits