package com.ruoyi.web.modules.store.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.ruoyi.web.modules.store.mapper.BizShopStatsMapper;
import com.ruoyi.web.modules.store.service.IShopRatingRefreshService;

@Service
public class ShopRatingRefreshServiceImpl implements IShopRatingRefreshService
{
    @Autowired
    private BizShopStatsMapper shopStatsMapper;

    @Override
    @Transactional(rollbackFor = Exception.class)
    public int refreshAllShopRatings()
    {
        int inserted = shopStatsMapper.insertStatsForShopsWithReviews();
        int updated = shopStatsMapper.updateAllShopRatings();
        return inserted + updated;
    }
}
