package com.ruoyi.system.service.impl;

import com.ruoyi.common.core.domain.entity.RecommendInfo;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.system.mapper.RecommendInfoMapper;
import com.ruoyi.system.service.IRecommendInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 推荐Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-07-15
 */
@Service
public class RecommendInfoServiceImpl implements IRecommendInfoService 
{
    @Autowired
    private RecommendInfoMapper recommendInfoMapper;

    /**
     * 查询推荐
     * 
     * @param id 推荐主键
     * @return 推荐
     */
    @Override
    public RecommendInfo selectRecommendInfoById(Long id)
    {
        return recommendInfoMapper.selectRecommendInfoById(id);
    }

    /**
     * 查询推荐列表
     * 
     * @param recommendInfo 推荐
     * @return 推荐
     */
    @Override
    public List<RecommendInfo> selectRecommendInfoList(RecommendInfo recommendInfo)
    {
        return recommendInfoMapper.selectRecommendInfoList(recommendInfo);
    }

    /**
     * 新增推荐
     * 
     * @param recommendInfo 推荐
     * @return 结果
     */
    @Override
    public int insertRecommendInfo(RecommendInfo recommendInfo)
    {
        recommendInfo.setCreator(SecurityUtils.getUsername());
        recommendInfo.setCreateTime(DateUtils.getNowDate());
        return recommendInfoMapper.insertRecommendInfo(recommendInfo);
    }

    /**
     * 修改推荐
     * 
     * @param recommendInfo 推荐
     * @return 结果
     */
    @Override
    public int updateRecommendInfo(RecommendInfo recommendInfo)
    {
        recommendInfo.setUpdateTime(DateUtils.getNowDate());
        return recommendInfoMapper.updateRecommendInfo(recommendInfo);
    }

    /**
     * 批量删除推荐
     * 
     * @param ids 需要删除的推荐主键
     * @return 结果
     */
    @Override
    public int deleteRecommendInfoByIds(Long[] ids)
    {
        return recommendInfoMapper.deleteRecommendInfoByIds(ids);
    }

    /**
     * 删除推荐信息
     * 
     * @param id 推荐主键
     * @return 结果
     */
    @Override
    public int deleteRecommendInfoById(Long id)
    {
        return recommendInfoMapper.deleteRecommendInfoById(id);
    }

    @Override
    public int bindMusic(String reId, String[] musicIds) {
        return recommendInfoMapper.bindMusic(reId,musicIds);
    }

    @Override
    public RecommendInfo findRecommendMusic() {
        RecommendInfo recommendInfo = recommendInfoMapper.selectMusicRecommend();
        
        return null;
    }
}
