<resultMap id="resuleMap" type="com.com.entity.xxx">
<id property="id" column="id"></id>
<result property="xxx" column="xxx"></result >
<result property="xxx" column="xxx"></result >
<association property="entity" column="entity_id" select="selectentityById"> </association > //@TableField(exist = false)
<collection property="entityList" column="id" javaType="ArrayList" select="selectentityById"> </collection>
</resultMap>
<select id="selectentityById" parameterType="String" resultType="com.com.entity.xxx" >
select * from xxx where xxx_id = #{xxxid}
</select>
<select id="selectentityById" parameterType="String" resultType="com.com.entity.xxx" >
select * from xxx where id = #{id}
</select>
——————————————————————————————————————————————————————
<resultMap id="resuleMap" type="com.com.entity.xxx">
<id property="id" column="id"></id>
<result property="xxx" column="xxx"></result >
<result property="xxx" column="xxx"></result >
<collection property="entityList" ofType="com.com.entity.xxx" > //@TableField(exist = false)
<id property="xxx_id" column="xxx_id"></id>
<result property="xxx" column="xxx"></result >
<result property="xxx" column="xxx"></result >
</collection>
</resultMap>
<select id="selectentityById" parameterType="String" resultType="resuleMap" >
select
ca.*,
ct.*,
ct.id as xxx_id
from
xxx ca
left join xxx ct on ca.id = ct.xxxid
where
id = #{id}
</select>
标签:xml,Mapper,ca,xxx,where,id,select,ct From: https://www.cnblogs.com/yuemw123/p/17903497.html