The summing function is mysql sum (), for example:
<select id="getPayAmount" resultType="java.lang.Integer" parameterType="java.lang.String">
select
sum(oeop.PAY_AMOUNT)
from OC_ERP_ORDER_PAY oeop
where 1=1
and oeop.ERP_ORDER_ID=#{erpOrderId}
</select>
The above is a piece of code in mybatis mapping xml file for a request to pay the sum, the receiver type with Integer, as an int in the wrapper object that can receive null if using int basic types of reception, so that when the query result is null when, it will be reported abnormal.
Mapper embodiment of correctly received
public Integer getPayAmount(String erpOrderId);
mapper may be reported to the reception in unusual ways
public int getPayAmount(String erpOrderId);
mysql in other relevant math functions, are likely to have secondary cases.