标签:div prope rom and OLE 中间 sel rop res
先决条件一:多对多需要一种中间表建立连接关系;
先决条件二:多对多关系是由两个一对多关系组成的,一对多可以也可以用两种方式实现;
<resultMap type="TUser" id="userRoleInfo" extends="BaseResultMap"> <collection property="roles" ofType="TRole" columnPrefix="role_"> <result column="id" property="id" /> <result column="Name" property="roleName" /> <result column="note" property="note" /> </collection> </resultMap> <select id="selectUserRole" resultMap="userRoleInfo"> select a.id, a.user_name, a.real_name, a.sex, a.mobile, a.note, b.role_id, c.role_name, c.note role_note from t_user a, t_user_role b, t_role c where a.id = b.user_id AND b.role_id = c.id </select>
标签:div prope rom and OLE 中间 sel rop res
原文地址:https://www.cnblogs.com/qin1993/p/12017509.html