0

我正在尝试创建一个出现在其他两个列表中的公司列表。我可以设法创建一个出现在其他列表中的公司列表,如下所示:-

       List masterList = Companies.createCriteria().list(){
            'in'("companyname", alistofcompanies) 
            and {
                or{
                    eq("type","T1")
                    eq("type","T2")
                }                
             order ("companyname")
            }     
        }

但我不知道如何在其他两个列表中寻找公司。我试过这个:-

    List masterList = Companies.createCriteria().list(){
            or{
               'in'("companyname", alistofcompanies) 
               'in'("companyname", anotherlistofcompanies)
             }
            and {
                or{
                    eq("type","T1")
                    eq("type","T2")
                }                
             order ("companyname")
            }     
      }

但它给了我一个语法错误。

任何线索我应该如何构建这个?

4

1 回答 1

2

除了您可以改进代码并且它正在工作之外,我没有看到任何语法问题。

 List masterList = Companies.createCriteria().list() {
            'in'("companyname", alistofcompanies + anotherlistofcompanies)
            'in'("type", ["T1", "T2"])
             order("companyname")
  }
于 2018-08-24T09:58:35.807 回答