USE tmerclub_job;
INSERT  INTO `xxl_job_info`(`job_group`,`job_desc`,`add_time`,`update_time`,`author`,`alarm_email`,`schedule_type`,`schedule_conf`,`misfire_strategy`,`executor_route_strategy`,`executor_handler`,`executor_param`,`executor_block_strategy`,`executor_timeout`,`executor_fail_retry_count`,`glue_type`,`glue_source`,`glue_remark`,`glue_updatetime`,`child_jobid`,`trigger_status`,`trigger_last_time`,`trigger_next_time`) VALUES
(2,'发放退款','2023-09-07 09:16:24','2023-09-07 11:35:33','admin','','CRON','0 0/1 * * * ?','DO_NOTHING','FIRST','refundRequest','','SERIAL_EXECUTION',0,0,'BEAN','','GLUE代码初始化','2023-09-07 09:16:24','',1,1694068500000,1694068560000),
(2,'支付宝退款订单查单','2023-09-07 09:16:50','2023-09-07 11:15:16','admin','','CRON','0 0/1 * * * ?','DO_NOTHING','FIRST','updateAliPayRefundStatus','','SERIAL_EXECUTION',0,0,'BEAN','','GLUE代码初始化','2023-09-07 09:16:50','',1,1694068500000,1694068560000);



# 订单支付记录添加支付的系统类型字段

USE tmerclub_payment_0;

DELIMITER //
DROP PROCEDURE
    IF
    EXISTS createTable // CREATE PROCEDURE createTable () BEGIN
	DECLARE
i INT;

	SET i = 0;
	WHILE
i < 64 DO

			SET @set_pay_info_id = CONCAT( 'ALTER TABLE pay_info_', i, " ADD COLUMN `system_model` tinyint DEFAULT NULL COMMENT '支付的系统类型 1:pc  2:h5  3:小程序 4:安卓  5:ios'
			" );
PREPARE set_pay_info_id
    FROM
    @set_pay_info_id;
EXECUTE set_pay_info_id;

SET i = i + 1;

END WHILE;

END // CALL createTable ()//

DELIMITER;

USE tmerclub_payment_1;

DELIMITER //
DROP PROCEDURE
    IF
    EXISTS createTable // CREATE PROCEDURE createTable () BEGIN
    DECLARE
i INT;

    SET i = 0;
    WHILE
i < 64 DO

            SET @set_pay_info_id = CONCAT( 'ALTER TABLE pay_info_', i, " ADD COLUMN `system_model` tinyint DEFAULT NULL COMMENT '支付的系统类型 1:pc  2:h5  3:小程序 4:安卓  5:ios'
			" );
PREPARE set_pay_info_id
    FROM
    @set_pay_info_id;
EXECUTE set_pay_info_id;

SET i = i + 1;

END WHILE;

END // CALL createTable ()//

DELIMITER;

USE tmerclub_payment_2;

DELIMITER //
DROP PROCEDURE
    IF
    EXISTS createTable // CREATE PROCEDURE createTable () BEGIN
    DECLARE
i INT;

    SET i = 0;
    WHILE
i < 64 DO

            SET @set_pay_info_id = CONCAT( 'ALTER TABLE pay_info_', i, " ADD COLUMN `system_model` tinyint DEFAULT NULL COMMENT '支付的系统类型 1:pc  2:h5  3:小程序 4:安卓  5:ios'
			" );
PREPARE set_pay_info_id
    FROM
    @set_pay_info_id;
EXECUTE set_pay_info_id;

SET i = i + 1;

END WHILE;

END // CALL createTable ()//

DELIMITER;

USE tmerclub_payment_3;

DELIMITER //
DROP PROCEDURE
    IF
    EXISTS createTable // CREATE PROCEDURE createTable () BEGIN
    DECLARE
i INT;

    SET i = 0;
    WHILE
i < 64 DO

            SET @set_pay_info_id = CONCAT( 'ALTER TABLE pay_info_', i, " ADD COLUMN `system_model` tinyint DEFAULT NULL COMMENT '支付的系统类型 1:pc  2:h5  3:小程序 4:安卓  5:ios'
			" );
PREPARE set_pay_info_id
    FROM
    @set_pay_info_id;
EXECUTE set_pay_info_id;

SET i = i + 1;

END WHILE;

END // CALL createTable ()//

DELIMITER;

USE tmerclub_payment_4;

DELIMITER //
DROP PROCEDURE
    IF
    EXISTS createTable // CREATE PROCEDURE createTable () BEGIN
    DECLARE
i INT;

    SET i = 0;
    WHILE
i < 64 DO

            SET @set_pay_info_id = CONCAT( 'ALTER TABLE pay_info_', i, " ADD COLUMN `system_model` tinyint DEFAULT NULL COMMENT '支付的系统类型 1:pc  2:h5  3:小程序 4:安卓  5:ios'
			" );
PREPARE set_pay_info_id
    FROM
    @set_pay_info_id;
EXECUTE set_pay_info_id;

SET i = i + 1;

END WHILE;

END // CALL createTable ()//

DELIMITER;

USE tmerclub_payment_5;

DELIMITER //
DROP PROCEDURE
    IF
    EXISTS createTable // CREATE PROCEDURE createTable () BEGIN
    DECLARE
i INT;

    SET i = 0;
    WHILE
i < 64 DO

            SET @set_pay_info_id = CONCAT( 'ALTER TABLE pay_info_', i, " ADD COLUMN `system_model` tinyint DEFAULT NULL COMMENT '支付的系统类型 1:pc  2:h5  3:小程序 4:安卓  5:ios'
			" );
PREPARE set_pay_info_id
    FROM
    @set_pay_info_id;
EXECUTE set_pay_info_id;

SET i = i + 1;

END WHILE;

END // CALL createTable ()//

DELIMITER;

USE tmerclub_payment_6;

DELIMITER //
DROP PROCEDURE
    IF
    EXISTS createTable // CREATE PROCEDURE createTable () BEGIN
    DECLARE
i INT;

    SET i = 0;
    WHILE
i < 64 DO

            SET @set_pay_info_id = CONCAT( 'ALTER TABLE pay_info_', i, " ADD COLUMN `system_model` tinyint DEFAULT NULL COMMENT '支付的系统类型 1:pc  2:h5  3:小程序 4:安卓  5:ios'
			" );
PREPARE set_pay_info_id
    FROM
    @set_pay_info_id;
EXECUTE set_pay_info_id;

SET i = i + 1;

END WHILE;

END // CALL createTable ()//

DELIMITER;

USE tmerclub_payment_7;

DELIMITER //
DROP PROCEDURE
    IF
    EXISTS createTable // CREATE PROCEDURE createTable () BEGIN
    DECLARE
i INT;

    SET i = 0;
    WHILE
i < 64 DO

            SET @set_pay_info_id = CONCAT( 'ALTER TABLE pay_info_', i, " ADD COLUMN `system_model` tinyint DEFAULT NULL COMMENT '支付的系统类型 1:pc  2:h5  3:小程序 4:安卓  5:ios'
			" );
PREPARE set_pay_info_id
    FROM
    @set_pay_info_id;
EXECUTE set_pay_info_id;

SET i = i + 1;

END WHILE;

END // CALL createTable ()//

DELIMITER;

# 添加微信发货配置
USE tmerclub_admin;

INSERT INTO `sys_config`(`create_time`, `update_time`, `param_key`, `param_value`, `remark`) VALUES ('2023-01-31 09:16:47', '2023-09-08 15:51:23', 'WECHAT_SHIPPING_CONFIG', '{\"wechatShippingAudit\":false}', '微信发货配置');


USE `tmerclub_leaf`;
INSERT INTO leaf_alloc ( biz_tag, max_id, step, update_time, description, random_step )
VALUE ( 'tmerclub-purchase-amount-log', 1, 1000, NOW(), '采购金额日志id', 10 );

# 采购金额日志菜单补充
USE `tmerclub_auth`;
# menu_id=322, 464分别为商家和供应的'店铺结算'
DELETE FROM `menu` WHERE `menu_id` IN (322, 464);

INSERT INTO `menu`(`menu_id`, `create_time`, `update_time`, `parent_id`, `biz_type`, `permission`, `path`, `component`, `redirect`, `always_show`, `hidden`, `name`, `title`, `icon`, `no_cache`, `breadcrumb`, `affix`, `active_menu`, `seq`)
VALUES
    (663, '2023-08-31 16:36:36', '2023-09-01 15:30:48', 0, 1, NULL, '/finance', 'Layout', NULL, NULL, 0, '财务', '财务', 'financial', NULL, NULL, NULL, NULL, 10),
    (664, '2023-08-31 16:37:06', '2023-09-01 15:29:32', 663, 1, NULL, 'finance-purchase-settlement', 'finance/purchase-settlement', NULL, NULL, 0, '采购结算', '采购结算', '', NULL, NULL, NULL, NULL, 1),
    (665, '2023-09-01 14:42:53', '2023-09-01 14:42:53', 663, 1, NULL, 'wallet-log', 'shop/wallet-log', NULL, NULL, 0, '财务结算', '财务结算', '', NULL, NULL, NULL, NULL, 0),
    (666, '2023-09-01 13:50:25', '2023-09-01 15:31:06', 0, 3, NULL, '/finance', 'Layout', NULL, NULL, 0, '财务', '财务', 'financial', NULL, NULL, NULL, NULL, 4),
    (667, '2023-09-01 13:52:09', '2023-09-01 15:29:15', 666, 3, NULL, 'supplier-walletLog', 'shop/wallet-log', NULL, NULL, 0, 'shop-walletLog', '财务结算', '', NULL, NULL, NULL, NULL, 0),
    (668, '2023-09-01 13:53:38', '2023-09-01 13:53:38', 666, 3, NULL, 'finance-purchase-settlement', 'finance/purchase-settlement', NULL, NULL, 0, '采购结算', '采购结算', '', NULL, NULL, NULL, NULL, 1);