我有以下查询 sql 查询:
select * from Articles ar
left join ArticleTeamRelationships atr on atr.ArticleId = ar.ArticleId
left join Team te on te.TeamId = atr.TeamId
inner join ArticleCategoryRelationships acr on acr.ArticleId = ar.ArticleId
inner join ArticleCategory ac on ac.CategoryId = acr.CategoryId
where ac.CategoryId = 3
and ((te.TeamId in (1) and ar.TeamReadOnly = 1) or te.TeamId is null)
这是我到目前为止所写的:
Criteria childCriteriaCategory = criteria.createCriteria("articleCategory", Criteria.INNER_JOIN);
childCriteriaCategory.add(Restrictions.like("categoryId", categoryId));
Criteria childCriteriaTeam = criteria.createCriteria("team", Criteria.LEFT_JOIN);
childCriteriaTeam.add(Restrictions.in("teamId", teamId));
Criterion teamReadOnly = Restrictions.eq("teamReadOnly", true);
criteria.add(teamReadOnly);
如何在第一个括号内写“和”和“或”?