Newer
Older
huludao / src / main / resources / mapper / MenuRepository.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">

<mapper namespace="com.newfiber.api.pc.dao.MenusRepository">
        <resultMap id="menuMap" type="com.newfiber.api.pc.model.zhz.Menu">
            <id property="serial" column="serial"/>
            <result property="menuNo" column="menu_no"/>
            <result property="menuName" column="menu_name"/>
            <result property="menuValue" column="menu_value"/>
            <result property="menuGrade" column="menu_grade"/>
            <result property="menuGradeZn" column="menu_grade_zn"/>
            <result property="parentMenuId" column="parent_menu_id"/>
            <result property="menuState" column="menu_state"/>
            <result property="menuStateZn" column="menu_state_zn"/>
            <result property="menuType" column="menu_type"/>
            <result property="menuTypeZn" column="menu_type_zn"/>
            <result property="orderSort" column="order_sort"/>
            <result property="createTime" column="create_time"/>
            <result property="updateTime" column="update_time"/>
            <result property="remark" column="remark"/>
            <result property="menuIcons" column="menu_icons"/>
            <result property="iconsName" column="iconsName"/>
            <collection property="buttons" ofType="com.newfiber.api.pc.model.zhz.Buttons">
                <id property="serial" column="BSerial"/>
                <result property="buttonNo"  column="button_no"/>
                <result property="buttonName"  column="button_name"/>
                <result property="buttonStyle"  column="button_style"/>
                <result property="buttonEvent"  column="button_event"/>
                <result property="buttonGrade"  column="button_grade"/>
                <result property="buttonGradeZn"  column="button_grade_zn"/>
                <result property="orderSort"  column="BOrderSort"/>
                <result property="remark"  column="BRemark"/>
            </collection>
        </resultMap>

    <select id="selectMenuTree" resultMap="menuMap">
        select
            sm.*,
            sb.serial AS BSerial,
            sb.button_no,
            sb.button_style,
            sb.button_name,
            sb.button_event,
            sb.button_grade,
            sb.button_grade_zn,
            sb.order_sort as BOrderSort,
            sb.remark as BRemark
        from
         sys_menus sm
        LEFT JOIN
         sys_menu_button smb
        on sm.menu_no = smb.menu_no
        LEFT JOIN
            sys_buttons sb
        ON
            smb.button_no = sb.button_no
    </select>
</mapper>