feat: 二期调整 (#926)

Co-authored-by: lyx <2027667395@qq.com>
Reviewed-on: daoyoucloud/tachybase#926
Co-authored-by: hello@lv <2256334253@qq.com>
Co-committed-by: hello@lv <2256334253@qq.com>
This commit is contained in:
hello@lv 2024-05-08 19:04:48 +08:00 committed by sealday
parent 070149aa50
commit 7aafd496ab
2 changed files with 10 additions and 1 deletions

View File

@ -0,0 +1,5 @@
---
"@hera/plugin-rental": patch
---
二期出入库查询视图调整

View File

@ -3,6 +3,8 @@ CREATE OR REPLACE VIEW
SELECT SELECT
c.id AS contract_id, c.id AS contract_id,
r.id AS record_id, r.id AS record_id,
r.createdAt,
r.updatedAt,
CAST('c_' || rc.id AS VARCHAR) AS id, CAST('c_' || rc.id AS VARCHAR) AS id,
rc.id AS rc_id, -- 页面更新中间表存根联/回根联用 rc.id AS rc_id, -- 页面更新中间表存根联/回根联用
rc.movement, rc.movement,
@ -26,6 +28,8 @@ UNION ALL
SELECT SELECT
NULL AS contract_id, NULL AS contract_id,
r.id AS record_id, r.id AS record_id,
r.createdAt,
r.updatedAt,
CAST('r_' || r.id AS VARCHAR) AS id, CAST('r_' || r.id AS VARCHAR) AS id,
NULL AS rc_id, NULL AS rc_id,
( (
@ -38,7 +42,7 @@ SELECT
p3.id AS project_id, p3.id AS project_id,
rc.has_receipt, rc.has_receipt,
rc.has_stub, rc.has_stub,
'2' AS record_category '3' AS record_category
FROM FROM
records r records r
LEFT JOIN record_contract rc ON rc.record_id = r.id LEFT JOIN record_contract rc ON rc.record_id = r.id