iTop 中需要为每个组织单独订立合同。但是经常有一些公共服务是提供给很多组织使用的,比如申请机器,IT支持等等。这种情况下,如果为每一个组织都添加客户合同会非常繁琐,比较合理的方式是,客户合同定义在一个顶级组织中,然后其子组织都能够使用此合同定义的服务。
查询ID为3的组织的所有父组织(包含自身)
SELECT Organization AS p JOIN Organization AS c ON c.parent_id BELOW p.id WHERE c.id=3
查询ID为3的组织的所有父组织(不包含自身)
SELECT Organization AS p JOIN Organization AS c
ON c.parent_id BELOW STRICT p.id WHERE c.id=3
UserRequest 服务筛选OQL
SELECT Service AS s
JOIN lnkCustomerContractToService AS l1 ON l1.service_id=s.id
JOIN CustomerContract AS cc ON l1.customercontract_id=cc.id
WHERE cc.org_id = :this->org_id AND s.status != 'obsolete'
筛选服务时考虑父组织
SELECT Service AS s
JOIN lnkCustomerContractToService AS l1 ON l1.service_id=s.id
JOIN CustomerContract AS cc ON l1.customercontract_id=cc.id
JOIN Organization AS p ON cc.org_id=p.id
JOIN Organization AS c ON c.parent_id BELOW p.id
WHERE c.id=:this->org_id AND s.status != 'obsolete'
发表回复