-- FITO menu_info 에 매입 입금관리 + 재고이력 메뉴 추가 (사이드바 노출용)
-- 부모: 9000300 매입/입고
-- menu_info 는 unique constraint 없음 → WHERE NOT EXISTS 로 idempotent 처리

-- 기존 seq 재정렬 (안전하게 update)
UPDATE menu_info SET seq = '12' WHERE objid = '9000302' AND seq != '12';
UPDATE menu_info SET seq = '13' WHERE objid = '9000303' AND seq != '13';

-- 9000304 매입 입금관리
INSERT INTO menu_info (objid, menu_type, parent_obj_id, menu_name_kor, menu_name_eng, seq, menu_url, status, system_name, regdate)
SELECT '9000304', '1', '9000300', '매입 입금관리', 'Proc Payment', '11', '/m/admin/proc-payments', 'active', 'PMS', NOW()
WHERE NOT EXISTS (SELECT 1 FROM menu_info WHERE objid = '9000304');

UPDATE menu_info SET
  menu_name_kor = '매입 입금관리',
  menu_name_eng = 'Proc Payment',
  parent_obj_id = '9000300',
  seq = '11',
  menu_url = '/m/admin/proc-payments',
  status = 'active'
WHERE objid = '9000304';

-- 9000305 재고이력
INSERT INTO menu_info (objid, menu_type, parent_obj_id, menu_name_kor, menu_name_eng, seq, menu_url, status, system_name, regdate)
SELECT '9000305', '1', '9000300', '재고이력', 'Stock History', '14', '/m/admin/inventory/history', 'active', 'PMS', NOW()
WHERE NOT EXISTS (SELECT 1 FROM menu_info WHERE objid = '9000305');

UPDATE menu_info SET
  menu_name_kor = '재고이력',
  menu_name_eng = 'Stock History',
  parent_obj_id = '9000300',
  seq = '14',
  menu_url = '/m/admin/inventory/history',
  status = 'active'
WHERE objid = '9000305';
