<?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.hssx.pcbms.mapper.SysFunctionMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.hssx.pcbms.entity.SysFunction">
        <id column="id" property="id" />
        <result column="name" property="name" />
        <result column="icon" property="icon" />
        <result column="code" property="code" />
        <result column="module_id" property="moduleId" />
        <result column="seq" property="seq" />
        <result column="use_state" property="useState" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, name, icon, code, module_id, seq, use_state
    </sql>
    <select id="selectFunctionsBycondition" resultMap="BaseResultMap">
        select
        sf.id, sf.name, sf.icon, sf.code, sf.module_id, sf.seq, sf.use_state
        from
            sys_function sf
        left join sys_role_function srf
        on sf.id = srf.function_id
        <where>
            srf.role_id in
            <foreach collection="ids" index="index" open="(" item="item" close=")" separator=",">
                #{item}
            </foreach>
        </where>
    </select>
</mapper>
