【发布时间】:2018-07-01 13:41:41
【问题描述】:
这是我的 SQL 和 resultmap:
<resultMap id="playerMap" type="player">
<id column="playerId" property="id"/>
<result column="playerName" property="name"/>
<association property="team" javaType="Team">
<id column="teamId" property="id"/>
<result column="teamName" property="name"/>
</association>
</resultMap>
<select id="selectPlayerById" resultMap="playerMap">
select p.id playerId,p.name playerName,
t.name teamName,t.id teamId
from t_player p,t_team t
where p.tid=t.id and p.id=#{id}
</select>
这是我的结果:
但“玩家”一栏为空。如何更改我的 SQL 语句,以便该列可以查询多个玩家的信息?
【问题讨论】: