package com.yiqi.core.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.conditions.query.QueryChainWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yiqi.common.utils.DateUtils;
import com.yiqi.core.domain.ClothRewashReason;
import com.yiqi.core.domain.ClothRewashReasonType;
import com.yiqi.core.domain.vo.ClothRewashReasonVO;
import com.yiqi.core.mapper.ClothRewashReasonMapper;
import com.yiqi.core.service.IClothRewashReasonService;
import com.yiqi.core.service.IClothRewashReasonTypeService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * 衣服重洗原因Service业务层处理
 *
 * @author ruoyi
 * @date 2023-09-23
 */
@Service
public class ClothRewashReasonServiceImpl extends ServiceImpl<ClothRewashReasonMapper, ClothRewashReason> implements IClothRewashReasonService {

    @Autowired
    IClothRewashReasonTypeService clothRewashReasonTypeService;


    /**
     * 查询衣服重洗原因
     *
     * @param id 衣服重洗原因主键
     * @return 衣服重洗原因
     */
    @Override
    public ClothRewashReasonVO selectClothRewashReasonById(Long id) {
        return baseMapper.selectClothRewashReasonById(id);
    }

    /**
     * 查询衣服重洗原因列表
     *
     * @param clothRewashReasonVO 衣服重洗原因
     * @return 衣服重洗原因
     */
    @Override
    public List<ClothRewashReasonVO> selectClothRewashReasonList(ClothRewashReasonVO clothRewashReasonVO) {
        return baseMapper.selectClothRewashReasonList(clothRewashReasonVO);
    }

    /**
     * 新增衣服重洗原因
     *
     * @param clothRewashReasonVO 衣服重洗原因
     * @return 结果
     */
    @Override
    public int insertClothRewashReason(ClothRewashReasonVO clothRewashReasonVO) {
        ClothRewashReason clothRewashReason = new ClothRewashReason();
        BeanUtils.copyProperties(clothRewashReasonVO, clothRewashReason);
        clothRewashReason.setDelFlag("0");
        clothRewashReason.setCreateTime(new Date());
        return baseMapper.insertClothRewashReason(clothRewashReason);
    }

    /**
     * 修改衣服重洗原因
     *
     * @param clothRewashReasonVO 衣服重洗原因
     * @return 结果
     */
    @Override
    public int updateClothRewashReason(ClothRewashReasonVO clothRewashReasonVO) {
        ClothRewashReason clothRewashReason = new ClothRewashReason();
        BeanUtils.copyProperties(clothRewashReasonVO, clothRewashReason);
        return baseMapper.updateClothRewashReason(clothRewashReason);

    }

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

    /**
     * 删除衣服重洗原因信息
     *
     * @param id 衣服重洗原因主键
     * @return 结果
     */
    @Override
    public int deleteClothRewashReasonById(Long id) {
        return baseMapper.deleteClothRewashReasonById(id);
    }


}
