guoyuji
2024-07-17 c395b0bda650f94bc25bf1fcf8f50abae5b0966f
north-glass-erp/src/main/resources/mapper/userInfo/PermissionBasicMapper.xml
@@ -4,26 +4,30 @@
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.example.erp.mapper.userInfo.PermissionBasicMapper">
    <select id="getPermission">
        select a.*,
               CASE
                   WHEN b.id IS NULL THEN 0
                   ELSE 1
                END as 'checked'
        select a.id,
        <if test="lang=='en'">
               a.menu,
        </if>
        <if test="lang=='zh'">
               c.itemName as menu,
        </if>
               a.page,
               a.permission,
               a.state,
        IF(b.id IS NULL, 0, 1) as 'checked'
        from permission_basic as a
        left join permission_role as b
        on a.id = b.permission_id
        left join user_role as c
        on b.role_id = c.role_id
        left join user as d
        on c.user_id = d.id
        and d.id = #{userId}
        where
            a.id!=1
            and a.state=1
        on b.permission_id = a.id
        and b.role_id = #{roleId}
        <if test="lang=='zh'">
            left join sys_menu_item as c
            on c.menu = a.menu
        </if>
        where a.id!=1 and a.state=1
        <if test="id != null and id != ''">
            and a.page = (select page from permission_basic where id = #{id})
        </if>
        group by a.id
    </select>
    
@@ -35,7 +39,6 @@
                <if test="lang=='en'">
                    a.menu
                </if>
        from permission_basic as a
        left join sys_menu_item as b
        on a.menu = b.menu
@@ -46,12 +49,16 @@
    <select id="selectTowLevel">
        select
            id as value,
            page as value,
            page as label
        from permission_basic
        where id!=1 and state=1
        group by  menu
        where
          state=1
          and menu = (select menu from permission_basic where id = #{id})
        group by page
    </select>
</mapper>