Hibernate Criteria查询无法提供完整的结果

时间:2019-05-25 09:19:20

标签: hibernate

=IF(M13>9,IF(P13="","", IF(K13="V", ($A$4+(INDEX('Minimum Visual Inspection Times'!$A$2:$P$15, MATCH(C13,'Minimum Visual Inspection Times'!$A$1:$A$15,TRUE), MATCH(D13,'Minimum Visual Inspection Times'!$A$2:$P$2,))))/(60*60*24), (($A$3+$A$2*2)+(INDEX('Minimum M21 Screening Times'!$A$2:$P$17, MATCH(C13,'Minimum M21 Screening Times'!$A$2:$A$17,TRUE), MATCH(D13,'Minimum M21 Screening Times'!$A$2:$P$2,))))/(60*60*24))),IF(P13="","", IF(K13="V", ($A$4+(INDEX('Minimum Visual Inspection Times'!$A$2:$P$15, MATCH(C13,'Minimum Visual Inspection Times'!$A$1:$A$15,TRUE), MATCH(D13,'Minimum Visual Inspection Times'!$A$2:$P$2,))))/(60*60*24), (($A$3)+(INDEX('Minimum M21 Screening Times'!$A$2:$P$17, MATCH(C13,'Minimum M21 Screening Times'!$A$2:$A$17,TRUE), MATCH(D13,'Minimum M21 Screening Times'!$A$2:$P$2,))))/(60*60*24))))

我已经编写了以上代码,但代码未提供确切结果。 任何人都可以帮助我解决问题。 sql查询生成如下:

Criteria criteria = createEntityCriteria().addOrder(Order.asc("dtname"));
ProjectionList projection = Projections.projectionList();
projection.add(Projections.distinct(Projections.property("dtncode")));
projection.add(Projections.property("dtname"));
criteria.setProjection(projection);
List<VillageMaster> villageMasters = (List<VillageMaster>) 
criteria.list();

1 个答案:

答案 0 :(得分:0)

使用以下代码

Criteria criteria = createEntityCriteria().addOrder(Order.asc("dtname"));    
ProjectionList projection = Projections.projectionList();
projection.add(Projections.property("dtncode"));
projection.add(Projections.property("dtname"));
criteria.setProjection(Projections.distinct(projection));
List<VillageMaster> villageMasters = (List<VillageMaster>) 
criteria.list();