package cn.pluss.platform.bestNewActivity.impl;

import java.util.List;
import java.util.Map;

import cn.pluss.platform.entity.UserApp;
import cn.pluss.platform.userApp.UserAppService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import cn.pluss.platform.entity.BestNewActivity;
import cn.pluss.platform.bestNewActivity.BestNewActivityService;
import cn.pluss.platform.mapper.BestNewActivityMapper;

@Transactional
@Service("bestNewActivityService")
public class BestNewActivityServiceImpl extends ServiceImpl<BestNewActivityMapper, BestNewActivity> implements BestNewActivityService {

    @Autowired
    private UserAppService userAppService;

    @Autowired
    private BestNewActivityMapper bestNewActivityMapper;

    @Override
    public BestNewActivity queryBestNewActivity(BestNewActivity bestNewActivity) {
        return bestNewActivityMapper.queryBestNewActivity(bestNewActivity);
    }

    @Override
    public List<BestNewActivity> queryBestNewActivityList(BestNewActivity bestNewActivity) {
        return bestNewActivityMapper.queryBestNewActivityList(bestNewActivity);
    }

    @Override
    public void saveBestNewActivity(BestNewActivity bestNewActivity) {
        bestNewActivityMapper.saveBestNewActivity(bestNewActivity);
    }

    @Override
    public void updateBestNewActivity(BestNewActivity bestNewActivity) {
        bestNewActivityMapper.updateBestNewActivity(bestNewActivity);
    }

    @Override
    public void deleteBestNewActivity(BestNewActivity bestNewActivity) {
        bestNewActivityMapper.deleteBestNewActivity(bestNewActivity);
    }

    @Override
    public List<BestNewActivity> queryBestNewActivityPage(Map map) {
        try {
            UserApp userApp = userAppService.queryUserAppByToken();
            map.put("userId", userApp.getUserId());
        } catch (Exception ignored) {
        }
        return bestNewActivityMapper.queryBestNewActivityPage(map);
    }

    @Override
    public Integer queryBestNewActivityPageCount(Map map) {
        return bestNewActivityMapper.queryBestNewActivityPageCount(map);
    }

}

