mybatis多表查詢時,怎麼添加別的表的屬性

使用association 屬性

<resultMap id="BaseResultMap" type="com.bean.Gradetable">
    <id column="gid" jdbcType="INTEGER" property="gid" />
    <result column="uid" jdbcType="INTEGER" property="uid" />
    <result column="math" jdbcType="INTEGER" property="math" />
    <result column="chinese" jdbcType="INTEGER" property="chinese" />
    <result column="english" jdbcType="INTEGER" property="english" />
    <result column="state" jdbcType="INTEGER" property="state" />
    <association property="usertable" javaType="com.bean.Usertable">
      <result column="uname" jdbcType="VARCHAR" property="uname" />
    </association>
  </resultMap>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章