原来的sql:
String sql = "select t from applications t where 1=1
and ((t.state = 'DRAFT' and t.creater = '1111')
or (t.state = 'EXE' and t.leader = '1111'))"
生成的sql:
select t from applications t where 1=1
and (t.state = 'DRAFT' and t.creater = '1111'
or t.state = 'EXE' and t.leader = '1111')
原因:and 的 优先级高于 or,所以两个语句其实是一样的
网友评论