使用 HQL 映射 VO

@Query("SELECT new app.modules.exam.domain.vo.ExamVO(a.id, b.name) FROM Exam2AppUser a join a.exam b where a.appUser = :appUser")
public Page<ExamVO> findExamVOs(Pageable page,@Param("appUser")AppUser appUser);


注意:
1、第一个红色部分 为映射的VO,注意该VO需要与之匹配的构造方法:
    public ExamVO(String e2auId,String examName){
        this.e2auId = e2auId;
        this.examName = examName;
    }

2、第二个红色部分为 JQL语法中的 join的用法

posted on 2017-12-22 21:48  HB1  阅读(226)  评论(0)    收藏  举报

导航