mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-06 16:48:24 +08:00
update docs
This commit is contained in:
parent
d15fdf98e8
commit
877d3b8058
@ -67,14 +67,14 @@ public class HelloWorld {
|
||||
.addMapper(AccountMapper.class)
|
||||
.start();
|
||||
|
||||
//获取 mapper
|
||||
AccountMapper mapper = MybatisFlexBootstrap.getInstance()
|
||||
.getMapper(AccountMapper.class);
|
||||
|
||||
//示例1:查询 id=1 条数据
|
||||
Account account = MybatisFlexBootstrap.getInstance()
|
||||
.execute(AccountMapper.class, mapper ->
|
||||
mapper.selectOneById(1)
|
||||
);
|
||||
//示例1:查询 id=1 的数据
|
||||
Account account = mapper.selectOneById(1);
|
||||
|
||||
//示例2:或者使用 Db + Row 查询
|
||||
//示例2:者使用 Db + Row 查询
|
||||
String sql = "select * from tb_account where age > ?";
|
||||
List<Row> rows = Db.selectListBySql(sql, 18);
|
||||
}
|
||||
|
||||
18
readme.md
18
readme.md
@ -57,12 +57,12 @@ class HelloWorld {
|
||||
.addMapper(AccountMapper.class)
|
||||
.start();
|
||||
|
||||
AccountMapper mapper = MybatisFlexBootstrap.getInstance()
|
||||
.getMapper(AccountMapper.class);
|
||||
|
||||
|
||||
//id=100
|
||||
Account account = MybatisFlexBootstrap.getInstance()
|
||||
.execute(AccountMapper.class, mapper ->
|
||||
mapper.selectOneById(100)
|
||||
);
|
||||
Account account = mapper.selectOneById(100);
|
||||
}
|
||||
}
|
||||
```
|
||||
@ -81,10 +81,7 @@ QueryWrapper query = QueryWrapper.create()
|
||||
// ELECT * FROM tb_account
|
||||
// WHERE tb_account.id >= 100
|
||||
// AND (tb_account.user_name LIKE '%zhang%' OR tb_account.user_name LIKE '%li%' )
|
||||
List<Account> accounts = MybatisFlexBootstrap.getInstance()
|
||||
.execute(AccountMapper.class, mapper ->
|
||||
mapper.selectListByQuery(query)
|
||||
);
|
||||
List<Account> accounts = mapper.selectListByQuery(query);
|
||||
```
|
||||
|
||||
e.g.3: paging query
|
||||
@ -104,10 +101,7 @@ QueryWrapper query = QueryWrapper.create()
|
||||
// AND (tb_account.user_name LIKE '%zhang%' OR tb_account.user_name LIKE '%li%' )
|
||||
// ORDER BY tb_account.id DESC
|
||||
// LIMIT 40,10
|
||||
Page<Account> accountPage = MybatisFlexBootstrap.getInstance()
|
||||
.execute(AccountMapper.class, mapper ->
|
||||
mapper.paginate(5, 10, query)
|
||||
);
|
||||
Page<Account> accountPage = mapper.paginate(5, 10, query);
|
||||
```
|
||||
|
||||
## QueryWrapper Samples
|
||||
|
||||
18
readme_zh.md
18
readme_zh.md
@ -70,12 +70,12 @@ class HelloWorld {
|
||||
.addMapper(AccountMapper.class)
|
||||
.start();
|
||||
|
||||
AccountMapper mapper = MybatisFlexBootstrap.getInstance()
|
||||
.getMapper(AccountMapper.class);
|
||||
|
||||
|
||||
//示例1:查询 id=100 条数据
|
||||
Account account = MybatisFlexBootstrap.getInstance()
|
||||
.execute(AccountMapper.class, mapper ->
|
||||
mapper.selectOneById(100)
|
||||
);
|
||||
Account account = mapper.selectOneById(100);
|
||||
}
|
||||
}
|
||||
```
|
||||
@ -96,10 +96,7 @@ QueryWrapper query=QueryWrapper.create()
|
||||
// ELECT * FROM tb_account
|
||||
// WHERE tb_account.id >= 100
|
||||
// AND (tb_account.user_name LIKE '%张%' OR tb_account.user_name LIKE '%李%' )
|
||||
List<Account> accounts = MybatisFlexBootstrap.getInstance()
|
||||
.execute(AccountMapper.class,mapper->
|
||||
mapper.selectListByQuery(query)
|
||||
);
|
||||
List<Account> accounts = mapper.selectListByQuery(query);
|
||||
```
|
||||
|
||||
示例3:分页查询
|
||||
@ -120,10 +117,7 @@ QueryWrapper query=QueryWrapper.create()
|
||||
// AND (user_name LIKE '%张%' OR user_name LIKE '%李%' )
|
||||
// ORDER BY `id` DESC
|
||||
// LIMIT 40,10
|
||||
Page<Account> accounts = MybatisFlexBootstrap.getInstance()
|
||||
.execute(AccountMapper.class,mapper->
|
||||
mapper.paginate(5,10,query)
|
||||
);
|
||||
Page<Account> accounts = mapper.paginate(5,10,query);
|
||||
```
|
||||
|
||||
## QueryWrapper 示例
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user