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.ClothBrandMapper;
import com.yiqi.core.domain.ClothBrand;
import com.yiqi.core.service.IClothBrandService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

/**
 * 衣服品牌Service业务层处理
 *
 * @author ruoyi
 * @date 2023-10-16
 */
@Service
public class ClothBrandServiceImpl extends ServiceImpl<ClothBrandMapper,ClothBrand> implements IClothBrandService {

    /**
     * 查询衣服品牌
     *
     * @param id 衣服品牌主键
     * @return 衣服品牌
     */
    @Override
    public ClothBrand selectClothBrandById(Long id) {
        return baseMapper.selectClothBrandById(id);
    }

    /**
     * 查询衣服品牌列表
     *
     * @param clothBrand 衣服品牌
     * @return 衣服品牌
     */
    @Override
    public List<ClothBrand> selectClothBrandList(ClothBrand clothBrand) {
        return baseMapper.selectClothBrandList(clothBrand);
    }

    /**
     * 新增衣服品牌
     *
     * @param clothBrand 衣服品牌
     * @return 结果
     */
    @Override
    public int insertClothBrand(ClothBrand clothBrand) {
        clothBrand.setCreateTime(DateUtils.getNowDate());
        return baseMapper.insertClothBrand(clothBrand);
    }

    /**
     * 修改衣服品牌
     *
     * @param clothBrand 衣服品牌
     * @return 结果
     */
    @Override
    public int updateClothBrand(ClothBrand clothBrand) {
        clothBrand.setUpdateTime(DateUtils.getNowDate());
        return baseMapper.updateClothBrand(clothBrand);
    }

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

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

    /**
     * 修改衣服品牌状态
     *
     * @param clothBrand 衣服品牌
     * @return 结果
     */
    @Override
    public int updateClothBrandStatus(ClothBrand clothBrand) {
        clothBrand.setUpdateById(SecurityUtils.getUserId());
        clothBrand.setUpdateBy(SecurityUtils.getUsername());
        clothBrand.setUpdateTime(DateUtils.getNowDate());
        return baseMapper.updateClothBrand(clothBrand);
    }


}
