package com.fs.his.service.impl;

import java.util.List;
import com.fs.common.utils.DateUtils;
import com.fs.his.param.FsArticleListUParam;
import com.fs.his.vo.FsArticleListUVO;
import com.fs.his.vo.FsArticleListVO;
import com.fs.his.vo.FsArticleVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.fs.his.mapper.FsArticleMapper;
import com.fs.his.domain.FsArticle;
import com.fs.his.service.IFsArticleService;

/**
 * 文章Service业务层处理
 *
 * @author fs
 * @date 2023-07-04
 */
@Service
public class FsArticleServiceImpl implements IFsArticleService
{
    @Autowired
    private FsArticleMapper fsArticleMapper;

    /**
     * 查询文章
     *
     * @param articleId 文章主键
     * @return 文章
     */
    @Override
    public FsArticle selectFsArticleByArticleId(Long articleId)
    {
        return fsArticleMapper.selectFsArticleByArticleId(articleId);
    }

    /**
     * 查询文章列表
     *
     * @param fsArticle 文章
     * @return 文章
     */
    @Override
    public List<FsArticle> selectFsArticleList(FsArticle fsArticle)
    {
        return fsArticleMapper.selectFsArticleList(fsArticle);
    }

    /**
     * 新增文章
     *
     * @param fsArticle 文章
     * @return 结果
     */
    @Override
    public int insertFsArticle(FsArticle fsArticle)
    {
        fsArticle.setCreateTime(DateUtils.getNowDate());
        return fsArticleMapper.insertFsArticle(fsArticle);
    }

    /**
     * 修改文章
     *
     * @param fsArticle 文章
     * @return 结果
     */
    @Override
    public int updateFsArticle(FsArticle fsArticle)
    {
        fsArticle.setUpdateTime(DateUtils.getNowDate());
        return fsArticleMapper.updateFsArticle(fsArticle);
    }

    /**
     * 批量删除文章
     *
     * @param articleIds 需要删除的文章主键
     * @return 结果
     */
    @Override
    public int deleteFsArticleByArticleIds(Long[] articleIds)
    {
        return fsArticleMapper.deleteFsArticleByArticleIds(articleIds);
    }

    /**
     * 删除文章信息
     *
     * @param articleId 文章主键
     * @return 结果
     */
    @Override
    public int deleteFsArticleByArticleId(Long articleId)
    {
        return fsArticleMapper.deleteFsArticleByArticleId(articleId);
    }

    @Override
    public List<FsArticleListUVO> selectFsArticleListUVO(FsArticleListUParam param) {
        return fsArticleMapper.selectFsArticleListUVO(param);
    }

    @Override
    public int updateFsArticleViews(Long articleId) {
        return fsArticleMapper.updateFsArticleViews(articleId);
    }

    @Override
    public List<FsArticleListVO> selectFsArticleListVO(FsArticle fsArticle) {
        return fsArticleMapper.selectFsArticleListVO(fsArticle);
    }
}
