package com.dcsoft.system.consume.service.impl;

import com.dcsoft.common.core.utils.DateUtils;
import com.dcsoft.system.consume.domain.ConsumeTimeInterval;
import com.dcsoft.system.consume.mapper.ConsumeTimeIntervalMapper;
import com.dcsoft.system.consume.service.IConsumeTimeIntervalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * 消费时段Service业务层处理
 *
 * @author nichun
 * @date 2023-09-14
 */
@Service
public class ConsumeTimeIntervalServiceImpl implements IConsumeTimeIntervalService
{
    @Autowired
    private ConsumeTimeIntervalMapper consumeTimeIntervalMapper;

    /**
     * 查询消费时段
     *
     * @param id 消费时段主键
     * @return 消费时段
     */
    @Override
    public ConsumeTimeInterval selectConsumeTimeIntervalById(Long id)
    {
        return consumeTimeIntervalMapper.selectConsumeTimeIntervalById(id);
    }

    /**
     * 查询消费时段列表
     *
     * @param consumeTimeInterval 消费时段
     * @return 消费时段
     */
    @Override
    public List<ConsumeTimeInterval> selectConsumeTimeIntervalList(ConsumeTimeInterval consumeTimeInterval)
    {
        return consumeTimeIntervalMapper.selectConsumeTimeIntervalList(consumeTimeInterval);
    }

    /**
     * 新增消费时段
     *
     * @param consumeTimeInterval 消费时段
     * @return 结果
     */
    @Override
    public int insertConsumeTimeInterval(ConsumeTimeInterval consumeTimeInterval)
    {
        consumeTimeInterval.setCreateTime(DateUtils.getNowDate());
        return consumeTimeIntervalMapper.insertConsumeTimeInterval(consumeTimeInterval);
    }

    /**
     * 修改消费时段
     *
     * @param consumeTimeInterval 消费时段
     * @return 结果
     */
    @Override
    public int updateConsumeTimeInterval(ConsumeTimeInterval consumeTimeInterval)
    {
        consumeTimeInterval.setUpdateTime(DateUtils.getNowDate());
        return consumeTimeIntervalMapper.updateConsumeTimeInterval(consumeTimeInterval);
    }

    /**
     * 批量删除消费时段
     *
     * @param ids 需要删除的消费时段主键
     * @return 结果
     */
    @Override
    public int deleteConsumeTimeIntervalByIds(Long[] ids)
    {
        return consumeTimeIntervalMapper.deleteConsumeTimeIntervalByIds(ids);
    }

    /**
     * 删除消费时段信息
     *
     * @param id 消费时段主键
     * @return 结果
     */
    @Override
    public int deleteConsumeTimeIntervalById(Long id)
    {
        return consumeTimeIntervalMapper.deleteConsumeTimeIntervalById(id);
    }
}
