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.ClothTextureMapper;
import com.yiqi.core.domain.ClothTexture;
import com.yiqi.core.service.IClothTextureService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

/**
 * 衣服质地Service业务层处理
 *
 * @author xiaohei
 * @date 2023-08-20
 */
@Service
public class ClothTextureServiceImpl extends ServiceImpl<ClothTextureMapper,ClothTexture> implements IClothTextureService {

    /**
     * 查询衣服质地
     *
     * @param id 衣服质地主键
     * @return 衣服质地
     */
    @Override
    public ClothTexture selectClothTextureById(Long id) {
        return baseMapper.selectClothTextureById(id);
    }

    /**
     * 查询衣服质地列表
     *
     * @param clothTexture 衣服质地
     * @return 衣服质地
     */
    @Override
    public List<ClothTexture> selectClothTextureList(ClothTexture clothTexture) {
        return baseMapper.selectClothTextureList(clothTexture);
    }

    /**
     * 新增衣服质地
     *
     * @param clothTexture 衣服质地
     * @return 结果
     */
    @Override
    public int insertClothTexture(ClothTexture clothTexture) {
        clothTexture.setCreateTime(DateUtils.getNowDate());
        return baseMapper.insertClothTexture(clothTexture);
    }

    /**
     * 修改衣服质地
     *
     * @param clothTexture 衣服质地
     * @return 结果
     */
    @Override
    public int updateClothTexture(ClothTexture clothTexture) {
        clothTexture.setUpdateTime(DateUtils.getNowDate());
        return baseMapper.updateClothTexture(clothTexture);
    }

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

    /**
     * 删除衣服质地信息
     *
     * @param id 衣服质地主键
     * @return 结果
     */
    @Override
    public int deleteClothTextureById(Long id) {
        return baseMapper.deleteClothTextureById(id);
    }

    /**
     * 修改衣服质地状态
     *
     * @param clothTexture 衣服质地
     * @return 结果
     */
    @Override
    public int updateClothTextureStatus(ClothTexture clothTexture) {
        clothTexture.setUpdateById(SecurityUtils.getUserId());
        clothTexture.setUpdateBy(SecurityUtils.getUsername());
        clothTexture.setUpdateTime(DateUtils.getNowDate());
        return baseMapper.updateClothTexture(clothTexture);
    }


}
