如下sql,为计算用户收益总和:
<select id="getTotalIncome" resultType="com.lws.test.modules.user.entity.UserIncomeEntity">
select sum(income) as totalIncome
from income_log
where uid = #{uid,jdbcType=BIGINT}
</select>
其中返回的求和字段类型需要设置为 BigDecimal :
public class UserIncomeEntity {
private BigDecimal totalIncome;
}
博客介绍了使用SQL计算用户收益总和,且要求返回的求和字段类型设置为BigDecimal。
6329

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



