Mybatis.mapper--association--collection

发布时间 2023-06-20 10:01:31作者: 文白wb
Mybatis--association

①借助其它Mapper完成连表查询:

<association property="createUser" select="com.bd.dao.UserScInfoMapper.selectScUserNameById"
column="create_by">
</association>

说明:column是数据库字段,property为Java类属性。


②在本Mapper完成连表查询:
<collection property="nicInfoList"
ofType="com.bd.info.model.info.NicInfo"
column="{id=id, azId=az_id}" javaType="ArrayList" select="getNicInfoList">
</collection>

说明:
ofType为列表类型,javaType为返回类型,select为查询体。(column是数据库字段,property为Java类属性