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.ClothAdjunctMapper;
import com.yiqi.core.domain.ClothAdjunct;
import com.yiqi.core.service.IClothAdjunctService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

/**
 * 衣服附件Service业务层处理
 *
 * @author xiaohei
 * @date 2023-08-20
 */
@Service
public class ClothAdjunctServiceImpl extends ServiceImpl<ClothAdjunctMapper,ClothAdjunct> implements IClothAdjunctService {

    /**
     * 查询衣服附件
     *
     * @param id 衣服附件主键
     * @return 衣服附件
     */
    @Override
    public ClothAdjunct selectClothAdjunctById(Long id) {
        return baseMapper.selectClothAdjunctById(id);
    }

    /**
     * 查询衣服附件列表
     *
     * @param clothAdjunct 衣服附件
     * @return 衣服附件
     */
    @Override
    public List<ClothAdjunct> selectClothAdjunctList(ClothAdjunct clothAdjunct) {
        return baseMapper.selectClothAdjunctList(clothAdjunct);
    }

    /**
     * 新增衣服附件
     *
     * @param clothAdjunct 衣服附件
     * @return 结果
     */
    @Override
    public int insertClothAdjunct(ClothAdjunct clothAdjunct) {
        clothAdjunct.setCreateTime(DateUtils.getNowDate());
        return baseMapper.insertClothAdjunct(clothAdjunct);
    }

    /**
     * 修改衣服附件
     *
     * @param clothAdjunct 衣服附件
     * @return 结果
     */
    @Override
    public int updateClothAdjunct(ClothAdjunct clothAdjunct) {
        clothAdjunct.setUpdateTime(DateUtils.getNowDate());
        return baseMapper.updateClothAdjunct(clothAdjunct);
    }

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

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

    /**
     * 修改衣服附件状态
     *
     * @param clothAdjunct 衣服附件
     * @return 结果
     */
    @Override
    public int updateClothAdjunctStatus(ClothAdjunct clothAdjunct) {
        clothAdjunct.setUpdateById(SecurityUtils.getUserId());
        clothAdjunct.setUpdateBy(SecurityUtils.getUsername());
        clothAdjunct.setUpdateTime(DateUtils.getNowDate());
        return baseMapper.updateClothAdjunct(clothAdjunct);
    }


}
