@Data
public class MyExamVo implements Serializable {
private static final long serialVersionUID = 1L;
private ExamStu exam;
private BatchNum pc;

private Named name;


}

mapper xml

<select id="getMyExamList" resultMap="myExamMap">
select k.*,p.st_name_id from xg_ks_stu k
left join xg_ks_pc p
on k.pc_id =p.id
where
k.xs_id = #{xsId}
</select>

<resultMap id="myExamMap" type="org.stu.exam.vo.MyExamVo">
<association property="exam" resultMap="examMap"></association>
<association property="pc" column="pc_id" select="selBatch"></association>
<association property="name" column="st_name_id" select="selName"></association>
</resultMap>
<resultMap id="examMap" type="org.jeecg.modules.stu.exam.entity.ExamStu">
<id property="id" column="id"></id>
<result property="pcId" column="pc_id"></result>
<result property="xsId" column="xs_id"></result>
<result property="beginTime" column="begin_time"></result>
<result property="subTime" column="sub_time"></result>
<result property="score" column="score"></result>
</resultMap>
<resultMap id="batchMap" type="org.stu.exam.entity.BatchNum"></resultMap>
<resultMap id="nameMap" type="org.stu.exam.entity.Named"></resultMap>

<select id="selBatch" resultMap="batchMap">
select * from xg_ks_pc where id=#{id}
</select>
<select id="selName" resultMap="nameMap">
select * from xg_ks_name where id=#{id}
</select>

mapper类

<MyExamVo> getMyExamList(Page page, @Param("xsId") String xsId);

impl类

@Override
public IPage<MyExamVo> getMyExam(Page page, String xsId){
return batchNumMapper.getMyExamList(page,xsId);
}

先是一个关联查询,从记录结果中用 pc_id 和 st_name_id 传参 分别关联查询,得到两个对象,作为属性封装为一个对象,examMap 定义了一个映射,主查询中字典与类ExamStu 中的属性进行对应