package com.bonus.canteen.core.basic.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.basic.mapper.BasicCanteenSuggestionPictureMapper;
import com.bonus.canteen.core.basic.domain.BasicCanteenSuggestionPicture;
import com.bonus.canteen.core.basic.service.IBasicCanteenSuggestionPictureService;

/**
 * 订单评价菜品Service业务层处理
 * 
 * @author xsheng
 * @date 2025-05-25
 */
@Service
public class BasicCanteenSuggestionPictureServiceImpl implements IBasicCanteenSuggestionPictureService {
    @Autowired
    private BasicCanteenSuggestionPictureMapper basicCanteenSuggestionPictureMapper;

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

    /**
     * 查询订单评价菜品列表
     * 
     * @param basicCanteenSuggestionPicture 订单评价菜品
     * @return 订单评价菜品
     */
    @Override
    public List<BasicCanteenSuggestionPicture> selectBasicCanteenSuggestionPictureList(BasicCanteenSuggestionPicture basicCanteenSuggestionPicture) {
        return basicCanteenSuggestionPictureMapper.selectBasicCanteenSuggestionPictureList(basicCanteenSuggestionPicture);
    }

    /**
     * 新增订单评价菜品
     * 
     * @param basicCanteenSuggestionPicture 订单评价菜品
     * @return 结果
     */
    @Override
    public int insertBasicCanteenSuggestionPicture(BasicCanteenSuggestionPicture basicCanteenSuggestionPicture) {
        basicCanteenSuggestionPicture.setCreateTime(DateUtils.getNowDate());
        try {
            return basicCanteenSuggestionPictureMapper.insertBasicCanteenSuggestionPicture(basicCanteenSuggestionPicture);
        } catch (Exception e) {
            throw new ServiceException(e.getMessage());
        }
    }

    /**
     * 修改订单评价菜品
     * 
     * @param basicCanteenSuggestionPicture 订单评价菜品
     * @return 结果
     */
    @Override
    public int updateBasicCanteenSuggestionPicture(BasicCanteenSuggestionPicture basicCanteenSuggestionPicture) {
        basicCanteenSuggestionPicture.setUpdateTime(DateUtils.getNowDate());
        try {
            return basicCanteenSuggestionPictureMapper.updateBasicCanteenSuggestionPicture(basicCanteenSuggestionPicture);
        } catch (Exception e) {
            throw new ServiceException(e.getMessage());
        }
    }

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

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