一对多的使用
<resultMap type="hotkidclub.model.qa.Qa" id="qaResultMap">
<id column="key" property="key"/>
<result column="name" property="name"/>
<result column="description" property="description"/>
<result column="activityKey" property="activityKey"/>
<result column="isCpn" property="isCpn"/>
<result column="cpnKey" property="cpnKey"/>
<result column="isAd" property="isAd"/>
<result column="adid" property="adid"/>
<result column="isActive" property="isActive"/>
<association property="pplSetting"
javaType="hotkidclub.model.qa.NotifyPplSetting" column="p_">
<result property="key" column="p_key" />
<result property="qaKey" column="p_qaKey" />
<result property="groupName" column="p_groupName" />
<result property="isTime" column="p_isTime" />
<result property="sendAtStart" column="p_sendAtStart" />
<result property="sendAtLast" column="p_sendAtLast" />
<result property="tags" column="p_tags" />
<result property="tagsType" column="p_tagsType" />
<result property="tagsValue" column="p_tagsValue" />
<result property="totalCount" column="p_totalCount" />
</association>
<collection property="activitys" ofType="hotkidclub.model.qa.Activity" >
<result property="key" column="a_key"/>
<result property="activityKey" column="a_activityKey"/>
<result property="quesId" column="a_quesId"/>
<result property="title" column="a_title"/>
<result property="typeName" column="a_typeName"/>
<result property="tagKey" column="a_tagKey"/>
<collection property="values" ofType="hotkidclub.model.qa.Value" columnPrefix="v_">
<result property="key" column="key"/>
<result property="actKey" column="actKey"/>
<result property="valueId" column="valueId"/>
<result property="text" column="text"/>
<result property="image" column="image"/>
<result property="imageDesc" column="imageDesc"/>
</collection>
</collection>
</resultMap>
<select id="selectQa"
resultMap="qaResultMap" parameterType="hotkidclub.model.qa.Qa">
SELECT q.`key`, q.`name`, q.`description`, q.`activityKey`, q.`isCpn`, q.`cpnKey`,q.isAd,q.adid, q.`isActive`,a.`key` as a_key,a.`activityKey` as a_activityKey, a.`quesId` as a_quesId, a.`title` as a_title, a.`typeName` as a_typeName, a.`tagKey` as a_tagKey,v.`key` as v_key,v.actKey as v_actKey,v.valueId as v_valueId,v.text as v_text,v.image as v_image,v.imageDesc as v_imageDesc,p.totalCount as p_totalCount,p.tagsValue as p_tagsValue,p.tagsType as p_tagsType,p.tags as p_tags,p.sendAtStart as p_sendAtStart,p.sendAtLast as p_sendAtLast,p.qaKey as p_qaKey,p.`key` as p_key,p.isTime as p_isTime,p.groupName as p_groupName
from hotkidclub_qna.qa q left join hotkidclub_qna.qa_activity a on q.`key`=a.qaKey and a.isDelete = 0 left join hotkidclub_qna.qa_activity_value v on a.`key`=v.actKey left join hotkidclub_qna.qa_ppl_setting p on q.`key` = p.qaKey
WHERE q.`key`=#{key}
</select>