Hint
This article is generated by AI translation.
Mapper Interface (BaseMapper)
BaseMapper<T> is a generic data access interface provided by dbVisitor. Based on Object Mapping, it automatically generates CRUD statements without writing any SQL.
Quick Start
BaseMapper<User> mapper = session.createBaseMapper(User.class);
// Insert
mapper.insert(user);
// Query by primary key
User found = mapper.selectById(1L);
// Pagination query
Page page = PageObject.of(0, 20);
PageResult<User> result = mapper.pageBySample(null, page);
Tip
How to obtain a Session depends on your project architecture. See Framework Integration for details.
User Guide
- Basic Operations, CRUD, primary key operations, and pagination queries.
- Invoke Fluent API, use condition builders on BaseMapper for complex queries.
- Execute Commands in Mapper File, reference SQL commands defined in Mapper XML files.