package com.yiqi.core.service.impl;

import java.util.List;
import com.yiqi.common.utils.DateUtils;
import com.yiqi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yiqi.core.mapper.ClothSpeedMapper;
import com.yiqi.core.domain.ClothSpeed;
import com.yiqi.core.service.IClothSpeedService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

/**
 * 洗衣速度Service业务层处理
 *
 * @author xiaohei
 * @date 2023-08-20
 */
@Service
public class ClothSpeedServiceImpl extends ServiceImpl<ClothSpeedMapper,ClothSpeed> implements IClothSpeedService {

    /**
     * 查询洗衣速度
     *
     * @param id 洗衣速度主键
     * @return 洗衣速度
     */
    @Override
    public ClothSpeed selectClothSpeedById(Long id) {
        return baseMapper.selectClothSpeedById(id);
    }

    /**
     * 查询洗衣速度列表
     *
     * @param clothSpeed 洗衣速度
     * @return 洗衣速度
     */
    @Override
    public List<ClothSpeed> selectClothSpeedList(ClothSpeed clothSpeed) {
        return baseMapper.selectClothSpeedList(clothSpeed);
    }

    /**
     * 新增洗衣速度
     *
     * @param clothSpeed 洗衣速度
     * @return 结果
     */
    @Override
    public int insertClothSpeed(ClothSpeed clothSpeed) {
        clothSpeed.setCreateTime(DateUtils.getNowDate());
        return baseMapper.insertClothSpeed(clothSpeed);
    }

    /**
     * 修改洗衣速度
     *
     * @param clothSpeed 洗衣速度
     * @return 结果
     */
    @Override
    public int updateClothSpeed(ClothSpeed clothSpeed) {
        clothSpeed.setUpdateTime(DateUtils.getNowDate());
        return baseMapper.updateClothSpeed(clothSpeed);
    }

    /**
     * 批量删除洗衣速度
     *
     * @param ids 需要删除的洗衣速度主键
     * @return 结果
     */
    @Override
    public int deleteClothSpeedByIds(Long[] ids) {
        return baseMapper.deleteClothSpeedByIds(ids);
    }

    /**
     * 删除洗衣速度信息
     *
     * @param id 洗衣速度主键
     * @return 结果
     */
    @Override
    public int deleteClothSpeedById(Long id) {
        return baseMapper.deleteClothSpeedById(id);
    }

    /**
     * 修改洗衣速度状态
     *
     * @param clothSpeed 洗衣速度
     * @return 结果
     */
    @Override
    public int updateClothSpeedStatus(ClothSpeed clothSpeed) {
        clothSpeed.setUpdateById(SecurityUtils.getUserId());
        clothSpeed.setUpdateBy(SecurityUtils.getUsername());
        clothSpeed.setUpdateTime(DateUtils.getNowDate());
        return baseMapper.updateClothSpeed(clothSpeed);
    }


}
