每日上新 折扣

This commit is contained in:
wangw 2024-05-17 14:25:58 +08:00
parent d09299d584
commit 8ce08d18a3
1 changed files with 8 additions and 9 deletions

View File

@ -65,15 +65,6 @@ public class HomePageService {
* 销量榜
*/
List<HomeVO> homeVOs = productSkuMapper.selectSale();
for (HomeVO o : homeVOs) {
BigDecimal originPrice = o.getOriginPrice();
if (originPrice.compareTo(BigDecimal.ZERO) != 0) {
o.setDiscount(BigDecimalUtils.getDiscount(o.getOriginPrice(),o.getSalePrice()));
} else {
o.setDiscount(null);
}
}
HotRankingVO hotRankingVO = new HotRankingVO();
hotRankingVO.setHotList(homeVOs);
homeUpVO.setSalesList(hotRankingVO);
@ -81,6 +72,14 @@ public class HomePageService {
*每日榜
*/
List<HomeVO> homeVODay = productSkuMapper.selectDay();
for (HomeVO o : homeVODay) {
BigDecimal originPrice = o.getOriginPrice();
if (originPrice.compareTo(BigDecimal.ZERO) != 0) {
o.setDiscount(BigDecimalUtils.getDiscount(o.getOriginPrice(),o.getSalePrice()));
} else {
o.setDiscount(null);
}
}
TodayRankingVO todayRankingVO = new TodayRankingVO();
todayRankingVO.setTodayList(homeVODay);
homeUpVO.setTodayList(todayRankingVO);