mybatis补充
程序员文章站
2022-05-11 12:06:24
...
- association用于一对一和多对一
<association property="userlist" javaType="Pojo.Userlist">
<!-- column:userlist表的主键对应的列 property:userlist对象中id属性-->
<id column="id" property="id"/>
<result column="name" property="name" jdbcType="VARCHAR" />
<result column="idcard" property="idcard" jdbcType="VARCHAR" />
<result column="phone" property="phone" jdbcType="VARCHAR" />
<result column="user_id" property="user_id" jdbcType="INTEGER" />
</association>
- collection用于一对多
<collection property="userlist" ofType="Pojo.Userlist">
<id property="id" column="id"/>
<!--用户id已经在user对象中存在,此处可以不设置-->
<!-- <result property="userId" column="id"/> -->
<result property="name" column="name"/>
<result property="idcard" column="idcard"/>
<result property="phone" column="phone"/>
<result property="user_id" column="user_id"/>
</collection>
上一篇: mybatis补充
下一篇: Docker Volume