<!--单词选项,嵌套-->
<resultMap id="wordAndOption" type="org.springblade.english.vo.WordAndOptionVO">
<result column="id" property="id"/>
<result column="en_text" property="enText"/>
<result column="ch_text" property="chText"/>
<result column="symbol" property="symbol"/>
<result column="word_usage" property="wordUsage"/>
<result column="sound_url" property="soundUrl"/>
<collection property="wordOptions" javaType="list" ofType="org.springblade.english.vo.WordOptionVO">
<result column="oid" property="id"/>
<result column="word_id" property="wordId"/>
<result column="type" property="type"/>
<result column="text" property="text"/>
<result column="source_url" property="sourceUrl"/>
<result column="is_right" property="isRight"/>
</collection>
</resultMap>
<!--根据年级查询该年级对应的-->
<select id="selectWordAndOption" resultMap="wordAndOption" parameterType="java.lang.Integer">
select a.id,a.en_text,a.ch_text,a.symbol,a.word_usage,a.sound_url,
d.id oid, d.word_id,d.type, d.text, d.source_url, d.is_right
from
en_word a
left join en_material_unit b on a.unit_id = b.id
left join en_material c on b.material_id = c.id
left join en_word_option d on a.id = d.word_id
where a.is_deleted = 0 and b.is_deleted = 0 and c.is_deleted = 0 and d.is_deleted = 0 and d.type = 1
and c.grade_id = #{grade}
</select>
mybatis嵌套查询
最新推荐文章于 2025-06-27 21:51:09 发布