Is there a 'not in' equivalent in GORM?

前端 未结 5 955
我寻月下人不归
我寻月下人不归 2021-02-15 10:21

Is this possible to convert in createCriteria()?

SELECT * FROM node WHERE (node.type = \'act\' AND nid NOT IN (SELECT nid FROM snbr_act_community)) LIMIT 10
         


        
5条回答
  •  情话喂你
    2021-02-15 11:11

    thanks Sammyrulez for the code. got an idea from that. tested it but it didn't work. i fixed it and here's the final working code:

    def ids = [14400 as long, 14401 as long]
    
    def c = VolunteerOpportunity.createCriteria()
    def matchingActs = c.list {
        node {
            eq('type', 'act')
            not { 'in'(ids) }
        }
        maxResults(10)
    }
    

    now i know how to use 'not' operator. thanks a lot!

提交回复
热议问题