package com.bonus.canteen.core.cook.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.cook.mapper.CookEvaluaPictureMapper;
import com.bonus.canteen.core.cook.domain.CookEvaluaPicture;
import com.bonus.canteen.core.cook.service.ICookEvaluaPictureService;

/**
 * 订单评价菜品Service业务层处理
 * 
 * @author xsheng
 * @date 2025-05-25
 */
@Service
public class CookEvaluaPictureServiceImpl implements ICookEvaluaPictureService {
    @Autowired
    private CookEvaluaPictureMapper cookEvaluaPictureMapper;

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

    /**
     * 查询订单评价菜品列表
     * 
     * @param cookEvaluaPicture 订单评价菜品
     * @return 订单评价菜品
     */
    @Override
    public List<CookEvaluaPicture> selectCookEvaluaPictureList(CookEvaluaPicture cookEvaluaPicture) {
        return cookEvaluaPictureMapper.selectCookEvaluaPictureList(cookEvaluaPicture);
    }

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

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

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

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