<resultMap type="Paper" id="paperSingleQuestionMap">
<id property="id" column="id"></id>
<!-- 配置一对多的关系 -->
<collection property="singleQuestions" ofType="SingleQuestion">
<id property="id" column="id" javaType="int"></id>
<result property="qsTitle" column="qs_title"/>
</collection>
</resultMap>
<select id="findSingleQuestionByPaperId" parameterType="int" resultMap="paperSingleQuestionMap">
SELECT * FROM paper p,single_question sq WHERE p.`id`=sq.`paper_id` AND p.`id`=#{pid}
</select>
理想数据
实际数据