package com.yonge.cooleshow.biz.dal.service.impl;

import com.yonge.cooleshow.biz.dal.entity.AlbumFavorite;
import com.yonge.cooleshow.biz.dal.entity.MusicFavorite;
import com.yonge.cooleshow.biz.dal.dao.MusicFavoriteDao;
import com.yonge.cooleshow.biz.dal.service.MusicFavoriteService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.List;

/**
 * MusicFavoriteService服务实现类
 * @author yzp
 * @date 2022-03-26 00:01:37
 * @version v1.0
 **/
@Service
public class MusicFavoriteServiceImpl extends ServiceImpl<MusicFavoriteDao,MusicFavorite> implements MusicFavoriteService {

    private final static Logger log = LoggerFactory.getLogger(MusicFavoriteServiceImpl.class);

    @Autowired
    private MusicFavoriteDao musicFavoriteDao;

    public MusicFavoriteDao getDao() {
        return musicFavoriteDao;
    }

    @Override
    public List<MusicFavorite> getFavorite(Long userId, Long musicSheetId) {
        return this.lambdaQuery()
                   .eq(MusicFavorite::getMusicSheetId, musicSheetId)
                   .eq(MusicFavorite::getUserId, userId)
                   .list();

    }
}