-- 会员标签库管理菜单（挂在客户资料同级）
-- 页面路径：/lqMemberTag

INSERT INTO `base_module` (
    `F_Id`, `F_ParentId`, `F_Layers`, `F_EnCode`, `F_FullName`, `F_Icon`, `F_UrlAddress`,
    `F_Target`, `F_IsMenu`, `F_AllowExpand`, `F_IsPublic`, `F_AllowEdit`, `F_AllowDelete`,
    `F_SortCode`, `F_DeleteMark`, `F_EnabledMark`, `F_CreateTime`, `F_CreateUserId`, `F_Type`, `F_Category`, `F_Description`
)
SELECT
    '197007301600000002',
    kh.F_ParentId,
    kh.F_Layers,
    'lqMemberTag',
    '会员标签库',
    'el-icon-collection-tag',
    '/lqMemberTag',
    'iframe',
    1, 1, 0, 0, 0,
    IFNULL(kh.F_SortCode, 100) + 2,
    NULL, 1, NOW(), 'admin', 1, 1,
    '全公司共用会员自定义标签库；改名/改色/删除仅后台维护'
FROM `base_module` kh
WHERE kh.F_UrlAddress = '/lqKhxx'
  AND kh.F_DeleteMark IS NULL
  AND NOT EXISTS (
      SELECT 1 FROM `base_module` m
      WHERE m.F_UrlAddress = '/lqMemberTag' AND m.F_DeleteMark IS NULL
  )
LIMIT 1;
