package com.waimai.web.admin.service.impl;

import java.util.List;
import com.waimai.common.utils.DateUtils;
import com.waimai.web.admin.domain.Carts;
import com.waimai.web.admin.mapper.CartsMapper;
import com.waimai.web.admin.service.ICartsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * cartsService业务层处理
 * 
 * @author callmeyan
 * @date 2023-04-07
 */
@Service
public class CartsServiceImpl implements ICartsService
{
    @Resource
    private CartsMapper cartsMapper;

    /**
     * 查询carts
     * 
     * @param fid carts主键
     * @return carts
     */
    @Override
    public Carts selectCartsById(Long fid,Long uid)
    {
        return cartsMapper.selectCartsById(fid,uid);
    }

    /**
     * 查询carts列表
     * 
     * @param carts carts
     * @return carts
     */
    @Override
    public List<Carts> selectCartsList(Carts carts)
    {
        return cartsMapper.selectCartsList(carts);
    }

    /**
     * 新增carts
     * 
     * @param carts carts
     * @return 结果
     */
    @Override
    public int insertCarts(Carts carts)
    {
        carts.setCreateTime(DateUtils.getNowDate());
        return cartsMapper.insertCarts(carts);
    }

    /**
     * 修改carts
     * 
     * @param carts carts
     * @return 结果
     */
    @Override
    public int updateCarts(Carts carts)
    {
        carts.setUpdateTime(DateUtils.getNowDate());
        return cartsMapper.updateCarts(carts);
    }

    /**
     * 批量删除carts
     * 
     * @param fids 需要删除的carts主键
     * @return 结果
     */
    @Override
    public int deleteCartsByFids(Long[] fids)
    {
        return cartsMapper.deleteCartsByFids(fids);
    }

    /**
     * 删除carts信息
     * 
     * @param fid carts主键
     * @return 结果
     */
    @Override
    public int deleteCartsByFid(Long fid)
    {
        return cartsMapper.deleteCartsByFid(fid);
    }
}
