使用association来进行关联,配置select语句来完成
<mapper namespace="com.chen.mapper.KaoqinMapper">
<resultMap id="BaseResultMap" type="com.chen.entity.Kaoqin">
<id column="workId" jdbcType="INTEGER" property="workid" />
<result column="wordDate" jdbcType="TIMESTAMP" property="worddate" />
<result column="workTest" jdbcType="VARCHAR" property="worktest" />
<association property="userid" column="userId" select="queryUser"></association>
</resultMap>
<select id="queryUser" resultType="com.chen.entity.User" parameterType="INTEGER">
select * from user where userId=#{id}
</select>
</mapper>