feat: contract date range (#939)

Co-authored-by: sealday <sealday@gmail.com>
Reviewed-on: daoyoucloud/tachybase#939
This commit is contained in:
sealday 2024-05-09 01:32:17 +08:00
parent f1bc617cda
commit 2880203b99
5 changed files with 5 additions and 10 deletions

View File

@ -20,8 +20,7 @@ FROM
contracts c
JOIN records r ON r.id = :recordId
JOIN contract_items ci ON c.id = ci.contract_id
AND ci.start_date <= r."date"
AND ci.end_date >= r."date"
AND ci.date_range @> r."date"
JOIN contract_plans cp ON cp.id = ci.contract_plan_id
JOIN contract_plan_fee_items cpfi ON cpfi.contract_plan_id = cp.id
JOIN products p ON p.id = cpfi.new_fee_products_id

View File

@ -20,8 +20,7 @@ FROM
record_contract rc
JOIN records r ON r.id = rc.record_id
JOIN contract_items ci ON ci.contract_id = rc.contract_id
AND ci.start_date <= r."date"
AND ci.end_date >= r."date"
AND ci.date_range @> r."date"
JOIN contract_plans cp ON cp.id = ci.contract_plan_id
JOIN contract_plan_lease_items cpli ON cpli.contract_plan_id = cp.id
JOIN view_products_search_rule_special vpsrs ON cpli.new_products_id = ANY (vpsrs.parents)

View File

@ -11,8 +11,7 @@ FROM
-- 开始查产品费用规则
JOIN contracts c ON c.id = s.contract_id
JOIN contract_items ci ON c.id = ci.contract_id
AND ci.start_date <= s.start_date
AND ci.end_date >= s.start_date
AND ci.date_range @> s.start_date
JOIN contract_plans cp ON cp.id = ci.contract_plan_id
JOIN contract_plan_fee_items cpfi ON cpfi.contract_plan_id = cp.id
JOIN products p ON p.id = cpfi.new_fee_products_id

View File

@ -23,8 +23,7 @@ FROM
-- 开始查产品费用规则
JOIN contracts c ON c.id = s.contract_id
JOIN contract_items ci ON c.id = ci.contract_id
AND ci.start_date <= s.start_date
AND ci.end_date >= s.start_date
AND ci.date_range @> s.start_date
JOIN contract_plans cp ON cp.id = ci.contract_plan_id
JOIN contract_plan_lease_items cpli ON cpli.contract_plan_id = cp.id
JOIN contract_plan_fee_items cpfi ON cpfi.lease_item_id = cpli.id

View File

@ -28,8 +28,7 @@ FROM
-- 开始查租金规则
JOIN contracts c ON c.id = s.contract_id
JOIN contract_items ci ON c.id = ci.contract_id
AND ci.start_date <= s.start_date
AND ci.end_date >= s.start_date
AND ci.date_range @> s.start_date
JOIN contract_plans cp ON cp.id = ci.contract_plan_id
JOIN contract_plan_lease_items cpli ON cpli.contract_plan_id = cp.id
-- 租金规则查询完毕