From 82e1355c399565e87021c6955ddaf2ed3d562587 Mon Sep 17 00:00:00 2001 From: lyx <2027667395@qq.com> Date: Tue, 19 Mar 2024 17:22:10 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E7=89=88=E5=8F=91=E7=A5=A8?= =?UTF-8?q?=E8=A7=86=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/server/sqls/view_invoices.sql | 32 ---------- .../src/server/sqls/view_invoices.sql | 63 +++++++++++++++++++ 2 files changed, 63 insertions(+), 32 deletions(-) delete mode 100644 packages/plugins/@hera/plugin-core/src/server/sqls/view_invoices.sql create mode 100644 packages/plugins/@hera/plugin-rental/src/server/sqls/view_invoices.sql diff --git a/packages/plugins/@hera/plugin-core/src/server/sqls/view_invoices.sql b/packages/plugins/@hera/plugin-core/src/server/sqls/view_invoices.sql deleted file mode 100644 index 891c68a41..000000000 --- a/packages/plugins/@hera/plugin-core/src/server/sqls/view_invoices.sql +++ /dev/null @@ -1,32 +0,0 @@ -CREATE OR REPLACE VIEW - public.view_invoice AS -SELECT "createdAt", - "updatedAt", - sort, - "createdById", - "updatedById", - id, - seller_id, - purchaser_id, - category, - type, - "Invoicing_date", - comment, - number, - inclusive_amount, - name, - conten, - tax_rate, - tax_amount, - net_amount, - authentication_date, - state, - CASE - WHEN "type"::text = 'input_invoice'::text THEN seller_id - ELSE purchaser_id - END AS opposite_id, - CASE - WHEN "type"::text = 'input_invoice'::text THEN purchaser_id - ELSE seller_id - END AS company_id - FROM invoice_new; diff --git a/packages/plugins/@hera/plugin-rental/src/server/sqls/view_invoices.sql b/packages/plugins/@hera/plugin-rental/src/server/sqls/view_invoices.sql new file mode 100644 index 000000000..46b4412a2 --- /dev/null +++ b/packages/plugins/@hera/plugin-rental/src/server/sqls/view_invoices.sql @@ -0,0 +1,63 @@ +CREATE OR REPLACE VIEW + public.view_invoice_all AS +SELECT + "createdAt", + "updatedAt", + "createdById", + "updatedById", + number, + seller_id, + purchaser_id, + category, +TYPE, +"Invoicing_date", +COMMENT, +inclusive_amount, +NAME, +CONTENT, +tax_rate, +tax_amount, +net_amount, +authentication_date, +state, +CASE + WHEN "type"::TEXT = 'input_invoice'::TEXT THEN seller_id + ELSE purchaser_id +END AS opposite_id, +CASE + WHEN "type"::TEXT = 'input_invoice'::TEXT THEN purchaser_id + ELSE seller_id +END AS company_id +FROM + invoice_input +UNION +SELECT + "createdAt", + "updatedAt", + "createdById", + "updatedById", + number, + seller_id, + purchaser_id, + category, +TYPE, +"Invoicing_date", +COMMENT, +inclusive_amount, +NAME, +CONTENT, +tax_rate, +tax_amount, +net_amount, +authentication_date, +state, +CASE + WHEN "type"::TEXT = 'input_invoice'::TEXT THEN seller_id + ELSE purchaser_id +END AS opposite_id, +CASE + WHEN "type"::TEXT = 'input_invoice'::TEXT THEN purchaser_id + ELSE seller_id +END AS company_id +FROM + invoice_output;