package com.ruoyi.frequency.mallspecifications.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.frequency.mallspecifications.mapper.MallSpecificationsMapper;
import com.ruoyi.frequency.mallspecifications.entity.MallSpecifications;
import com.ruoyi.frequency.mallspecifications.service.MallSpecificationsService;

/**
 * 单规格规格Service业务层处理
 *
 * @author liwenlong
 * @date 2024-01-25
 */
@Service
public class MallSpecificationsServiceImpl extends ServiceImpl<MallSpecificationsMapper, MallSpecifications>  implements MallSpecificationsService
{
    @Autowired
    private MallSpecificationsMapper mallSpecificationsMapper;

    /**
     * 查询单规格规格
     *
     * @param id 单规格规格主键
     * @return 单规格规格
     */
    @Override
    public MallSpecifications selectMallSpecificationsById(Long id)
    {
        return mallSpecificationsMapper.selectMallSpecificationsById(id);
    }

    /**
     * 查询单规格规格列表
     *
     * @param mallSpecifications 单规格规格
     * @return 单规格规格
     */
    @Override
    public List<MallSpecifications> selectMallSpecificationsList(MallSpecifications mallSpecifications)
    {
        return mallSpecificationsMapper.selectMallSpecificationsList(mallSpecifications);
    }

    /**
     * 新增单规格规格
     *
     * @param mallSpecifications 单规格规格
     * @return 结果
     */
    @Override
    public int insertMallSpecifications(MallSpecifications mallSpecifications)
    {
        mallSpecifications.setCreateData();
        return mallSpecificationsMapper.insert(mallSpecifications);
    }

    /**
     * 修改单规格规格
     *
     * @param mallSpecifications 单规格规格
     * @return 结果
     */
    @Override
    public int updateMallSpecifications(MallSpecifications mallSpecifications)
    {
        mallSpecifications.setUpdateData();
        return mallSpecificationsMapper.updateMallSpecifications(mallSpecifications);
    }

    /**
     * 批量删除单规格规格
     *
     * @param ids 需要删除的单规格规格主键
     * @return 结果
     */
    @Override
    public int deleteMallSpecificationsByIds(Long[] ids,Integer delFlag)
    {
        this.lambdaUpdate().set(MallSpecifications::getDelFlag,delFlag).in(MallSpecifications::getId,ids).update();
        return ids.length;
    }

}
