From a378f38df1785cbc8c9f1d55ace6a37952d2f65b Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期一, 10 八月 2026 14:01:56 +0800
Subject: [PATCH] feat(crm): 新增开票功能并完善权限查询
---
docs/sql/clean_business_data.sql | 248 ++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 203 insertions(+), 45 deletions(-)
diff --git a/docs/sql/clean_business_data.sql b/docs/sql/clean_business_data.sql
index 61da7f2..e2611d5 100644
--- a/docs/sql/clean_business_data.sql
+++ b/docs/sql/clean_business_data.sql
@@ -1,7 +1,8 @@
-- ============================================================
-- 绯荤粺涓氬姟鏁版嵁娓呯悊瀛樺偍杩囩▼
--
--- 鐢ㄩ�旓細娓呯┖鎵�鏈変笟鍔″崟鎹暟鎹紝淇濈暀绯荤粺閰嶇疆鍜屽熀纭�鏁版嵁
+-- 鐢ㄩ�旓細娓呯┖鎵�鏈変笟鍔℃暟鎹� + 鍩虹鏁版嵁锛堢墿鏂�/瀹㈡埛/渚涘簲鍟�/浠撳簱绛夛級
+-- 淇濈暀锛氱郴缁熻〃銆佸伐浣滄祦寮曟搸銆佸畾鏃朵换鍔°�佺紪鐮佽鍒欍�佸熀纭�璁炬柦閰嶇疆
-- 娉ㄦ剰锛氭鎿嶄綔涓嶅彲閫嗭紝鎵ц鍓嶈纭宸插浠芥暟鎹簱
--
-- 浣跨敤鏂瑰紡锛欳ALL sp_clean_business_data();
@@ -13,11 +14,10 @@
CREATE PROCEDURE sp_clean_business_data()
BEGIN
- -- 鍏抽棴澶栭敭妫�鏌ワ紝閬垮厤鍥犺〃闂村紩鐢ㄥ鑷村垹闄ゅけ璐�
SET FOREIGN_KEY_CHECKS = 0;
-- ============================================================
- -- 1. 绯荤粺鏃ュ織涓嶵oken锛堝彲瀹夊叏娓呯悊锛�
+ -- 1. 绯荤粺鏃ュ織涓嶵oken
-- ============================================================
TRUNCATE TABLE system_login_log;
TRUNCATE TABLE system_operate_log;
@@ -31,7 +31,7 @@
TRUNCATE TABLE infra_job_log;
-- ============================================================
- -- 2. 鏂囦欢涓庨檮浠讹紙涓氬姟鏂囦欢锛屾竻鐞嗗悗涓嶅奖鍝嶇郴缁熻繍琛岋級
+ -- 2. 鏂囦欢涓庨檮浠�
-- ============================================================
TRUNCATE TABLE system_storage_attachment;
TRUNCATE TABLE system_storage_blob;
@@ -62,28 +62,19 @@
-- ============================================================
-- 4. MES 浠撳簱妯″潡 鈥� 涓氬姟鍗曟嵁
-- ============================================================
- -- 搴撳瓨浜ゆ槗娴佹按锛堝簳灞傦紝鍏堟竻锛�
TRUNCATE TABLE mes_wm_transaction;
TRUNCATE TABLE mes_wm_stock_reserve;
TRUNCATE TABLE mes_wm_material_stock;
-
- -- 搴忓垪鍙� / 鎵规 / 鏉$爜
TRUNCATE TABLE mes_wm_sn;
TRUNCATE TABLE mes_wm_batch;
TRUNCATE TABLE mes_wm_barcode;
-
- -- 鐩樼偣
TRUNCATE TABLE mes_wm_stock_taking_task_result;
TRUNCATE TABLE mes_wm_stock_taking_task_line;
TRUNCATE TABLE mes_wm_stock_taking_task;
TRUNCATE TABLE mes_wm_stock_taking_plan_param;
TRUNCATE TABLE mes_wm_stock_taking_plan;
-
- -- 鍖呰
TRUNCATE TABLE mes_wm_package_line;
TRUNCATE TABLE mes_wm_package;
-
- -- 鍑哄叆搴撴槑缁�/琛岋紙鍏堟竻 detail/line锛屽啀娓呬富琛級
TRUNCATE TABLE mes_wm_item_receipt_detail;
TRUNCATE TABLE mes_wm_item_receipt_line;
TRUNCATE TABLE mes_wm_item_receipt;
@@ -132,7 +123,7 @@
TRUNCATE TABLE mes_wm_arrival_notice;
-- ============================================================
- -- 5. MES 璐ㄦ妯″潡 鈥� 涓氬姟鏁版嵁
+ -- 5. MES 璐ㄦ妯″潡 鈥� 涓氬姟鍗曟嵁
-- ============================================================
TRUNCATE TABLE mes_qc_indicator_result_detail;
TRUNCATE TABLE mes_qc_indicator_result;
@@ -165,11 +156,100 @@
TRUNCATE TABLE mes_pd_document;
TRUNCATE TABLE mes_pd_project;
- -- 缂栫爜鐢熸垚璁板綍锛堣鍒欐湰韬繚鐣欙級
+ -- ============================================================
+ -- 8. MES 鍩虹鏁版嵁 鈥� 鐗╂枡/浜у搧/BOM/SOP/SIP
+ -- ============================================================
+ TRUNCATE TABLE mes_md_product_bom;
+ TRUNCATE TABLE mes_md_product_sip;
+ TRUNCATE TABLE mes_md_product_sop;
+ TRUNCATE TABLE mes_md_item;
+ TRUNCATE TABLE mes_md_item_batch_config;
+ TRUNCATE TABLE mes_md_item_type;
+ TRUNCATE TABLE mes_md_unit_measure;
+ TRUNCATE TABLE mes_md_vendor;
TRUNCATE TABLE mes_md_auto_code_record;
-- ============================================================
- -- 8. CRM 妯″潡 鈥� 涓氬姟鍗曟嵁
+ -- 9. MES 鍩虹鏁版嵁 鈥� 杞﹂棿/宸ヤ綔绔�/璧勬簮
+ -- ============================================================
+ TRUNCATE TABLE mes_md_workstation_machine;
+ TRUNCATE TABLE mes_md_workstation_tool;
+ TRUNCATE TABLE mes_md_workstation_worker;
+ TRUNCATE TABLE mes_md_workstation;
+ TRUNCATE TABLE mes_md_workshop;
+
+ -- ============================================================
+ -- 10. MES 鍩虹鏁版嵁 鈥� 鐝粍/鎺掔彮
+ -- ============================================================
+ TRUNCATE TABLE mes_cal_plan_team;
+ TRUNCATE TABLE mes_cal_plan_shift;
+ TRUNCATE TABLE mes_cal_plan;
+ TRUNCATE TABLE mes_cal_team_shift;
+ TRUNCATE TABLE mes_cal_team_member;
+ TRUNCATE TABLE mes_cal_team;
+ TRUNCATE TABLE mes_cal_holiday;
+
+ -- ============================================================
+ -- 11. MES 鍩虹鏁版嵁 鈥� 璁惧/宸ュ叿鍙拌处
+ -- ============================================================
+ TRUNCATE TABLE mes_dv_check_plan_subject;
+ TRUNCATE TABLE mes_dv_check_plan_machinery;
+ TRUNCATE TABLE mes_dv_check_plan;
+ TRUNCATE TABLE mes_dv_machinery;
+ TRUNCATE TABLE mes_dv_machinery_type;
+ TRUNCATE TABLE mes_dv_subject;
+ TRUNCATE TABLE mes_tm_tool;
+ TRUNCATE TABLE mes_tm_tool_type;
+
+ -- ============================================================
+ -- 12. MES 鍩虹鏁版嵁 鈥� 宸ヨ壓璺嚎/宸ュ簭/鍙傛暟
+ -- ============================================================
+ TRUNCATE TABLE mes_pro_route_product_bom;
+ TRUNCATE TABLE mes_pro_route_product;
+ TRUNCATE TABLE mes_pro_route_process;
+ TRUNCATE TABLE mes_pro_route;
+ TRUNCATE TABLE mes_pro_process_content;
+ TRUNCATE TABLE mes_pro_process;
+ TRUNCATE TABLE mes_pd_process_param_template_detail;
+ TRUNCATE TABLE mes_pd_process_param_template;
+ TRUNCATE TABLE mes_pd_process_param;
+
+ -- ============================================================
+ -- 13. MES 鍩虹鏁版嵁 鈥� 璐ㄦ鏂规/缂洪櫡/鎸囨爣
+ -- ============================================================
+ TRUNCATE TABLE mes_qc_template_item;
+ TRUNCATE TABLE mes_qc_template_indicator;
+ TRUNCATE TABLE mes_qc_template;
+ TRUNCATE TABLE mes_qc_defect;
+ TRUNCATE TABLE mes_qc_indicator;
+
+ -- ============================================================
+ -- 14. MES 鍩虹鏁版嵁 鈥� 浠撳簱/搴撳尯/搴撲綅
+ -- ============================================================
+ TRUNCATE TABLE mes_wm_warehouse_location;
+ TRUNCATE TABLE mes_wm_warehouse_area;
+ TRUNCATE TABLE mes_wm_warehouse;
+
+ -- ============================================================
+ -- 15. MES 鍩虹閰嶇疆 鈥� 缂栫爜璁板綍/鏉$爜/瀹夌伅閰嶇疆
+ -- ============================================================
+ TRUNCATE TABLE mes_wm_barcode_config;
+ TRUNCATE TABLE mes_pro_andon_config;
+
+ -- ============================================================
+ -- 16. MDM 涓绘暟鎹�
+ -- ============================================================
+ TRUNCATE TABLE mdm_item_sku;
+ TRUNCATE TABLE mdm_item_migration_map;
+ TRUNCATE TABLE mdm_item_batch_config;
+ TRUNCATE TABLE mdm_item;
+ TRUNCATE TABLE mdm_item_category;
+ TRUNCATE TABLE mdm_brand;
+ TRUNCATE TABLE mdm_unit_measure;
+ TRUNCATE TABLE mdm_warehouse;
+
+ -- ============================================================
+ -- 17. CRM 妯″潡 鈥� 涓氬姟鍗曟嵁 + 瀹㈡埛 + 閰嶇疆
-- ============================================================
TRUNCATE TABLE after_sale_return_item;
TRUNCATE TABLE after_sale_return;
@@ -191,9 +271,14 @@
TRUNCATE TABLE crm_follow_up_record;
TRUNCATE TABLE crm_customer;
TRUNCATE TABLE crm_permission;
+ TRUNCATE TABLE crm_business_status;
+ TRUNCATE TABLE crm_business_status_type;
+ TRUNCATE TABLE crm_contract_config;
+ TRUNCATE TABLE crm_customer_limit_config;
+ TRUNCATE TABLE crm_customer_pool_config;
-- ============================================================
- -- 9. ERP 妯″潡 鈥� 涓氬姟鍗曟嵁
+ -- 18. ERP 妯″潡 鈥� 涓氬姟鍗曟嵁 + 渚涘簲鍟� + 缁撶畻璐︽埛
-- ============================================================
TRUNCATE TABLE erp_finance_payment_item;
TRUNCATE TABLE erp_finance_payment;
@@ -205,9 +290,31 @@
TRUNCATE TABLE erp_purchase_request;
TRUNCATE TABLE erp_sale_order_items;
TRUNCATE TABLE erp_sale_order;
+ TRUNCATE TABLE erp_supplier;
+ TRUNCATE TABLE erp_account;
-- ============================================================
- -- 10. HRM 妯″潡 鈥� 涓氬姟鍗曟嵁
+ -- 19. SRM 妯″潡 鈥� 涓氬姟鍗曟嵁 + 渚涘簲鍟� + 閰嶇疆
+ -- ============================================================
+ TRUNCATE TABLE srm_bid_award;
+ TRUNCATE TABLE srm_bid_evaluation;
+ TRUNCATE TABLE srm_bid_open;
+ TRUNCATE TABLE srm_tender_bid;
+ TRUNCATE TABLE srm_tender_material;
+ TRUNCATE TABLE srm_tender_project;
+ TRUNCATE TABLE srm_delivery_plan;
+ TRUNCATE TABLE srm_purchase_collaboration;
+ TRUNCATE TABLE srm_supplier_quote;
+ TRUNCATE TABLE srm_supplier_evaluation;
+ TRUNCATE TABLE srm_supplier_certificate;
+ TRUNCATE TABLE srm_supplier_contact;
+ TRUNCATE TABLE srm_supplier_apply;
+ TRUNCATE TABLE srm_supplier_category;
+ TRUNCATE TABLE srm_supplier;
+ TRUNCATE TABLE srm_tender_config;
+
+ -- ============================================================
+ -- 20. HRM 妯″潡 鈥� 涓氬姟鍗曟嵁 + 閰嶇疆
-- ============================================================
TRUNCATE TABLE hrm_salary_payment_detail;
TRUNCATE TABLE hrm_salary_payment;
@@ -224,32 +331,27 @@
TRUNCATE TABLE hrm_employee_social_security;
TRUNCATE TABLE hrm_employee_salary;
TRUNCATE TABLE hrm_employee;
+ TRUNCATE TABLE hrm_attendance_holiday;
+ TRUNCATE TABLE hrm_attendance_rule;
+ TRUNCATE TABLE hrm_leave_type_config;
+ TRUNCATE TABLE hrm_salary_structure;
+ TRUNCATE TABLE hrm_social_security_scheme;
+ TRUNCATE TABLE hrm_tax_rate_config;
-- ============================================================
- -- 11. SRM 妯″潡 鈥� 涓氬姟鍗曟嵁
- -- ============================================================
- TRUNCATE TABLE srm_bid_award;
- TRUNCATE TABLE srm_bid_evaluation;
- TRUNCATE TABLE srm_bid_open;
- TRUNCATE TABLE srm_tender_bid;
- TRUNCATE TABLE srm_tender_material;
- TRUNCATE TABLE srm_tender_project;
- TRUNCATE TABLE srm_delivery_plan;
- TRUNCATE TABLE srm_purchase_collaboration;
- TRUNCATE TABLE srm_supplier_quote;
- TRUNCATE TABLE srm_supplier_evaluation;
- TRUNCATE TABLE srm_supplier_certificate;
- TRUNCATE TABLE srm_supplier_contact;
- TRUNCATE TABLE srm_supplier_apply;
-
- -- ============================================================
- -- 12. BPM 妯″潡 鈥� 涓氬姟鍗曟嵁
+ -- 21. BPM 妯″潡 鈥� 涓氬姟鏁版嵁 + 娴佺▼瀹氫箟
-- ============================================================
TRUNCATE TABLE bpm_oa_leave;
TRUNCATE TABLE bpm_process_instance_copy;
+ TRUNCATE TABLE bpm_process_definition_info;
+ TRUNCATE TABLE bpm_process_expression;
+ TRUNCATE TABLE bpm_process_listener;
+ TRUNCATE TABLE bpm_user_group;
+ TRUNCATE TABLE bpm_form;
+ TRUNCATE TABLE bpm_category;
-- ============================================================
- -- 13. AI 妯″潡 鈥� 浼氳瘽/鍐呭鏁版嵁
+ -- 22. AI 妯″潡 鈥� 鏁版嵁 + 閰嶇疆
-- ============================================================
TRUNCATE TABLE ai_chat_message;
TRUNCATE TABLE ai_chat_conversation;
@@ -261,9 +363,13 @@
TRUNCATE TABLE ai_music;
TRUNCATE TABLE ai_write;
TRUNCATE TABLE ai_workflow;
+ TRUNCATE TABLE ai_api_key;
+ TRUNCATE TABLE ai_model;
+ TRUNCATE TABLE ai_tool;
+ TRUNCATE TABLE ai_chat_role;
-- ============================================================
- -- 14. IM 妯″潡 鈥� 浼氳瘽/娑堟伅鏁版嵁
+ -- 23. IM 妯″潡 鈥� 鏁版嵁 + 閰嶇疆
-- ============================================================
TRUNCATE TABLE im_group_message_receipt;
TRUNCATE TABLE im_group_message;
@@ -282,27 +388,79 @@
TRUNCATE TABLE im_rtc_participant;
TRUNCATE TABLE im_rtc_call;
TRUNCATE TABLE im_user_online;
+ TRUNCATE TABLE im_sensitive_word;
+ TRUNCATE TABLE im_face_user_item;
+ TRUNCATE TABLE im_face_pack_item;
+ TRUNCATE TABLE im_face_pack;
-- ============================================================
- -- 15. OA 閫氱煡鍏憡 鈥� 涓氬姟鏁版嵁
+ -- 24. BI 鎶ヨ〃閰嶇疆
+ -- ============================================================
+ TRUNCATE TABLE bi_warehouse_coordinate;
+ TRUNCATE TABLE bi_chart_config;
+ TRUNCATE TABLE bi_dashboard;
+ TRUNCATE TABLE bi_data_source_config;
+
+ -- ============================================================
+ -- 25. 鍏朵粬妯″潡鏁版嵁
-- ============================================================
TRUNCATE TABLE oa_notice_read;
TRUNCATE TABLE oa_notice_user;
TRUNCATE TABLE oa_notice;
TRUNCATE TABLE system_notice;
+ TRUNCATE TABLE system_notify_template;
+ TRUNCATE TABLE system_mail_log;
+ TRUNCATE TABLE system_mail_template;
+ TRUNCATE TABLE system_mail_account;
+ TRUNCATE TABLE system_sms_code;
+ TRUNCATE TABLE system_sms_log;
+ TRUNCATE TABLE system_sms_template;
+ TRUNCATE TABLE system_sms_channel;
+ TRUNCATE TABLE system_social_user_bind;
+ TRUNCATE TABLE system_social_user;
+ TRUNCATE TABLE system_social_client;
+ TRUNCATE TABLE report_go_view_project;
- -- ============================================================
- -- 鎭㈠澶栭敭妫�鏌�
- -- ============================================================
SET FOREIGN_KEY_CHECKS = 1;
- -- 杩斿洖娓呯悊缁撴灉
SELECT '涓氬姟鏁版嵁娓呯悊瀹屾垚' AS result;
END$$
DELIMITER ;
-- ============================================================
--- 鎵ц绀轰緥锛�
--- CALL sp_clean_business_data();
+-- 淇濈暀鐨勮〃锛堜笉浼氳娓呯悊锛夛細
+--
+-- 銆愮郴缁熸牳蹇冦��
+-- system_users / system_dept / system_post
+-- system_role / system_role_menu
+-- system_menu
+-- system_dict_type / system_dict_data
+-- system_tenant / system_tenant_package
+-- system_user_post / system_user_role
+-- system_oauth2_client
+-- system_notify_template 鈫� 宸叉竻鐞�
+--
+-- 銆愬熀纭�璁炬柦銆�
+-- infra_config / infra_job
+-- infra_codegen_table / infra_codegen_column
+-- infra_data_source_config / infra_file_config
+--
+-- 銆愬伐浣滄祦寮曟搸銆�
+-- act_* (Activiti 寮曟搸琛�)
+-- flw_* (Flowable 寮曟搸琛�)
+--
+-- 銆愬畾鏃朵换鍔°��
+-- qrtz_* (Quartz 寮曟搸琛�)
+--
+-- 銆愮紪鐮佽鍒欙紙淇濈暀锛夈��
+-- mes_md_auto_code_rule
+-- mes_md_auto_code_part
+--
+-- 銆愮ず渚嬭〃銆�
+-- yudao_demo01_contact
+-- yudao_demo02_category
+-- yudao_demo03_course / yudao_demo03_grade / yudao_demo03_student
-- ============================================================
+
+-- 鎵ц锛欳ALL sp_clean_business_data();
--
Gitblit v1.9.3