USE yami_bbc;

INSERT INTO `tz_shop_menu` ( `menu_id`, `parent_id`, `url`, `perms`, `type`, `icon`, `order_num`, `hidden`, `router_name`, `sys_type` )
VALUES
    ( 1433, 880, '', '', 0, '', 2, 0, NULL, 3 ),
    ( 1434, 1433, 'stock/purchases/inbound/new', '', 1, '', 1, 1, NULL, 3 ),
    ( 1435, 1433, 'stock/purchases/inbound/list', '', 1, '', 1, 0, NULL, 3 ),
    ( 1436, 1435, '', 'shop:stockBillLog:purchaseInfo', 2, '', 0, 1, NULL, 3 ),
    ( 1437, 1435, '', 'shop:stockBillLog:purchasePage', 2, '', 0, 1, NULL, 3 ),
    ( 1438, 1435, '', 'purchase:purchaseOrder:import', 2, '', 0, 1, NULL, 3 ),
    ( 1439, 1435, '', 'purchase:purchaseOrder:downloadModel', 2, '', 0, 1, NULL, 3 ),
    ( 1440, 1435, '', 'purchase:purchasesInbound:info', 2, '', 0, 0, NULL, 3 ),
    ( 1441, 1433, 'stock/purchases/order/new', '', 1, '', 0, 1, NULL, 3 ),
    ( 1442, 1433, 'stock/purchases/order/list', '', 1, '', 0, 0, NULL, 3 ),
    ( 1443, 1442, '', 'purchase:purchaseOrder:export', 2, '', 0, 1, NULL, 3 ),
    ( 1444, 1442, '', 'purchase:purchaseOrder:import', 2, '', 0, 1, NULL, 3 ),
    ( 1445, 1442, '', 'purchase:purchaseOrder:downloadModel', 2, '', 0, 1, NULL, 3 ),
    ( 1446, 1442, '', 'purchase:purchaseOrder:page', 2, '', 0, 1, NULL, 3 ),
    ( 1447, 1442, '', 'purchase:purchaseOrder:info', 2, '', 0, 0, NULL, 3 ),
    ( 1448, 1442, '', 'purchase:purchaseOrder:complete', 2, '', 0, 0, NULL, 3 ),
    ( 1449, 1442, '', 'purchase:purchaseOrder:nullify', 2, '', 0, 0, NULL, 3 ),
    ( 1450, 1442, '', 'purchase:purchaseOrder:inbound', 2, '', 0, 0, NULL, 3 ),
    ( 1451, 1442, '', 'purchase:purchaseOrder:save', 2, '', 0, 0, NULL, 3 ),
    ( 1452, 880, '', '', 0, '', 3, 0, NULL, 3 ),
    ( 1453, 1452, 'stock/supplier/new-prod', '', 1, '', 0, 1, NULL, 3 ),
    ( 1454, 1453, '', 'multishop:supplierProd:downLoad', 2, '', 0, 0, NULL, 3 ),
    ( 1455, 1453, '', 'multishop:supplierProd:import', 2, '', 0, 0, NULL, 3 ),
    ( 1456, 1453, '', 'multishop:supplierProd:export', 2, '', 0, 0, NULL, 3 ),
    ( 1457, 1453, '', 'multishop:supplierProd:select', 2, '', 0, 0, NULL, 3 ),
    ( 1458, 1453, '', 'multishop:supplierProd:update', 2, '', 0, 0, NULL, 3 ),
    ( 1459, 1452, 'stock/supplier/prod', '', 1, '', 2, 0, NULL, 3 ),
    ( 1460, 1459, '', 'supplier:supplierProd:list,supplier:supplierProd:page,supplier:supplierProd:info', 2, '', 0, 1, NULL, 3 ),
    ( 1461, 1459, '', 'supplier:prod:edit', 2, '', 0, 0, NULL, 3 ),
    ( 1462, 1452, 'stock/supplier/category', '', 1, '', 1, 0, NULL, 3 ),
    ( 1463, 1462, '', 'shop:supplierCategory:page,shop:supplierCategory:list,shop:supplierCategory:info', 2, '', 0, 1, NULL, 3 ),
    ( 1464, 1462, '', 'multishop:supplierCategory:change', 2, '', 0, 0, NULL, 3 ),
    ( 1465, 1462, '', 'multishop:supplierCategory:update', 2, '', 0, 0, NULL, 3 ),
    ( 1466, 1462, '', 'multishop:supplierCategory:save', 2, '', 0, 0, NULL, 3 ),
    ( 1467, 1452, 'stock/supplier/info', '', 1, '', 0, 0, NULL, 3 ),
    ( 1468, 1467, '', 'supplier:supplier:syncSupplierToJst', 2, '', 0, 0, '', 3 ),
    ( 1469, 1467, '', 'supplier:supplier:page,supplier:supplier:list,supplier:supplier:info', 2, '', 0, 1, NULL, 3 ),
    ( 1470, 1467, '', 'admin:area:list', 2, '', 0, 1, NULL, 3 ),
    ( 1471, 1467, '', 'supplier:supplier:downLoad', 2, '', 0, 0, NULL, 3 ),
    ( 1472, 1467, '', 'supplier:supplier:export', 2, '', 0, 0, NULL, 3 ),
    ( 1473, 1467, '', 'supplier:supplier:import', 2, '', 0, 0, NULL, 3 ),
    ( 1474, 1467, '', 'supplier:supplier:update', 2, '', 0, 0, NULL, 3 ),
    ( 1475, 1467, '', 'supplier:supplier:save', 2, '', 0, 0, NULL, 3 );

INSERT INTO `tz_shop_menu_lang` ( `menu_id`, `lang`, `name` )
VALUES
	( 1433, 0, '采购管理' ),
	( 1433, 1, 'Purchases Manage' ),
	( 1434, 0, '新建采购库存' ),
	( 1434, 1, 'New Purchases Inbound' ),
	( 1435, 0, '采购库存' ),
	( 1435, 1, 'Purchases Inbound' ),
	( 1436, 0, '获取详情' ),
	( 1436, 1, 'Get details' ),
	( 1437, 0, '分页查询' ),
	( 1437, 1, 'paging query' ),
	( 1438, 0, '导入' ),
	( 1438, 1, 'Import' ),
	( 1439, 0, '下载模板' ),
	( 1439, 1, 'Download template' ),
	( 1440, 0, '详情' ),
	( 1440, 1, 'Info' ),
	( 1441, 0, '新建采购订单' ),
	( 1441, 1, 'Add Purchases Order' ),
	( 1442, 0, '采购订单' ),
	( 1442, 1, 'Purchases Order' ),
	( 1443, 0, '导出' ),
	( 1443, 1, 'export' ),
	( 1444, 0, '导入采购商品excel' ),
	( 1444, 1, 'Import the purchased product excel' ),
	( 1445, 0, '下载模板' ),
	( 1445, 1, 'Download template' ),
	( 1446, 0, '分页查询' ),
	( 1446, 1, 'paging query' ),
	( 1447, 0, '详情' ),
	( 1447, 1, 'Info' ),
	( 1448, 0, '完成' ),
	( 1448, 1, 'Complete' ),
	( 1449, 0, '作废' ),
	( 1449, 1, 'Nullify' ),
	( 1450, 0, '入库' ),
	( 1450, 1, 'Inbound' ),
	( 1451, 0, '新建采购订单' ),
	( 1451, 1, 'Add purchase order' ),
	( 1452, 0, '供应商管理' ),
	( 1452, 1, 'Supplier Manage' ),
	( 1453, 0, '编辑供应商商品' ),
	( 1453, 1, 'Edit Supplier Product' ),
	( 1454, 0, '下载模板' ),
	( 1454, 1, 'Download template' ),
	( 1455, 0, '导入' ),
	( 1455, 1, 'Import' ),
	( 1456, 0, '导出' ),
	( 1456, 1, 'Export' ),
	( 1457, 0, '添加商品' ),
	( 1457, 1, 'Add product' ),
	( 1458, 0, '确定' ),
	( 1458, 1, 'Confirm' ),
	( 1459, 0, '供应商商品' ),
	( 1459, 1, 'Supplier Product' ),
	( 1460, 0, '查询' ),
	( 1460, 1, 'query' ),
	( 1461, 0, '编辑' ),
	( 1461, 1, 'Edit' ),
	( 1462, 0, '供应商分类' ),
	( 1462, 1, 'Supplier Category' ),
	( 1463, 0, '查询' ),
	( 1463, 1, 'query' ),
	( 1464, 0, '禁用/启用' ),
	( 1464, 1, 'disable/enable' ),
	( 1465, 0, '修改' ),
	( 1465, 1, 'Modify' ),
	( 1466, 0, '新增' ),
	( 1466, 1, 'Add' ),
	( 1467, 0, '供应商资料' ),
	( 1467, 1, 'Supplier information' ),
	( 1468, 0, '批量同步供应商到聚水潭' ),
	( 1468, 1, 'Batch synchronization of suppliers to Jushuitan' ),
	( 1469, 0, '查询' ),
	( 1469, 1, 'query' ),
	( 1470, 0, '获取地址列表' ),
	( 1470, 1, 'Get address list' ),
	( 1471, 0, '下载模板' ),
	( 1471, 1, 'Download Template' ),
	( 1472, 0, '导出' ),
	( 1472, 1, 'Export' ),
	( 1473, 0, '导入' ),
	( 1473, 1, 'Import' ),
	( 1474, 0, '修改' ),
	( 1474, 1, 'Modify' ),
	( 1475, 0, '新增' ),
	( 1475, 1, 'Add' );

-- 更新菜单顺序
UPDATE tz_shop_menu
SET order_num = 4
WHERE
	menu_id = 935;

UPDATE tz_shop_menu
SET order_num = 5
WHERE
	menu_id = 897;

-- 供应商新增字段
ALTER TABLE `tz_supplier`
ADD COLUMN `station_id` bigint(0) NULL DEFAULT 0 COMMENT '门店id' AFTER `shop_id`;

-- 门店补充自采供应商
INSERT INTO tz_supplier ( `shop_id`, `station_id`, `supplier_name`, `status`, `is_default`, `create_time` )
SELECT
    `shop_id`, `station_id`, '自采供应商', 1, 1, NOW()
FROM
	tz_station;

-- 供应商分类新增字段
ALTER TABLE `tz_supplier_category`
ADD COLUMN `station_id` bigint(0) NULL DEFAULT 0 COMMENT '门店id' AFTER `shop_id`;

-- 采购订单新增字段
ALTER TABLE `tz_purchase_order`
ADD COLUMN `station_id` bigint(0) NULL DEFAULT 0 COMMENT '门店id' AFTER `shop_id`;

-- 更新菜单顺序
UPDATE tz_shop_menu
SET order_num = 3
WHERE
    menu_id = 33;

UPDATE tz_shop_menu
SET order_num = 2
WHERE
    menu_id = 184;

UPDATE tz_shop_menu
SET order_num = 2
WHERE
    menu_id = 206;

UPDATE tz_shop_menu
SET order_num = 1
WHERE
    menu_id = 767;
