update docs

This commit is contained in:
开源海哥 2023-04-21 18:21:36 +08:00
parent fa47c7cca3
commit df53f2b6a3

View File

@ -70,19 +70,26 @@ public class HelloWorld {
//获取 mapper
AccountMapper mapper = MybatisFlexBootstrap.getInstance()
.getMapper(AccountMapper.class);
//示例1查询 id=1 的数据
Account account = mapper.selectOneById(1);
//示例2者使用 Db + Row 查询
//示例2根据 QueryWrapper 查询 id >= 100 的数据列表
QueryWrapper query = QueryWrapper.create()
.where(ACCOUNT.ID.ge(100));
List<Account> accounts = mapper.selectListByQuery(query);
//示例3者使用 Db + Row 查询
String sql = "select * from tb_account where age > ?";
List<Row> rows = Db.selectListBySql(sql, 18);
}
}
```
> 以上的示例中, `AccountMapper.class` 为 Mybatis-Flex 通过 APT 自动生成,无需手动编码。
> 也可以关闭自动生成功能,手动编写 AccountMapper更多查看 [APT 文档](./apt)。
> 以上的示例中, `AccountMapper.class` `ACCOUNT` 为 Mybatis-Flex 通过 APT 自动生成,无需手动编码。
> 我们也可以关闭 mapper 的自动生成功能,手动编写 AccountMapper更多查看 [APT 文档](./apt)。
## 更多示例