package com.yanzhu.jh.base.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yanzhu.jh.base.mapper.BasePeriodicalMapper;
import com.yanzhu.jh.base.domain.BasePeriodical;
import com.yanzhu.jh.base.service.IBasePeriodicalService;
import com.ruoyi.common.utils.SecurityUtils;
/**
 * 期刊Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-09-23
 */
@Service
public class BasePeriodicalServiceImpl implements IBasePeriodicalService 
{
    @Autowired
    private BasePeriodicalMapper basePeriodicalMapper;

    /**
     * 查询期刊
     * 
     * @param id 期刊主键
     * @return 期刊
     */
    @Override
    public BasePeriodical selectBasePeriodicalById(Long id)
    {
        return basePeriodicalMapper.selectBasePeriodicalById(id);
    }

    /**
     * 查询期刊列表
     * 
     * @param basePeriodical 期刊
     * @return 期刊
     */
    @Override
    public List<BasePeriodical> selectBasePeriodicalList(BasePeriodical basePeriodical)
    {
        return basePeriodicalMapper.selectBasePeriodicalList(basePeriodical);
    }

    /**
     * 新增期刊
     * 
     * @param basePeriodical 期刊
     * @return 结果
     */
    @Override
    public int insertBasePeriodical(BasePeriodical basePeriodical)
    {
        basePeriodical.setCreateBy(SecurityUtils.getUsername());
        basePeriodical.setCreateTime(DateUtils.getNowDate());
        return basePeriodicalMapper.insertBasePeriodical(basePeriodical);
    }

    /**
     * 修改期刊
     * 
     * @param basePeriodical 期刊
     * @return 结果
     */
    @Override
    public int updateBasePeriodical(BasePeriodical basePeriodical)
    {
        basePeriodical.setUpdateBy(SecurityUtils.getUsername());
        basePeriodical.setUpdateTime(DateUtils.getNowDate());
        return basePeriodicalMapper.updateBasePeriodical(basePeriodical);
    }

    /**
     * 批量删除期刊
     * 
     * @param ids 需要删除的期刊主键
     * @return 结果
     */
    @Override
    public int deleteBasePeriodicalByIds(Long[] ids)
    {
        return basePeriodicalMapper.deleteBasePeriodicalByIds(ids);
    }

    /**
     * 删除期刊信息
     * 
     * @param id 期刊主键
     * @return 结果
     */
    @Override
    public int deleteBasePeriodicalById(Long id)
    {
        return basePeriodicalMapper.deleteBasePeriodicalById(id);
    }
}
