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

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

/**
 * 食品分类Service业务层处理
 * 
 * @author callmeyan
 * @date 2023-03-24
 */
@Service
public class FoodCategoryServiceImpl implements IFoodCategoryService 
{
    @Autowired
    private FoodCategoryMapper foodCategoryMapper;

    /**
     * 查询食品分类
     * 
     * @param id 食品分类主键
     * @return 食品分类
     */
    @Override
    public FoodCategory selectFoodCategoryById(Long id)
    {
        return foodCategoryMapper.selectFoodCategoryById(id);
    }

    /**
     * 查询食品分类列表
     * 
     * @param foodCategory 食品分类
     * @return 食品分类
     */
    @Override
    public List<FoodCategory> selectFoodCategoryList(FoodCategory foodCategory)
    {
        return foodCategoryMapper.selectFoodCategoryList(foodCategory);
    }

    /**
     * 新增食品分类
     * 
     * @param foodCategory 食品分类
     * @return 结果
     */
    @Override
    public int insertFoodCategory(FoodCategory foodCategory)
    {
        foodCategory.setCreateTime(DateUtils.getNowDate());
        return foodCategoryMapper.insertFoodCategory(foodCategory);
    }

    /**
     * 修改食品分类
     * 
     * @param foodCategory 食品分类
     * @return 结果
     */
    @Override
    public int updateFoodCategory(FoodCategory foodCategory)
    {
        foodCategory.setUpdateTime(DateUtils.getNowDate());
        return foodCategoryMapper.updateFoodCategory(foodCategory);
    }

    /**
     * 批量删除食品分类
     * 
     * @param ids 需要删除的食品分类主键
     * @return 结果
     */
    @Override
    public int deleteFoodCategoryByIds(Long[] ids)
    {
        return foodCategoryMapper.deleteFoodCategoryByIds(ids);
    }

    /**
     * 删除食品分类信息
     * 
     * @param id 食品分类主键
     * @return 结果
     */
    @Override
    public int deleteFoodCategoryById(Long id)
    {
        return foodCategoryMapper.deleteFoodCategoryById(id);
    }
}
