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

import com.xinelu.manage.domain.basesportinfo.BaseSportInfo;
import com.xinelu.manage.mapper.basesportinfo.BaseSportInfoMapper;
import com.xinelu.manage.service.basesportinfo.IBaseSportInfoService;
import org.springframework.stereotype.Service;

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

/**
 * 运动知识库Service业务层处理
 *
 * @author xinelu
 * @date 2024-05-16
 */
@Service
public class BaseSportInfoServiceImpl implements IBaseSportInfoService {
    @Resource
    private BaseSportInfoMapper baseSportInfoMapper;

    /**
     * 查询运动知识库
     *
     * @param id 运动知识库主键
     * @return 运动知识库
     */
    @Override
    public BaseSportInfo selectBaseSportInfoById(Long id) {
        return baseSportInfoMapper.selectBaseSportInfoById(id);
    }

    /**
     * 查询运动知识库列表
     *
     * @param baseSportInfo 运动知识库
     * @return 运动知识库
     */
    @Override
    public List<BaseSportInfo> selectBaseSportInfoList(BaseSportInfo baseSportInfo) {
        return baseSportInfoMapper.selectBaseSportInfoList(baseSportInfo);
    }

    /**
     * 新增运动知识库
     *
     * @param baseSportInfo 运动知识库
     * @return 结果
     */
    @Override
    public int insertBaseSportInfo(BaseSportInfo baseSportInfo) {
        baseSportInfo.setCreateTime(LocalDateTime.now());
        return baseSportInfoMapper.insertBaseSportInfo(baseSportInfo);
    }

    /**
     * 修改运动知识库
     *
     * @param baseSportInfo 运动知识库
     * @return 结果
     */
    @Override
    public int updateBaseSportInfo(BaseSportInfo baseSportInfo) {
        baseSportInfo.setUpdateTime(LocalDateTime.now());
        return baseSportInfoMapper.updateBaseSportInfo(baseSportInfo);
    }

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

    /**
     * 删除运动知识库信息
     *
     * @param id 运动知识库主键
     * @return 结果
     */
    @Override
    public int deleteBaseSportInfoById(Long id) {
        return baseSportInfoMapper.deleteBaseSportInfoById(id);
    }
}
