一、MySQL通过存储过程插入数据,多表并且数据有关联
– 造供应商的数据
CREATE PROCEDURE cabinetoutstock
(in num int )
BEGIN
declare i int;
set i = 13001;
while i < 14001 do – CONCAT(‘rp1000001’,i)
INSERT INTO recf
.tbl_auth_entity
( id
, code
, auth_time
, auth_type
, time_create
, time_update
, auth_status
, name
, social_credit_code
) VALUES ( CONCAT(‘E99205’, i), CONCAT(‘2785’, i), NOW(), ‘Enterprise’, NOW(), NOW(), ‘1’, CONCAT(‘上海世通’, i), CONCAT(‘91440101727XL’, i) );
INSERT INTO recf
.tbl_auth_entity_info
( id
, name
, entity_id
, core_entity_id
, social_credit_code
, invitation_code
, enterprise_type
, registered_address
, enterprise_mail
, business_licence
, business_licence_pic
, business_licence_type
, business_licence_due_date_type
, business_licence_due_date
, account_name
, account_card_number
, account_open_bank
, account_bank_branch
, account_bank_uuid
, account_permits_pic
, legal_person_mobile
, legal_person_name
, legal_person_certificate_type
, legal_person_id_number
, legal_person_id_pic_1
, time_create
, time_update
, refer_code
, enterprise_id
, legal_person_id_pic_2
) VALUES ( CONCAT( ‘70f0a42705df11e99b02ecebb88’, i ), CONCAT(‘上海世通’, i), CONCAT(‘E99205’, i), ‘E0514945277’, CONCAT(‘91440101727XL’, i), ‘V4SA2’, ‘’, ‘EQABUibFVL90k9giaFeRNdTY1he56zNBde7tqPFErS4aSEVjf5nexaMAGjatIgNVI0SVc3Io3Ox5bjDVcZaEK6VZweMUd4x5hTevx0qi3JcDbkWO’, ‘EQABUrc%2FHdfZhPmR8hzAuY3I97yRflvvCjpAAC%2FX41tNH9zf’, ‘’, ‘/enterprise-web-oapi/platform/image/preview/e6b04543155111eead9f02020acf6cf0’, ‘MERGED’, ‘LONG_TERM’, ‘0001-01-01 00:00:00’, CONCAT(‘上海世通’, i), ‘EQABUg0dRGT5v1T%2Bm1mN1t9uBVIUOXQHZm5KXybwF02lfuV4’, ‘CMB’, ‘招商银行股份有限公司北京建国路支行’, ‘308100005176’, ‘/enterprise-web-oapi/platform/image/preview/b934600350d711eb89a6525400a81b4a’, ‘EQABUuGQ1ed60eUB8LsteVrpTKY%3D’, ‘陈丽娜’, ‘ID_CARD’, ‘EQABUvnOU%2FGlTw2OD8qB3Q1WTli2V5z3H2ogej87tAqXCqr9’, ‘/enterprise-web-oapi/platform/image/preview/e6bdd9d4155111eead9f02020acf6cf0’, NOW(), NOW(), ‘454565’, CONCAT(‘E2022112500000’, i), ‘/enterprise-web-oapi/platform/image/preview/e6be7615155111eead9f02020acf6cf0’ );
INSERT INTO recf
.tbl_auth_entity_relation
( id
, name
, entity_id
, core_entity_id
, relation_type
, entity_type
, time_create
, time_update
) VALUES ( CONCAT( ‘0bfd82f7a8d011eca684525400a’, i ), CONCAT(‘上海世通’, i), CONCAT(‘E99205’, i), CONCAT(‘E88101’, i), ‘ChainCompany’, ‘Enterprise’, NOW(), NOW() );
INSERT INTO recf
.tbl_auth_entity_type
( id
, entity_id
, entity_type
, time_update
, time_create
) VALUES ( CONCAT( ‘70f210c3-05df-11e9-9b02-ecebb88’, i ), CONCAT(‘E99205’, i), ‘CHAIN’, NOW(), NOW() );
INSERT INTO recf
.tbl_auth_entity_edit_draft
( id
, invitation_code
, core_entity_id
, name
, registered_address
, enterprise_mail
, org_code
, social_credit_code
, id_number
, entity_id
, business_licence
, business_licence_pic
, business_licence_type
, business_licence_due_date_type
, business_licence_due_date
, enterprise_type
, parent_company_name
, account_name
, account_card_number
, account_open_bank
, account_bank_branch
, account_bank_uuid
, account_permits_pic
, legal_person_mobile
, legal_person_name
, legal_person_certificate_type
, legal_person_id_number
, legal_person_id_pic_1
, legal_person_id_pic_2
, status
, agent_mobile
, agent_name
, agent_id_number
, agent_mail
, agent_id_pic_1
, agent_id_pic_2
, agent_hold_pic
, operator_mail
, operator_hold_pic
, operator_authorizing_pic
, approver_authorizing_pic
, agent_authorizing_pic
, auth_type
, time_create
, time_update
, operator_mobile
, operator_name
, operator_certificate_type
, operator_id_number
, approver_mobile
, approver_name
, approver_certificate_type
, approver_id_number
, approver_mail
, approver_hold_pic
, approver_id_pic_1
, approver_id_pic_2
, operator_id_pic_1
, operator_id_pic_2
, operator_edit_type
, approver_edit_type
, refer_code
, enterprise_id
) VALUES ( CONCAT(‘20230814948’, i), ‘L2VRJ’, ‘’, CONCAT(‘上海世通’, i), ‘EQABUibFVL90k9giaFeRNdTY1he56zNBde7tqPFErS4aSEVjf5nexaMAGjatIgNVI0SVc3Io3Ox5bjDVcZaEK6VZweMUd4x5hTevx0qi3JcDbkWO’, ‘EQABUrc%2FHdfZhPmR8hzAuY3I97yRflvvCjpAAC%2FX41tNH9zf’, CONCAT(‘2785’, i), CONCAT(‘91440101727XL’, i), ‘’, CONCAT(‘E99205’, i), ‘’, ‘/enterprise-web-oapi/platform/image/preview/e6b04543155111eead9f02020acf6cf0’, ‘’, ‘’, ‘0001-01-01 00:00:00’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘EQABUuGQ1ed60eUB8LsteVrpTKY%3D’, ‘陈丽娜’, ‘ID_CARD’, ‘EQABUvnOU%2FGlTw2OD8qB3Q1WTli2V5z3H2ogej87tAqXCqr9’, ‘/enterprise-web-oapi/platform/image/preview/e6bdd9d4155111eead9f02020acf6cf0’, ‘/enterprise-web-oapi/platform/image/preview/e6be7615155111eead9f02020acf6cf0’, ‘AUTH_SUCC’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘EQABUuJCv6VYe2FBmDjKwvnCIJD%2Bi511icbyrtopiRLs0PKW’, ‘/enterprise-web-oapi/platform/image/preview/e6cf8d18155111eead9f02020acf6cf0’, ‘/enterprise-web-oapi/platform/image/preview/e6d00249155111eead9f02020acf6cf0’, ‘/enterprise-web-oapi/platform/image/preview/e6de331d155111eead9f02020acf6cf0’, ‘’, ‘CHAIN’, NOW(), NOW(), ‘EQABUgPAe%2FLswmG3tyCHh42mdJ8%3D’, ‘王凯’, ‘ID_CARD’, ‘EQABUq79NkpWbK8LT2WDHDMHyjgS2oloFE7NnEnvhkOHaRuF’, ‘EQABUgPAe%2FLswmG3tyCHh42mdJ8%3D’, ‘王凯’, ‘ID_CARD’, ‘EQABUq79NkpWbK8LT2WDHDMHyjgS2oloFE7NnEnvhkOHaRuF’, ‘EQABUql6PB3gaTKlwppPE3WjPHSk9tN55Kbugjq7xMncSw8G’, ‘/enterprise-web-oapi/platform/image/preview/e6ddbdec155111eead9f02020acf6cf0’, ‘/enterprise-web-oapi/platform/image/preview/e6d0777a155111eead9f02020acf6cf0’, ‘/enterprise-web-oapi/platform/image/preview/e6dc5e5b155111eead9f02020acf6cf0’, ‘/enterprise-web-oapi/platform/image/preview/e6cd6a36155111eead9f02020acf6cf0’, ‘/enterprise-web-oapi/platform/image/preview/e6cf17e7155111eead9f02020acf6cf0’, ‘CHANGE’, ‘CHANGE’, ‘’, CONCAT(‘E2022112500000’, i) );
INSERT INTO recf
.tbl_auth_entity_draft
( id
, invitation_code
, core_entity_id
, name
, registered_address
, enterprise_mail
, org_code
, social_credit_code
, id_number
, entity_id
, business_licence
, business_licence_pic
, business_licence_type
, business_licence_due_date_type
, business_licence_due_date
, enterprise_type
, parent_company_name
, account_name
, account_card_number
, account_open_bank
, account_bank_branch
, account_bank_uuid
, account_voucher_pic
, account_permits_pic
, legal_person_mobile
, legal_person_name
, legal_person_certificate_type
, legal_person_id_number
, legal_person_id_pic_1
, legal_person_id_pic_2
, status
, agent_mobile
, agent_name
, agent_id_number
, agent_mail
, agent_id_pic_1
, agent_id_pic_2
, agent_hold_pic
, operator_mail
, operator_hold_pic
, operator_authorizing_pic
, approver_authorizing_pic
, agent_authorizing_pic
, auth_type
, time_create
, time_update
, operator_mobile
, operator_name
, operator_certificate_type
, operator_id_number
, approver_mobile
, approver_name
, approver_certificate_type
, approver_id_number
, approver_mail
, approver_hold_pic
, approver_id_pic_1
, approver_id_pic_2
, operator_id_pic_1
, operator_id_pic_2
, refer_code
, enterprise_id
) VALUES ( CONCAT(‘20230711149’, i), ‘L2VRJ’, ‘’, CONCAT(‘上海世通’, i), ‘EQABUibFVL90k9giaFeRNdTY1he56zNBde7tqPFErS4aSEVjf5nexaMAGjatIgNVI0SVc3Io3Ox5bjDVcZaEK6VZweMUd4x5hTevx0qi3JcDbkWO’, ‘EQABUrc%2FHdfZhPmR8hzAuY3I97yRflvvCjpAAC%2FX41tNH9zf’, CONCAT(‘2785’, i), CONCAT(‘91440101727XL’, i), ‘’, CONCAT(‘E99205’, i), ‘’, ‘/enterprise-web-oapi/platform/image/preview/e6b04543155111eead9f02020acf6cf0_entityDetail_INFO_E7716514788’, ‘MERGED’, ‘LONG_TERM’, ‘0001-01-01 00:00:00’, ‘’, ‘’, CONCAT(‘上海世通’, i), ‘EQABUg0dRGT5v1T%2Bm1mN1t9uBVIUOXQHZm5KXybwF02lfuV4’, ‘CMB’, ‘招商银行股份有限公司北京建国路支行’, ‘308100005176’, ‘’, ‘_entityDetail_INFO_E7716514788’, ‘EQABUuGQ1ed60eUB8LsteVrpTKY%3D’, ‘陈丽娜’, ‘ID_CARD’, ‘EQABUvnOU%2FGlTw2OD8qB3Q1WTli2V5z3H2ogej87tAqXCqr9’, ‘/enterprise-web-oapi/platform/image/preview/e6bdd9d4155111eead9f02020acf6cf0_entityDetail_INFO_E7716514788’, ‘/enterprise-web-oapi/platform/image/preview/e6be7615155111eead9f02020acf6cf0’, ‘AUTH_PLATFORM_SUCC’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘EQABUuJCv6VYe2FBmDjKwvnCIJD%2Bi511icbyrtopiRLs0PKW’, ‘/enterprise-web-oapi/platform/image/preview/e6cf8d18155111eead9f02020acf6cf0_entityDetail_INFO_E7716514788’, ‘/enterprise-web-oapi/platform/image/preview/e6d00249155111eead9f02020acf6cf0_entityDetail_INFO_E7716514788’, ‘/enterprise-web-oapi/platform/image/preview/e6de331d155111eead9f02020acf6cf0_entityDetail_INFO_E7716514788’, ‘’, ‘CHAIN’, NOW(), NOW(), ‘EQABUgPAe%2FLswmG3tyCHh42mdJ8%3D’, ‘王凯’, ‘ID_CARD’, ‘EQABUq79NkpWbK8LT2WDHDMHyjgS2oloFE7NnEnvhkOHaRuF’, ‘EQABUgPAe%2FLswmG3tyCHh42mdJ8%3D’, ‘王凯’, ‘ID_CARD’, ‘EQABUq79NkpWbK8LT2WDHDMHyjgS2oloFE7NnEnvhkOHaRuF’, ‘EQABUql6PB3gaTKlwppPE3WjPHSk9tN55Kbugjq7xMncSw8G’, ‘/enterprise-web-oapi/platform/image/preview/e6ddbdec155111eead9f02020acf6cf0_entityDetail_INFO_E7716514788’, ‘/enterprise-web-oapi/platform/image/preview/e6d0777a155111eead9f02020acf6cf0_entityDetail_INFO_E7716514788’, ‘/enterprise-web-oapi/platform/image/preview/e6dc5e5b155111eead9f02020acf6cf0_entityDetail_INFO_E7716514788’, ‘/enterprise-web-oapi/platform/image/preview/e6cd6a36155111eead9f02020acf6cf0_entityDetail_INFO_E7716514788’, ‘/enterprise-web-oapi/platform/image/preview/e6cf17e7155111eead9f02020acf6cf0_entityDetail_INFO_E7716514788’, ‘’, CONCAT(‘E2022112500000’, i) );
INSERT INTO recf
.tbl_platform_user_group
( id
, user_group_name
, time_create
, time_update
) VALUES ( CONCAT(‘947abb3abbeb11e89430525400d’, i), CONCAT(‘上海世通’, i), NOW(), NOW() );
INSERT INTO recf
.tbl_platform_user_agent
( id
, user_id
, entity_id
, agent_proxy_pic
, binding_status
, time_create
, time_update
) VALUES ( CONCAT( ‘0bbdb0faca0811e8b3dd525400d’, i ), CONCAT( ‘ad71bd190f9811ebbcd9525400d’, i ), CONCAT(‘E99205’, i), NULL, NULL, NOW(), NOW() );
INSERT INTO recf
.tbl_platform_account
( id
, entity_id
, type
, is_main_account
, bank_abbr
, bank_account_name
, bank_account_number
, bank_issuer
, bank_issuer_name
, bank_province
, bank_city
, time_create
, time_update
, status
, authenticate_order_id
) VALUES ( CONCAT( ‘2221d5161fb811ee8bfc02020ac’, i ), CONCAT(‘E99205’, i), ‘BANK’, ‘1’, ‘CMB’, CONCAT(‘上海世通’, i), ‘EQABUg0dRGT5v1T%2Bm1mN1t9uBVIUOXQHZm5KXybwF02lfuV4’, ‘308100005176’, ‘招商银行股份有限公司北京建国路支行’, ‘北京’, ‘北京市’, NOW(), NOW(), ‘AUTHENTICATE_SUCCESS’, ‘’ );
INSERT INTO recf
.tbl_cert_admin_enterprise
( id
, social_credit_code
, company_name
, cert_status
, issuer_type
, apply_date
, start_date
, expiry_date
, seal_code
, seal_pwd
, cert_DN
, cert_SN
, frozen_date
, canceled_date
, make_date
, version
, update_time
) VALUES ( CONCAT( ‘579c7de9c9e411e8989f525400f’, i ), CONCAT(‘91440101727XL’, i), CONCAT(‘上海世通’, i), ‘MAKED’, ‘CFCA’, ‘2023-08-14’, ‘2023-08-14’, ‘2023-08-14’, CONCAT(‘j2MY62n92AG30’, i), ‘u992T76x’, ‘C=CN,O=CFCA TEST OCA31,OU=Local RA,OU=Organizational-1,CN=051@广州通达汽车电气股份有限公司@N9144010127852727XL@1’, CONCAT(‘40048’, i), ‘0001-01-01’, ‘0001-01-01’, ‘2023-08-14’, ‘1’, NOW() );
set i = i + 1;
end while;
END
– 执行上面脚本后提交
call cabinetoutstock(14001);
– 删除存储过程可重复执行
drop PROCEDURE cabinetoutstock;