String hql = "select publicPolicyId from TMuster where musterDate >= ? and publicPolicyId between ? and ? ";
Query query = session.createQuery(hql);
query.setParameter(0, DateUtil.toDate("2010-01-01"));
query.setParameter(1, policyIdStart);
query.setParameter(2, policyIdEnd);
List tmpList = query.list();
if(tmpList == null){return null;}
// 过滤查询 TPolicyInsurantTemporary 非空条件
hql = "select id.publicPolicyId from TPolicyInsurantTemporary where id.publicPolicyId in(:plist) and name <> '' and cert <> '' and cerc <> '' ";
query = session.createQuery(hql);
query.setParameterList("plist", tmpList);
tmpList = query.list();
if(tmpList == null){return null;}
// 过滤查询 PublicPolicyTemporary 非空条件
hql = "from TPublicPolicyTemporary where publicPolicyId in(:plist) and applyName <> '' and applyCert <> '' and applyCerc <> '' and billNo <> '' ";
query = session.createQuery(hql);
query.setParameterList("plist", tmpList);
tmpList = query.list();
if(tmpList == null){return null;}
rstList = this.TPublicPolicyTrVO(tmpList);
hibernate查询条件为list
最新推荐文章于 2024-04-18 03:43:49 发布
该段代码展示了如何使用HQL进行数据库查询并进行多步骤的数据过滤。首先,根据指定日期范围和政策ID范围查询TMuster表。然后,从查询结果中筛选TPolicyInsurantTemporary表中非空字段的数据。最后,进一步过滤TPublicPolicyTemporary表中的非空字段记录。最终,将处理后的结果转化为TPublicPolicyTrVO对象列表。

3380

被折叠的 条评论
为什么被折叠?



