<?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.usky.system.mapper.SysMobileTenantMenuMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.usky.system.domain.SysMobileTenantMenu">
        <id column="tenant_id" property="tenantId" />
        <result column="menu_id" property="menuId" />
        <result column="parent_id" property="parentId" />
        <result property="menuName" column="menu_name"/>
        <result column="menu_alias_name" property="menuAliasName" />
    </resultMap>

    <select id="getMobileTenantMenuList" resultMap="BaseResultMap">
        SELECT
            t.tenant_id,
            t.menu_id,
            m.parent_id,
            m.menu_name,
	        t.menu_alias_name
        FROM
            sys_mobile_menu m
                JOIN sys_mobile_tenant_menu t
        WHERE
            m.menu_id = t.menu_id
          AND m.menu_type IN ('M', 'C')
          AND m. STATUS = 0
          AND t.tenant_id=#{tenantId}
        ORDER BY
            t.tenant_id,
            t.menu_id
    </select>

</mapper>
