Skip to content

Commit f3aaba8

Browse files
committed
更新文档。
1 parent 948339d commit f3aaba8

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

wiki/mapper3/2.Integration.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,16 @@ mapperHelper.processConfiguration(session.getConfiguration());
5151
</bean>
5252
```
5353

54-
<b>你没看错,就是这么配置的,注意这里是`tk.mybatis`,通用Mapper的各项属性通过`properties`属性进行配置。</b>
54+
<b>你没看错,就是这么配置的,注意这里是`tk.mybatis.xxx`,和MyBatis的唯一区别就是`org.`改成了`tk.`,方便修改和记忆。
55+
56+
通用Mapper的各项属性通过`properties`属性进行配置,如果默认配置就是一行`mappers=tk.mybatis.mapper.common.Mapper`时,可以不写,就会变成:
57+
58+
```xml
59+
<bean class="tk.mybatis.spring.mapper.MapperScannerConfigurer">
60+
<property name="basePackage" value="com.isea533.mybatis.mapper"/>
61+
</bean>
62+
```
63+
5564

5665
###INENTITY参数配置(仅对 insert 有用)
5766

wiki/mapper3/5.Mappers.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ Mapper3接口有两种形式,一种是提供了一个方法的接口。还有
1717
说明:根据主键字段进行查询,方法参数必须包含完整的主键属性,查询条件使用等号<br>
1818
<br>
1919

20+
接口:`SelectAllMapper<T>`<br>
21+
方法:`List<T> selectAll();`<br>
22+
说明:查询全部结果,select(null)方法能达到同样的效果<br>
23+
<br>
24+
2025
接口:`SelectOneMapper<T>`<br>
2126
方法:`T selectOne(T record);`<br>
2227
说明:根据实体中的属性进行查询,只能有一个返回值,有多个结果是抛出异常,查询条件使用等号<br><br>
@@ -78,7 +83,9 @@ Mapper3接口有两种形式,一种是提供了一个方法的接口。还有
7883

7984
接口:`SelectByExampleMapper<T>`<br>
8085
方法:`List<T> selectByExample(Object example);`<br>
81-
说明:根据Example条件进行查询<br><br>
86+
说明:根据Example条件进行查询<br>
87+
<b>重点:</b>这个查询支持通过`Example`类指定查询列,通过`selectProperties`方法指定查询列<br><br>
88+
8289

8390
接口:`SelectCountByExampleMapper<T>`<br>
8491
方法:`int selectCountByExample(Object example);`<br>

wiki/mapper3/6.MyMapper.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ public interface InsertListMapper<T> {
2626
public String insertList(MappedStatement ms) {
2727
final Class<?> entityClass = getSelectReturnType(ms);
2828
//获取表的各项属性
29-
EntityHelper.EntityTable table = EntityHelper.getEntityTable(entityClass);
29+
EntityTable table = getEntityTable(entityClass);
3030
//开始拼sql
3131
StringBuilder sql = new StringBuilder();
3232
sql.append("insert into ");
3333
sql.append(table.getName());
3434
sql.append("(");
3535
boolean first = true;
36-
for (EntityHelper.EntityColumn column : table.getEntityClassColumns()) {
36+
for (EntityColumn column : table.getEntityClassColumns()) {
3737
if(!first) {
3838
sql.append(",");
3939
}
@@ -44,7 +44,7 @@ public String insertList(MappedStatement ms) {
4444
sql.append("<foreach collection=\"list\" item=\"record\" separator=\",\" >");
4545
sql.append("(");
4646
first = true;
47-
for (EntityHelper.EntityColumn column : table.getEntityClassColumns()) {
47+
for (EntityColumn column : table.getEntityClassColumns()) {
4848
if(!first) {
4949
sql.append(",");
5050
}

0 commit comments

Comments
 (0)