package com.fs.course.service.impl;

import java.time.LocalDateTime;
import java.util.List;
import com.fs.common.utils.DateUtils;
import com.fs.course.vo.FsUserCoursePeriodVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.fs.course.mapper.FsUserCoursePeriodMapper;
import com.fs.course.domain.FsUserCoursePeriod;
import com.fs.course.service.IFsUserCoursePeriodService;

/**
 * 会员营期Service业务层处理
 *
 * @author fs
 * @date 2025-04-15
 */
@Service
public class FsUserCoursePeriodServiceImpl implements IFsUserCoursePeriodService
{
    @Autowired
    private FsUserCoursePeriodMapper fsUserCoursePeriodMapper;

    /**
     * 查询会员营期
     *
     * @param periodId 会员营期ID
     * @return 会员营期
     */
    @Override
    public FsUserCoursePeriod selectFsUserCoursePeriodById(Long periodId)
    {
        return fsUserCoursePeriodMapper.selectFsUserCoursePeriodById(periodId);
    }

    /**
     * 查询会员营期列表
     *
     * @param fsUserCoursePeriod 会员营期
     * @return 会员营期
     */
    @Override
    public List<FsUserCoursePeriod> selectFsUserCoursePeriodList(FsUserCoursePeriod fsUserCoursePeriod)
    {
        return fsUserCoursePeriodMapper.selectFsUserCoursePeriodList(fsUserCoursePeriod);
    }

    /**
     * 新增会员营期
     *
     * @param fsUserCoursePeriod 会员营期
     * @return 结果
     */
    @Override
    public int insertFsUserCoursePeriod(FsUserCoursePeriod fsUserCoursePeriod)
    {
        fsUserCoursePeriod.setCreateTime(LocalDateTime.now());
        return fsUserCoursePeriodMapper.insertFsUserCoursePeriod(fsUserCoursePeriod);
    }

    /**
     * 修改会员营期
     *
     * @param fsUserCoursePeriod 会员营期
     * @return 结果
     */
    @Override
    public int updateFsUserCoursePeriod(FsUserCoursePeriod fsUserCoursePeriod)
    {
        fsUserCoursePeriod.setUpdateTime(LocalDateTime.now());
        return fsUserCoursePeriodMapper.updateFsUserCoursePeriod(fsUserCoursePeriod);
    }

    /**
     * 批量删除会员营期
     *
     * @param periodIds 需要删除的会员营期ID
     * @return 结果
     */
    @Override
    public int deleteFsUserCoursePeriodByIds(Long[] periodIds)
    {
        return fsUserCoursePeriodMapper.deleteFsUserCoursePeriodByIds(periodIds);
    }

    /**
     * 删除会员营期信息
     *
     * @param periodId 会员营期ID
     * @return 结果
     */
    @Override
    public int deleteFsUserCoursePeriodById(Long periodId)
    {
        return fsUserCoursePeriodMapper.deleteFsUserCoursePeriodById(periodId);
    }

    @Override
    public List<FsUserCoursePeriodVO> selectFsUserCoursePeriodPage(FsUserCoursePeriod fsUserCoursePeriod) {
        return fsUserCoursePeriodMapper.selectFsUserCoursePeriodPage(fsUserCoursePeriod);
    }
}
