INSERT INTO sys_permission (
    id, parent_id, permission_name, permission_i18n, permission_type, page_link,
    view_link, permission_code, event_name, class_name, icon_name, sort
) SELECT
    c.Id, c.ParentId, c.ChannelName, c.EventName,
    CASE
        WHEN c.IsMenuShow = 1 THEN 0
        WHEN c.IsMenuShow = 0 and (c.EventName = 'add' or c.EventName = 'import') THEN 1
        WHEN c.IsMenuShow = 0 and (c.EventName = 'enable' or c.EventName = 'disable') THEN 3
        ELSE 2
    END,
    c.EventName, c.ChannelLink, c.EventName, c.EventName,
    NULL, NULL, c.Sort
FROM yy_syschannel c;

