<?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="jnpf.authority.mapper.FtbPermissionMigrateMapper">

    <select id="personnelMenuAuthorities" resultType="java.lang.String">
        SELECT DISTINCT b.F_AuthorityId FROM ftb_personnels_permissions a JOIN ftb_personnels_permission_user b ON a.F_Id = b.F_PermissionId
        where a.F_EnableMark = 0 and a.F_UserId IN
        <foreach item="item" index="index" collection="userIds" open="(" separator="," close=")">
            #{item}
        </foreach>
    </select>

    <select id="personnelMenu"
            resultType="jnpf.model.authority.vo.role.FtbPermissionPositionMenuVO$FtbPermissionPositionMenuInnerVO">
        SELECT
        F_Id AS menuId,
        F_ParentId AS parentId,
        F_AuthorityName as menuName
        FROM ftb_personnels_authoritys WHERE
        F_EnableMark = 0 and
        F_ModuleType = #{type}
    </select>

    <select id="getRoleList" resultType="java.util.Map">
        SELECT
            F_Id as id,
            F_FullName as `name`
        FROM
            base_role
        order by F_CreatorTime desc
    </select>

    <select id="characterCheckedMenusAndButtons" resultType="java.lang.String">
        SELECT F_ItemId FROM  `base_authorize` WHERE `F_ObjectId` = #{roleId} AND F_ObjectType = 'Role'
    </select>

    <select id="inquiryButton" resultType="jnpf.base.entity.ModuleButtonEntity">
        SELECT
        F_Id id,
        F_FullName fullName
        FROM
        `base_modulebutton`
        <where>
            `F_ModuleId` = #{moduleId}
            and f_enabledMark = 1
        </where>

        ORDER BY
        `F_SortCode` DESC

    </select>
</mapper>