标签:
sql
-- 表a ta (id,aname,bid) -- 表b tb (id,bname) SELECT T1.*, T2.BNAME FROM TA T1 LEFT JOIN TB T2 ON T1.BID = T2.ID
xml
<resultMap id="BaseResultMap" type="com.zxg.pojo.Ta" > <id column="ID" property="id" jdbcType="CHAR" /> <result column="ANAME" property="aName" jdbcType="VARCHAR" /> <association column="BID" property="bName" select="com.zxg.dao.TbMapper.getTbNameById"/> </resultMap>
<select id="getTbNameById" resultType="java.lang.String" parameterType="java.lang.String" > SELECT BNAME FROM TB WHERE ID = #{id} </select>
association 传多个参数
<association column="{key1=COL1,key2=COL2}" property="pro" select="mapper.method"/>
标签:
原文地址:http://www.cnblogs.com/zno2/p/4488312.html