package com.bonus.canteen.core.kitchen.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.kitchen.mapper.KitchenWasteDealMapper;
import com.bonus.canteen.core.kitchen.domain.KitchenWasteDeal;
import com.bonus.canteen.core.kitchen.service.IKitchenWasteDealService;

/**
 * 厨房废弃物处置Service业务层处理
 * 
 * @author xsheng
 * @date 2025-06-16
 */
@Service
public class KitchenWasteDealServiceImpl implements IKitchenWasteDealService {
    @Autowired
    private KitchenWasteDealMapper kitchenWasteDealMapper;

    /**
     * 查询厨房废弃物处置
     * 
     * @param wasteId 厨房废弃物处置主键
     * @return 厨房废弃物处置
     */
    @Override
    public KitchenWasteDeal selectKitchenWasteDealByWasteId(Long wasteId) {
        return kitchenWasteDealMapper.selectKitchenWasteDealByWasteId(wasteId);
    }

    /**
     * 查询厨房废弃物处置列表
     * 
     * @param kitchenWasteDeal 厨房废弃物处置
     * @return 厨房废弃物处置
     */
    @Override
    public List<KitchenWasteDeal> selectKitchenWasteDealList(KitchenWasteDeal kitchenWasteDeal) {
        return kitchenWasteDealMapper.selectKitchenWasteDealList(kitchenWasteDeal);
    }

    /**
     * 新增厨房废弃物处置
     * 
     * @param kitchenWasteDeal 厨房废弃物处置
     * @return 结果
     */
    @Override
    public int insertKitchenWasteDeal(KitchenWasteDeal kitchenWasteDeal) {
        kitchenWasteDeal.setCreateTime(DateUtils.getNowDate());
        try {
            return kitchenWasteDealMapper.insertKitchenWasteDeal(kitchenWasteDeal);
        } catch (Exception e) {
            throw new ServiceException(e.getMessage());
        }
    }

    /**
     * 修改厨房废弃物处置
     * 
     * @param kitchenWasteDeal 厨房废弃物处置
     * @return 结果
     */
    @Override
    public int updateKitchenWasteDeal(KitchenWasteDeal kitchenWasteDeal) {
        kitchenWasteDeal.setUpdateTime(DateUtils.getNowDate());
        try {
            return kitchenWasteDealMapper.updateKitchenWasteDeal(kitchenWasteDeal);
        } catch (Exception e) {
            throw new ServiceException(e.getMessage());
        }
    }

    /**
     * 批量删除厨房废弃物处置
     * 
     * @param wasteIds 需要删除的厨房废弃物处置主键
     * @return 结果
     */
    @Override
    public int deleteKitchenWasteDealByWasteIds(Long[] wasteIds) {
        return kitchenWasteDealMapper.deleteKitchenWasteDealByWasteIds(wasteIds);
    }

    /**
     * 删除厨房废弃物处置信息
     * 
     * @param wasteId 厨房废弃物处置主键
     * @return 结果
     */
    @Override
    public int deleteKitchenWasteDealByWasteId(Long wasteId) {
        return kitchenWasteDealMapper.deleteKitchenWasteDealByWasteId(wasteId);
    }
}
