用collection必须加id

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<select id="getAll" resultMap="HeadItemMap">
select ft.title label, st.title cl, ft.id, st.id ci
from first_title ft,
second_title st
where ft.id = st.first_title_id
order by ft.`order`, ft.id, st.`order`, st.id
</select>

<resultMap id="HeadItemMap" type="headItem">
<id property="id" column="id"/>
<collection property="children" ofType="headItem">
<id property="id" column="ci"/>
<result property="label" column="cl"/>
</collection>
</resultMap>