package com.playlet.system.service.impl;

import java.util.List;
import com.playlet.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.playlet.system.mapper.PublicStarRecordMapper;
import com.playlet.system.domain.PublicStarRecord;
import com.playlet.system.service.IPublicStarRecordService;
import com.playlet.common.core.text.Convert;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

/**
 * 文章点赞记录Service业务层处理
 *
 * @author ruoyi
 * @date 2024-06-24
 */
@Service
public class PublicStarRecordServiceImpl extends ServiceImpl<PublicStarRecordMapper, PublicStarRecord> implements IPublicStarRecordService
{
    @Autowired
    private PublicStarRecordMapper publicStarRecordMapper;

    /**
     * 查询文章点赞记录
     *
     * @param id 文章点赞记录主键
     * @return 文章点赞记录
     */
    @Override
    public PublicStarRecord selectPublicStarRecordById(Long id)
    {
        return publicStarRecordMapper.selectPublicStarRecordById(id);
    }

    /**
     * 查询文章点赞记录列表
     *
     * @param publicStarRecord 文章点赞记录
     * @return 文章点赞记录
     */
    @Override
    public List<PublicStarRecord> selectPublicStarRecordList(PublicStarRecord publicStarRecord)
    {
        return publicStarRecordMapper.selectPublicStarRecordList(publicStarRecord);
    }

    /**
     * 新增文章点赞记录
     *
     * @param publicStarRecord 文章点赞记录
     * @return 结果
     */
    @Override
    public int insertPublicStarRecord(PublicStarRecord publicStarRecord)
    {
        publicStarRecord.setCreateTime(DateUtils.getNowDate());
        return publicStarRecordMapper.insertPublicStarRecord(publicStarRecord);
    }

    /**
     * 修改文章点赞记录
     *
     * @param publicStarRecord 文章点赞记录
     * @return 结果
     */
    @Override
    public int updatePublicStarRecord(PublicStarRecord publicStarRecord)
    {
        publicStarRecord.setUpdateTime(DateUtils.getNowDate());
        return publicStarRecordMapper.updatePublicStarRecord(publicStarRecord);
    }

    /**
     * 批量删除文章点赞记录
     *
     * @param ids 需要删除的文章点赞记录主键
     * @return 结果
     */
    @Override
    public int deletePublicStarRecordByIds(String ids)
    {
        return publicStarRecordMapper.deletePublicStarRecordByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除文章点赞记录信息
     *
     * @param id 文章点赞记录主键
     * @return 结果
     */
    @Override
    public int deletePublicStarRecordById(Long id)
    {
        return publicStarRecordMapper.deletePublicStarRecordById(id);
    }
}
