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.PublicDetailCommentMapper;
import com.playlet.system.domain.PublicDetailComment;
import com.playlet.system.service.IPublicDetailCommentService;
import com.playlet.common.core.text.Convert;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

/**
 * 文章评论Service业务层处理
 *
 * @author ruoyi
 * @date 2024-06-18
 */
@Service
public class PublicDetailCommentServiceImpl extends ServiceImpl<PublicDetailCommentMapper, PublicDetailComment> implements IPublicDetailCommentService
{
    @Autowired
    private PublicDetailCommentMapper publicDetailCommentMapper;

    /**
     * 查询文章评论
     *
     * @param id 文章评论主键
     * @return 文章评论
     */
    @Override
    public PublicDetailComment selectPublicDetailCommentById(Long id)
    {
        return publicDetailCommentMapper.selectPublicDetailCommentById(id);
    }

    /**
     * 查询文章评论列表
     *
     * @param publicDetailComment 文章评论
     * @return 文章评论
     */
    @Override
    public List<PublicDetailComment> selectPublicDetailCommentList(PublicDetailComment publicDetailComment)
    {
        return publicDetailCommentMapper.selectPublicDetailCommentList(publicDetailComment);
    }

    /**
     * 新增文章评论
     *
     * @param publicDetailComment 文章评论
     * @return 结果
     */
    @Override
    public int insertPublicDetailComment(PublicDetailComment publicDetailComment)
    {
        publicDetailComment.setCreateTime(DateUtils.getNowDate());
        return publicDetailCommentMapper.insertPublicDetailComment(publicDetailComment);
    }

    /**
     * 修改文章评论
     *
     * @param publicDetailComment 文章评论
     * @return 结果
     */
    @Override
    public int updatePublicDetailComment(PublicDetailComment publicDetailComment)
    {
        publicDetailComment.setUpdateTime(DateUtils.getNowDate());
        return publicDetailCommentMapper.updatePublicDetailComment(publicDetailComment);
    }

    /**
     * 批量删除文章评论
     *
     * @param ids 需要删除的文章评论主键
     * @return 结果
     */
    @Override
    public int deletePublicDetailCommentByIds(String ids)
    {
        return publicDetailCommentMapper.deletePublicDetailCommentByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除文章评论信息
     *
     * @param id 文章评论主键
     * @return 结果
     */
    @Override
    public int deletePublicDetailCommentById(Long id)
    {
        return publicDetailCommentMapper.deletePublicDetailCommentById(id);
    }
}
