常用脚本:数据库中插入一条id=0的记录.
1.首先插入为-1的id记录,
2.之后将id=-1数据修改为id=0
INSERT INTO `tb_restaurant`(`id`, `restaurant_name`, `restaurant_name_en`, `online_order_url`, `logo_image`, `logo_icon`, `description`, `description_en`, `is_available`, `is_deleted`, `create_by`, `update_by`, `auto_level`, `location_id`) VALUES (-1, 'All Locations', 'All Locations', '', '', '', 'All Locations', 'All Locations', 0, 0, '', '', 0, '');
UPDATE `tb_restaurant` SET id = 0 WHERE id = -1;
INSERT SELECT 语句
常用脚本 : 第二条sql取第一条的id
INSERT INTO `tb_permission`( `permission_name`, `permission_keys`, `resource_url`, `resource_icon`, `resource_type`, `resource_belong`, `resource_sort`, `parent_id`, `is_available`)
VALUES ( 'Customer Services', '', '/customerServices', '', 1, 0, 5100, 0, 1);
INSERT INTO `tb_permission`( `permission_name`, `permission_keys`, `resource_url`, `resource_icon`, `resource_type`, `resource_belong`, `resource_sort`, `parent_id`, `is_available`)
SELECT 'Return Refund', '', '/returnRefund', '', 1, 0, 5001,id, 1 from tb_permission WHERE permission_name='Customer Services';