package com.ghy.customer.service.impl;

import java.util.List;
import com.ghy.common.utils.DateUtils;
import com.ghy.customer.domain.CustomerSelection;
import com.ghy.customer.mapper.CustomerSelectionMapper;
import com.ghy.customer.service.ICustomerSelectionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ghy.common.core.text.Convert;

/**
 * 消费者选品Service业务层处理
 *
 * @author clunt
 * @date 2023-01-15
 */
@Service
public class CustomerSelectionServiceImpl implements ICustomerSelectionService
{
    @Autowired
    private CustomerSelectionMapper customerSelectionMapper;

    /**
     * 查询消费者选品
     *
     * @param id 消费者选品主键
     * @return 消费者选品
     */
    @Override
    public CustomerSelection selectCustomerSelectionById(String id)
    {
        return customerSelectionMapper.selectCustomerSelectionById(id);
    }

    /**
     * 查询消费者选品列表
     *
     * @param customerSelection 消费者选品
     * @return 消费者选品
     */
    @Override
    public List<CustomerSelection> selectCustomerSelectionList(CustomerSelection customerSelection)
    {
        return customerSelectionMapper.selectCustomerSelectionList(customerSelection);
    }

    /**
     * 新增消费者选品
     *
     * @param customerSelection 消费者选品
     * @return 结果
     */
    @Override
    public int insertCustomerSelection(CustomerSelection customerSelection)
    {
        customerSelection.setCreateTime(DateUtils.getNowDate());
        return customerSelectionMapper.insertCustomerSelection(customerSelection);
    }

    /**
     * 修改消费者选品
     *
     * @param customerSelection 消费者选品
     * @return 结果
     */
    @Override
    public int updateCustomerSelection(CustomerSelection customerSelection)
    {
        customerSelection.setUpdateTime(DateUtils.getNowDate());
        return customerSelectionMapper.updateCustomerSelection(customerSelection);
    }

    /**
     * 批量删除消费者选品
     *
     * @param ids 需要删除的消费者选品主键
     * @return 结果
     */
    @Override
    public int deleteCustomerSelectionByIds(String ids)
    {
        return customerSelectionMapper.deleteCustomerSelectionByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除消费者选品信息
     *
     * @param id 消费者选品主键
     * @return 结果
     */
    @Override
    public int deleteCustomerSelectionById(String id)
    {
        return customerSelectionMapper.deleteCustomerSelectionById(id);
    }
}
