-- 商户充值模块权限（防重复 INSERT）

INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`)
SELECT 'business:ywcustomerrecharge:query', '查询商户充值', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0
WHERE NOT EXISTS (SELECT 1 FROM `SYSTEM_PERMISSION` WHERE `CODE` = 'business:ywcustomerrecharge:query' AND `DELETED` = 0);

INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`)
SELECT 'business:ywcustomerrecharge:exportExcel', '导出商户充值', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0
WHERE NOT EXISTS (SELECT 1 FROM `SYSTEM_PERMISSION` WHERE `CODE` = 'business:ywcustomerrecharge:exportExcel' AND `DELETED` = 0);

INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`)
SELECT 'business:ywcustomerrecharge:bindDevice', '关联设备', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0
WHERE NOT EXISTS (SELECT 1 FROM `SYSTEM_PERMISSION` WHERE `CODE` = 'business:ywcustomerrecharge:bindDevice' AND `DELETED` = 0);

INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`)
SELECT 'business:ywcustomerrecharge:recharge', '商户充值/清零', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0
WHERE NOT EXISTS (SELECT 1 FROM `SYSTEM_PERMISSION` WHERE `CODE` = 'business:ywcustomerrecharge:recharge' AND `DELETED` = 0);

INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`)
SELECT 'business:ywcustomerrechargerecord:query', '查询充值记录', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0
WHERE NOT EXISTS (SELECT 1 FROM `SYSTEM_PERMISSION` WHERE `CODE` = 'business:ywcustomerrechargerecord:query' AND `DELETED` = 0);

INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`)
SELECT 'business:ywcustomerrechargerecord:exportExcel', '导出充值记录', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0
WHERE NOT EXISTS (SELECT 1 FROM `SYSTEM_PERMISSION` WHERE `CODE` = 'business:ywcustomerrechargerecord:exportExcel' AND `DELETED` = 0);

INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`)
SELECT 'business:ywcustomerrechargerecord:retry', '再次提交充值', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0
WHERE NOT EXISTS (SELECT 1 FROM `SYSTEM_PERMISSION` WHERE `CODE` = 'business:ywcustomerrechargerecord:retry' AND `DELETED` = 0);

INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`)
SELECT 'business:ywcustomerrechargerecord:syncStatus', '手动同步充值状态', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0
WHERE NOT EXISTS (SELECT 1 FROM `SYSTEM_PERMISSION` WHERE `CODE` = 'business:ywcustomerrechargerecord:syncStatus' AND `DELETED` = 0);
