Mybatis 中 columnPrefix别名的用法
1.映射对应的属性,区分他们分别属于哪些类。(sql书写的时候为什么要将前缀加上(别名),是因为便于它去寻找哪个类的前缀是ANNEX_)
2.例: 如下所示当一个collection 定义了一个columnPrefix时,其含义是将ANNEX_前缀自动添加到它下面的column中,为其弥上需要的前缀,(ANNEX_ID,ANNEX_ANNEX,ANNEX_ANNEXNAM)
___________________________________________________________________________________________________________
<collection property="brandnoticeannexes" ofType="com.hyphone.brand.entity.BrandNoticeAnnex" columnPrefix="ANNEX_">
<id property="id" column="ID"/> (ANNEX_ID)
<result property="annex" column="ANNEX"/> (ANNEX_ANNEX)
<result property="annexname" column="ANNEXNAME"/> (ANNEX_ANNEXNAME)
</collection>
<select id="getLocalNoticeById" resultMap="brandnoticeannexes">
SELECT
NA.ID ANNEX_ID,
NA.ANNEX ANNEX_ANNEX,
NA.ANNEXNAME ANNEX_ANNEXNAME
FROM U_USER
</select >
___________________________________________________________________________________________________________