package com.xingxi.business.PopularProd.service.impl;

import com.xingxi.common.core.text.Convert;
import com.xingxi.common.utils.DateUtils;
import com.xingxi.business.PopularProd.domain.PopularProd;
import com.xingxi.business.PopularProd.mapper.PopularProdMapper;
import com.xingxi.business.PopularProd.service.IPopularProdService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 今日热门Service业务层处理
 *
 * @author xingxi
 * @date 2025-03-06
 */
@Service
public class PopularProdServiceImpl implements IPopularProdService {
    @Resource
    private PopularProdMapper popularProdMapper;

    /**
     * 查询今日热门
     *
     * @param id 今日热门主键
     * @return 今日热门
     */
    @Override
    public PopularProd selectPopularProdById(Long id) {
        return popularProdMapper.selectPopularProdById(id);
    }

    /**
     * 查询今日热门列表
     *
     * @param popularProd 今日热门
     * @return 今日热门
     */
    @Override
    public List<PopularProd> selectPopularProdList(PopularProd popularProd) {


        return popularProdMapper.selectPopularProdList(popularProd);
    }

    /**
     * 新增今日热门
     *
     * @param popularProd 今日热门
     * @return 结果
     */
    @Override
    public int insertPopularProd(PopularProd popularProd) {
        popularProd.setCreateTime(DateUtils.getNowDate());
        return popularProdMapper.insertPopularProd(popularProd);
    }

    /**
     * 新增今日热门
     *
     * @param popularProdList 今日热门
     * @return 结果
     */
    @Override
    public int batchInsertPopularProd(List<PopularProd> popularProdList) {
        return popularProdMapper.batchInsertPopularProd(popularProdList);
    }

    /**
     * 修改今日热门
     *
     * @param popularProd 今日热门
     * @return 结果
     */
    @Override
    public int updatePopularProd(PopularProd popularProd) {
        popularProd.setUpdateTime(DateUtils.getNowDate());
        return popularProdMapper.updatePopularProd(popularProd);
    }

    /**
     * 批量删除今日热门
     *
     * @param ids 需要删除的今日热门主键
     * @return 结果
     */
    @Override
    public int deletePopularProdByIds(String ids) {
        return popularProdMapper.deletePopularProdByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除今日热门信息
     *
     * @param id 今日热门主键
     * @return 结果
     */
    @Override
    public int deletePopularProdById(Long id) {
        return popularProdMapper.deletePopularProdById(id);
    }

    /**
     * 逻辑删除今日热门
     *
     * @param id 今日热门主键
     * @return 结果
     */
    @Override
    public int logicDeletePopularProdById(Long id) {
        return popularProdMapper.logicDeletePopularProdById(id);
    }

    /**
     * 逻辑批量删除今日热门
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    @Override
    public int logicDeletePopularProdByIds(String[] ids) {
        return popularProdMapper.logicDeletePopularProdByIds(ids);
    }

    /**
     * 逻辑批量删除今日热门
     *
     * @param popularProd 今日热门
     * @return 结果
     */
    @Override
    public int logicDeletePopularProdByCondition(PopularProd popularProd) {
        return popularProdMapper.logicDeletePopularProdByCondition(popularProd);
    }
}
