日期:2014-05-20 浏览次数:20808 次
public class Disclosure
{
/**
* DISCLOSURE_ID:爆料信息id
*/
private long id;
/**
* 附件列表
*/
private List<Attachment> attachments;
}
<resultMap id="disclosureMap"
type="xxxx.Disclosure">
<id property="id" column="DISCLOSURE_ID" />
<collection property="attachments" column="DISCLOSURE_ID"
ofType="xxx.Attachment"
select="xxx.DisAttachmentMapper.getAttachmentsByDisclosureId">
</collection>
</resultMap>
<resultMap id="attachmentMap" type="xxx.Attachment">
<result property="attachmentId" column="DISCL_ATT_ID" />
<result property="attachmentUrl" column="ATTACHMENT_URL" />
</resultMap>
<select id="getAttachmentsByDisclosureId" parameterType="long" resultMap="attachmentMap">
select DISCL_ATT_ID,ATTACHMENT_URL from DISCLOSURE_ATTACHMENT where DISCLOSURE_ID =#{disclosureId}
</select>