<?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.muchinfo.mtp3interface.mapper.IFuncmenulistMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.muchinfo.mtp3pojos.entity.Funcmenulist">
        <id column="RESOURCECODE" property="resourcecode" />
        <result column="RESOURCENAME" property="resourcename" />
        <result column="RESOURCELEVEL" property="resourcelevel" />
        <result column="MENUTYPE" property="menutype" />
        <result column="PARENTCODE" property="parentcode" />
        <result column="URL" property="url" />
        <result column="SORT" property="sort" />
        <result column="ICONAME" property="iconame" />
        <result column="REMARK" property="remark" />
        <result column="AUTHTYPE" property="authtype" />
        <result column="URLTYPE" property="urltype" />
        <result column="COMPONENT" property="component" />
        <result column="BUTTONTYPE" property="buttontype" />
        <result column="HIDDEN" property="hidden" />
        <result column="BUTTONNAME" property="buttonname" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        RESOURCECODE, RESOURCENAME, RESOURCELEVEL, MENUTYPE, PARENTCODE, URL, SORT, ICONAME, REMARK, AUTHTYPE, URLTYPE, COMPONENT, BUTTONTYPE, HIDDEN, BUTTONNAME
    </sql>

    <select id="fingByAuthorities" resultMap="BaseResultMap" parameterType="java.util.List">
        select distinct
            ml.resourcecode,
            ml.resourcename,
            ml.resourcelevel,
            ml.parentcode,
            ml.url,
            ml.sort,
            ml.iconame,
            ml.menutype,
            ml.authtype,
            ml.urltype,
            ml.hidden,
            ml.buttontype,
            ml.component
        from RoleFuncMenu mlr, FuncMenuList ml
        where mlr.resourcecode = ml.resourcecode
        and ml.hidden = 1
        and mlr.RoleID in
        <foreach collection="stringList" item="item" separator="," open="(" close=")" index="index">
            #{item}
        </foreach>
        <if test="sysType != null and sysType != '' ">
            and ml.menutype = #{sysType}
        </if>
        order by ml.sort
    </select>

</mapper>
