您的位置:首页 > 其它

mybatis 拼装 and和or 查询条件

2016-03-15 13:31 513 查看
示例:

TestTableExample example = new TestTableExample();

example.or()
.andField1EqualTo(5)
.andField2IsNull();

example.or()
.andField3NotEqualTo(9)
.andField4IsNotNull();

List<Integer> field5Values = new ArrayList<Integer>();
field5Values.add(8);
field5Values.add(11);
field5Values.add(14);
field5Values.add(22);

example.or().andField5In(field5Values);

example.or().andField6Between(3, 7);
where (field1 = 5 and field2 is null)
or (field3 <> 9 and field4 is not null)
or (field5 in (8, 11, 14, 22))
or (field6 between 3 and 7)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: