提交 60dee9c4 authored 作者: Whispa's avatar Whispa

commit

上级 263c9527
...@@ -130,7 +130,7 @@ public class BonusController extends Controller { ...@@ -130,7 +130,7 @@ public class BonusController extends Controller {
int year = localDate.getYear(); int year = localDate.getYear();
Optional<TbCfUserInfo> byId = userRepository.findById(id); Optional<TbCfUserInfo> byId = userRepository.findById(id);
if (!byId.isPresent()) return null; if (!byId.isPresent()) return null;
Query nativeQuery = entityManager.createNativeQuery("select IFNULL(sum(b.amount),0) as data FROM bonus b where b.user_info_user_id=:user and dayofyear(b.create_date) = :day and year(b.create_date) = :year "); Query nativeQuery = entityManager.createNativeQuery("select IFNULL(sum(b.amount),0.0) as data FROM bonus b where b.user_info_user_id=:user and dayofyear(b.create_date) = :day and year(b.create_date) = :year ");
nativeQuery.setParameter("user", id); nativeQuery.setParameter("user", id);
nativeQuery.setParameter("day", dayOfYear); nativeQuery.setParameter("day", dayOfYear);
nativeQuery.setParameter("year", year); nativeQuery.setParameter("year", year);
......
...@@ -82,7 +82,7 @@ public class Bonus extends Model { ...@@ -82,7 +82,7 @@ public class Bonus extends Model {
} }
public BigDecimal getAmount() { public BigDecimal getAmount() {
return amount == null ? BigDecimal.ZERO : amount.setScale(2, RoundingMode.CEILING); return amount == null ? BigDecimal.ZERO : amount.setScale(2,RoundingMode.UNNECESSARY);
} }
public void setAmount(BigDecimal amount) { public void setAmount(BigDecimal amount) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论