<?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.cool.store.mapper.SysMenuMapper">

    <resultMap type="com.cool.store.entity.SysMenuDO"
               id="SysMenuDOResult">
        <result property="id" column="id"/>
        <result property="parentId" column="parent_id"/>
        <result property="code" column="code"/>
        <result property="name" column="name"/>
        <result property="alias" column="alias"/>
        <result property="path" column="path"/>
        <result property="perms" column="perms"/>
        <result property="source" column="source"/>
        <result property="sort" column="sort"/>
        <result property="category" column="category"/>
        <result property="action" column="action"/>
        <result property="platform" column="platform"/>
        <result property="remark" column="remark"/>
        <result property="type" column="type"/>
        <result property="target" column="target"/>
        <result property="component" column="component"/>
        <result property="icon" column="icon"/>
        <result property="menuType" column="menu_type"/>
        <result property="env" column="env"/>
        <result property="commonFunctionsIcon" column="common_functions_icon"/>
    </resultMap>

    <select id="selectMenuAll" resultMap="SysMenuDOResult">
        select
        id ,
        name ,
        parent_id ,
        code ,
        alias ,
        path ,
        perms ,
        source ,
        sort ,
        category ,
        action ,
        remark ,
        platform,
        type,
        target,
        component,
        icon,
        menu_type,
        env,
        common_functions_icon
        from sys_menu_v2
        <where>
            platform=#{platformType}
            <if test="list!=null and list.size>0">
                and parent_id in
                <foreach collection="list" item="parentId" open="(" close=")" separator=",">
                    #{parentId}
                </foreach>
            </if>
            <if test="env != null and env != ''">
                and (env = #{env} or env is null or env = '')
            </if>
        </where>
    </select>

    <select id="selectMenu" resultMap="SysMenuDOResult">
        select *
        from sys_menu_v2
        where id = #{id}
    </select>


</mapper>