<?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.cf.imes.module.system.dal.mysql.permission.MenuMapper">
    <select id="selectListIn" resultType="com.cf.imes.module.system.dal.dataobject.permission.MenuDO">
        SELECT
        m.id,
        <if test="language != null">
            i.menu_name AS name,
        </if>
        <if test="language == null">
            m.name,
        </if>
        m.permission,
        m.type,
        m.sort,
        m.parent_id AS parentId,
        m.path,
        m.icon,
        m.component,
        m.component_name AS componentName,
        m.status,
        m.visible,
        m.keep_alive AS keepAlive,
        m.always_show AS alwaysShow,
        m.description,
        m.source_type AS sourceType
        FROM system_menu m
        <if test="language != null">
            LEFT JOIN system_menu_i18n i
            ON m.id = i.menu_id
            AND i.locale = #{language}
        </if>
        WHERE 1=1

        <if test="ids != null and !ids.isEmpty()">
            AND m.id IN
            <foreach collection="ids" item="id" open="(" separator="," close=")">
                #{id}
            </foreach>
        </if>

        <if test="isManage">
            AND m.source_type != '${@com.cf.imes.module.system.enums.permission.MenuSourceTypeEnum@PRODUCTION.type}'
        </if>
        <if test="!isManage">
            AND (
            m.source_type IS NULL
            OR m.source_type != '${@com.cf.imes.module.system.enums.permission.MenuSourceTypeEnum@MANAGEMENT.type}'
            )
        </if>
    </select>
</mapper>