DetachedCriteria如何使用in查询
代码如下:
DetachedCriteria subCriteria = DetachedCriteria.forClass(子查询用到的po类, "d"); subCriteria.add(Restrictions.eq("条件字段名","条件字段值")); subCriteria.add(Property.forName("d.子表与主表要关联字段名").eqProperty(criteria.getAlias()+".主表与子表要关联字段名")); criteria.add(Subqueries.exists(subCriteria.setProjection(Projections.property("d.sguid"))));
时间: 2024-11-09 02:43:47