package com.xinelu.manage.service.basenursinginfo.impl;

import com.xinelu.manage.domain.basenursinginfo.BaseNursingInfo;
import com.xinelu.manage.mapper.basenursinginfo.BaseNursingInfoMapper;
import com.xinelu.manage.service.basenursinginfo.IBaseNursingInfoService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;

/**
 * 护理知识库Service业务层处理
 *
 * @author xinelu
 * @date 2024-05-17
 */
@Service
public class BaseNursingInfoServiceImpl implements IBaseNursingInfoService {
    @Resource
    private BaseNursingInfoMapper baseNursingInfoMapper;

    /**
     * 查询护理知识库
     *
     * @param id 护理知识库主键
     * @return 护理知识库
     */
    @Override
    public BaseNursingInfo selectBaseNursingInfoById(Long id) {
        return baseNursingInfoMapper.selectBaseNursingInfoById(id);
    }

    /**
     * 查询护理知识库列表
     *
     * @param baseNursingInfo 护理知识库
     * @return 护理知识库
     */
    @Override
    public List<BaseNursingInfo> selectBaseNursingInfoList(BaseNursingInfo baseNursingInfo) {
        return baseNursingInfoMapper.selectBaseNursingInfoList(baseNursingInfo);
    }

    /**
     * 新增护理知识库
     *
     * @param baseNursingInfo 护理知识库
     * @return 结果
     */
    @Override
    public int insertBaseNursingInfo(BaseNursingInfo baseNursingInfo) {
        baseNursingInfo.setCreateTime(LocalDateTime.now());
        return baseNursingInfoMapper.insertBaseNursingInfo(baseNursingInfo);
    }

    /**
     * 修改护理知识库
     *
     * @param baseNursingInfo 护理知识库
     * @return 结果
     */
    @Override
    public int updateBaseNursingInfo(BaseNursingInfo baseNursingInfo) {
        baseNursingInfo.setUpdateTime(LocalDateTime.now());
        return baseNursingInfoMapper.updateBaseNursingInfo(baseNursingInfo);
    }

    /**
     * 批量删除护理知识库
     *
     * @param ids 需要删除的护理知识库主键
     * @return 结果
     */
    @Override
    public int deleteBaseNursingInfoByIds(Long[] ids) {
        return baseNursingInfoMapper.deleteBaseNursingInfoByIds(ids);
    }

    /**
     * 删除护理知识库信息
     *
     * @param id 护理知识库主键
     * @return 结果
     */
    @Override
    public int deleteBaseNursingInfoById(Long id) {
        return baseNursingInfoMapper.deleteBaseNursingInfoById(id);
    }
}
