加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

GRAILS中Criteria的OR的写法

发布时间:2020-12-14 16:51:31 所属栏目:大数据 来源:网络整理
导读:Java代码 ? Person.withCriteria?{??? ????or?{??? ????????and?{??? ????????????eq? 'lastName' ,? 'Winter' ??? ????????????eq? 'firstName' ,? 'Johnny' ??? ????????}??? ????????and?{??? ????????????eq? 'lastName' ,? 'Brown' ??? ????????????eq?


Java代码 ?

收藏代码

  1. Person.withCriteria?{???
  2. ????or?{???
  3. ????????and?{???
  4. ????????????eq?'lastName',?'Winter'???
  5. ????????????eq?'firstName',?'Johnny'???
  6. ????????}???
  7. ????????and?{???
  8. ????????????eq?'lastName',?'Brown'???
  9. ????????????eq?'firstName',?'Jeff'???
  10. ????????}???
  11. ????}???
  12. }???

?

上面的语言将对应如下SQL语句

?

?

?

Sql代码 ?

收藏代码

  1. select???
  2. ????this_.id?as?id0_0_,???
  3. ????this_.version?as?version0_0_,???
  4. ????this_.last_name?as?last3_0_0_,???
  5. ????this_.first_name?as?first4_0_0_???
  6. from???
  7. ????person?this_???
  8. where???
  9. ????(???
  10. ????????(???
  11. ????????????this_.last_name='Winter'???
  12. ????????????and?this_.first_name='Johnny'???
  13. ????????)???
  14. ????????or?(???
  15. ????????????this_.last_name='Brown'???
  16. ????????????and?this_.first_name='Jeff'???
  17. ????????)???
  18. ????) ??

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读