日期:2014-05-17 浏览次数:21103 次
<resultMap class="menu" id="menuResult">
        <result column="MENUID" property="menuId" />
        <result column="MENUNAME" property="menuName" />
        <result column="TYPE" property="type" />
        <result column="ACTIONID" property="action" select="menu.getActionById" />
        <result column="PARENTID" property="parentId" />
        <result column="SORTORDER" property="sortOrder" />
        <result column="REMARK" property="remark" />
    </resultMap>
    <select id="getMenu" resultMap="menuResult">
        select * from sys_menu
        <dynamic prepend="where">
            <isNotEmpty property="menu.menuId" prepend="and">
                menuId=#menu.menuId#
            </isNotEmpty>
            <isNotEmpty property="menu.parentId" prepend="and">
                parentId=#menu.parentId#
            </isNotEmpty>
            <isNotEmpty property="roleList" prepend="and">
                exists (select id from sys_rolemenu where
                sys_rolemenu.menuid=sys_menu.menuid
                <iterate property="roleList" prepend="and" open="(" close=")"
                    conjunction="or">
                    roleid=#roleList[].roleId#
                </iterate>
                )
            </isNotEmpty>
        </dynamic>
        order by sortOrder
    </select>