Mybaits多表查詢,關聯多張表

一、用戶表,角色表,用戶角色關聯表java

二、實體類設置對應關係sql

用戶表xml

uerid;對象

角色表Entity;ci

三、用戶map.xml配置it

<resultMap id="BaseResultMap" type="用戶Entity" >io

<association property="角色表Entity" javaType="角色表DAO.selectByPrimaryKey" column="user_id">
  </association>配置

</resultMap>select

四、角色map.xml配置sso

<select id="selectByPrimaryKey">

sql文=查詢角色表和用戶角色關聯表,條件是用戶id

</select>

五、結果展現對象包含角色對象

相關文章
相關標籤/搜索