package com.bonus.canteen.core.menu.service.impl;

import java.util.List;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.bonus.canteen.core.menu.mapper.MenuEvaluaPictureMapper;
import com.bonus.canteen.core.menu.domain.MenuEvaluaPicture;
import com.bonus.canteen.core.menu.service.IMenuEvaluaPictureService;

/**
 * 订单评价菜品Service业务层处理
 * 
 * @author xsheng
 * @date 2025-04-20
 */
@Service
public class MenuEvaluaPictureServiceImpl implements IMenuEvaluaPictureService {
    @Autowired
    private MenuEvaluaPictureMapper menuEvaluaPictureMapper;

    /**
     * 查询订单评价菜品
     * 
     * @param id 订单评价菜品主键
     * @return 订单评价菜品
     */
    @Override
    public MenuEvaluaPicture selectMenuEvaluaPictureById(Long id) {
        return menuEvaluaPictureMapper.selectMenuEvaluaPictureById(id);
    }

    /**
     * 查询订单评价菜品列表
     * 
     * @param menuEvaluaPicture 订单评价菜品
     * @return 订单评价菜品
     */
    @Override
    public List<MenuEvaluaPicture> selectMenuEvaluaPictureList(MenuEvaluaPicture menuEvaluaPicture) {
        return menuEvaluaPictureMapper.selectMenuEvaluaPictureList(menuEvaluaPicture);
    }

    /**
     * 新增订单评价菜品
     * 
     * @param menuEvaluaPicture 订单评价菜品
     * @return 结果
     */
    @Override
    public int insertMenuEvaluaPicture(MenuEvaluaPicture menuEvaluaPicture) {
        menuEvaluaPicture.setCreateTime(DateUtils.getNowDate());
        try {
            return menuEvaluaPictureMapper.insertMenuEvaluaPicture(menuEvaluaPicture);
        } catch (Exception e) {
            throw new ServiceException("错误信息描述, " + e.getMessage());
        }
    }

    /**
     * 修改订单评价菜品
     * 
     * @param menuEvaluaPicture 订单评价菜品
     * @return 结果
     */
    @Override
    public int updateMenuEvaluaPicture(MenuEvaluaPicture menuEvaluaPicture) {
        menuEvaluaPicture.setUpdateTime(DateUtils.getNowDate());
        try {
            return menuEvaluaPictureMapper.updateMenuEvaluaPicture(menuEvaluaPicture);
        } catch (Exception e) {
            throw new ServiceException("错误信息描述, " + e.getMessage());
        }
    }

    /**
     * 批量删除订单评价菜品
     * 
     * @param ids 需要删除的订单评价菜品主键
     * @return 结果
     */
    @Override
    public int deleteMenuEvaluaPictureByIds(Long[] ids) {
        return menuEvaluaPictureMapper.deleteMenuEvaluaPictureByIds(ids);
    }

    /**
     * 删除订单评价菜品信息
     * 
     * @param id 订单评价菜品主键
     * @return 结果
     */
    @Override
    public int deleteMenuEvaluaPictureById(Long id) {
        return menuEvaluaPictureMapper.deleteMenuEvaluaPictureById(id);
    }
}
