您的位置:首页 > 其它

HQL语句多表联合查询的视图

2017-05-10 11:28 239 查看
HQL语句多表联合查询

StringBuilder hqlsb1=new StringBuilder("select distinct f from TSFunction f,TSRoleFunction rf,TSRoleUser ru ").append("where ru.TSRole.id=rf.TSRole.id and rf.TSFunction.id=f.id and ru.TSUser.id=? ");

StringBuilder hqlsb2=new StringBuilder("select distinct c from TSFunction c,TSRoleFunction rf,TSRoleOrg b,TSUserOrg a ")
.append("where a.tsDepart.id=b.tsDepart.id and b.tsRole.id=rf.TSRole.id and rf.TSFunction.id=c.id and a.tsUser.id=?");
List<TSFunction> list1 = systemService.findHql(hqlsb1.toString(),user.getId());
List<TSFunction> list2 = systemService.findHql(hqlsb2.toString(),user.getId());
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息