单实体中有多个一对多写法
<resultMap id="DataRoleVoMap" type="org.jeedp.system.domain.vo.DataRole" >
<id column="dataId" property="dataId" />
<result column="dataName" property="dataName" />
</resultMap>
<select id="listChildrenByParentId" resultMap="PermVoMap">
select id,name,url,parent_id from base_menu where parent_id=#{id} and status !=1 order by number
<select id="listDataRoleByMenuId" resultMap="DataRoleVoMap">
select id as dataId,rule_name as dataName from base_menu_data_rule where menu_id=#{id} and status =1
一对多中需传多个参数写法
<select id="listMenuByRoleByParentId" resultMap="MenuVo">
SELECT a.id
,a.parent_id
,a.view_path AS path, a.view_always_show
AS alwaysShow ,a.view_component
AS component , a.view_name
AS NAME, a.view_redirect
AS redirect ,
c.role_code AS role
FROM base_menu
a LEFT JOIN base_role_activity
b ON a.id
=b.menu_id
LEFT JOIN base_role
c ON b.role_id
=c.id
WHERE c.role_code
=#{roleId} AND a.parent_id
= #{parentId} and a.is_leaf=‘NO’ order by a.number desc