package com.fs.hisStore.service.impl;

import com.fs.common.utils.DateUtils;
import com.fs.hisStore.domain.FsDoctorArticleScrm;
import com.fs.hisStore.mapper.FsDoctorArticleScrmMapper;
import com.fs.hisStore.param.FsDoctorArticleListUParam;
import com.fs.hisStore.service.IFsDoctorArticleScrmService;
import com.fs.hisStore.vo.FsDoctorArticleListUVO;
import com.fs.hisStore.vo.FsDoctorArticleListVO;
import com.fs.hisStore.vo.FsDoctorArticleUVO;
import com.fs.hisStore.vo.FsDoctorArticleVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 医生文章Service业务层处理
 *
 * @author fs
 * @date 2023-06-05
 */
@Service
public class FsDoctorArticleScrmServiceImpl implements IFsDoctorArticleScrmService
{
    @Autowired
    private FsDoctorArticleScrmMapper fsDoctorArticleMapper;

    /**
     * 查询医生文章
     *
     * @param articleId 医生文章主键
     * @return 医生文章
     */
    @Override
    public FsDoctorArticleVO selectFsDoctorArticleByArticleId(Long articleId)
    {
        return fsDoctorArticleMapper.selectFsDoctorArticleVOByArticleId(articleId);
    }

    /**
     * 查询医生文章列表
     *
     * @param fsDoctorArticle 医生文章
     * @return 医生文章
     */
    @Override
    public List<FsDoctorArticleScrm> selectFsDoctorArticleList(FsDoctorArticleScrm fsDoctorArticle)
    {
        return fsDoctorArticleMapper.selectFsDoctorArticleList(fsDoctorArticle);
    }

    /**
     * 新增医生文章
     *
     * @param fsDoctorArticle 医生文章
     * @return 结果
     */
    @Override
    public int insertFsDoctorArticle(FsDoctorArticleScrm fsDoctorArticle)
    {

        fsDoctorArticle.setCreateTime(DateUtils.getNowDate());
        return fsDoctorArticleMapper.insertFsDoctorArticle(fsDoctorArticle);
    }

    /**
     * 修改医生文章
     *
     * @param fsDoctorArticle 医生文章
     * @return 结果
     */
    @Override
    public int updateFsDoctorArticle(FsDoctorArticleScrm fsDoctorArticle)
    {
        fsDoctorArticle.setUpdateTime(DateUtils.getNowDate());
        return fsDoctorArticleMapper.updateFsDoctorArticle(fsDoctorArticle);
    }

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

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

    @Override
    public List<FsDoctorArticleListVO> selectFsDoctorArticleListVO(FsDoctorArticleScrm fsDoctorArticle) {
        return fsDoctorArticleMapper.selectFsDoctorArticleListVO(fsDoctorArticle);
    }

    @Override
    public List<FsDoctorArticleListUVO> selectFsDoctorArticleListUVO(FsDoctorArticleListUParam param) {
        return fsDoctorArticleMapper.selectFsDoctorArticleListUVO(param);
    }

    @Override
    public int updateViews(Long articleId) {
        return fsDoctorArticleMapper.updateViews(articleId);
    }

    @Override
    public FsDoctorArticleUVO selectFsDoctorArticleUVOByArticleId(Long articleId) {
        return fsDoctorArticleMapper.selectFsDoctorArticleUVOByArticleId(articleId);
    }

}
