<property>元素的formula 属性指定一个sql表达式,该表达式可以引用表的字段,调用 sql 函数 或者 包含子查询语句。
例 :
<property name ="totalPrice" formula="(select sum(o.PRICE) from ORDERS o where o.DUSTOMER_ID=ID)" />
sql: select ID,NAME , (select sum(o.PRICE) from ORDERS o where o.DUSTOMER_ID=ID) from CUSTOMERS
<property name ="unitPrice" formula="BASE_PRICE*QUANTITY" />
select ID,BASE_PRICE*QUANTITY from LINEITEM
本文介绍了<property>元素的formula属性如何通过SQL表达式来动态计算字段值,包括子查询及字段运算等应用场景。

被折叠的 条评论
为什么被折叠?



