Commit 1d2d2d1a authored by hewei's avatar hewei

README.md 修改

parent 638a6409
...@@ -260,21 +260,23 @@ public class Test { ...@@ -260,21 +260,23 @@ public class Test {
public static void main(String[] args) { public static void main(String[] args) {
// 构建插入数据 // 构建插入数据
List<Tb> list = new ArrayList<>(); List<Tb> list = new ArrayList<>();
list.add(new Tb.Builder() list.add(
new Tb.Builder()
.field1(0) .field1(0)
.field2("xx0") .field2("xx0")
.field3(0) .field3(0)
.field4(new Date()) .field4(new Date())
.build() .build()
); );
list.add(new Tb.Builder() list.add(
new Tb.Builder()
.field1(1) .field1(1)
.field2("xx1") .field2("xx1")
.field3(1) .field3(1)
.field4(new Date()) .field4(new Date())
.build() .build()
); );
int inserted = this.tbMapper.batchInsert(list); this.tbMapper.batchInsert(list);
} }
} }
``` ```
...@@ -304,27 +306,27 @@ public class Test { ...@@ -304,27 +306,27 @@ public class Test {
public class Test { public class Test {
public static void main(String[] args) { public static void main(String[] args) {
// 1. 逻辑删除ByExample // 1. 逻辑删除ByExample
TbExample ex = new TbExample() this.tbMapper.logicalDeleteByExample(
new TbExample()
.createCriteria() .createCriteria()
.andField1EqualTo(1) .andField1EqualTo(1)
.example(); .example()
);
this.tbMapper.logicalDeleteByExample(ex);
// 2. 逻辑删除ByPrimaryKey // 2. 逻辑删除ByPrimaryKey
this.tbMapper.logicalDeleteByPrimaryKey(1L); this.tbMapper.logicalDeleteByPrimaryKey(1L);
// 3. 同时Example中提供了一个快捷方法来过滤逻辑删除数据 // 3. 同时Example中提供了一个快捷方法来过滤逻辑删除数据
TbExample selEx = new TbExample() this.tbMapper.selectByExample(
new TbExample()
.createCriteria() .createCriteria()
.andField1EqualTo(1) .andField1EqualTo(1)
// 新增了一个andDeleted方法过滤逻辑删除数据 // 新增了一个andDeleted方法过滤逻辑删除数据
.andDeleted(true) .andDeleted(true)
// 当然也可直接使用逻辑删除列的查询方法,我们数据Model中定义了一个逻辑删除常量DEL_FLAG // 当然也可直接使用逻辑删除列的查询方法,我们数据Model中定义了一个逻辑删除常量DEL_FLAG
.andDelFlagEqualTo(Tb.DEL_FLAG) .andDelFlagEqualTo(Tb.DEL_FLAG)
.example(); .example()
);
List<Tb> list = this.tbMapper.selectByExample(selEx);
} }
} }
``` ```
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment