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.CookRecipeBindAppMapper;
import com.bonus.canteen.core.cook.domain.CookRecipeBindApp;
import com.bonus.canteen.core.cook.service.ICookRecipeBindAppService;

/**
 * 移动端菜谱绑定关系Service业务层处理
 * 
 * @author xsheng
 * @date 2025-05-25
 */
@Service
public class CookRecipeBindAppServiceImpl implements ICookRecipeBindAppService {
    @Autowired
    private CookRecipeBindAppMapper cookRecipeBindAppMapper;

    /**
     * 查询移动端菜谱绑定关系
     * 
     * @param id 移动端菜谱绑定关系主键
     * @return 移动端菜谱绑定关系
     */
    @Override
    public CookRecipeBindApp selectCookRecipeBindAppById(Long id) {
        return cookRecipeBindAppMapper.selectCookRecipeBindAppById(id);
    }

    /**
     * 查询移动端菜谱绑定关系列表
     * 
     * @param cookRecipeBindApp 移动端菜谱绑定关系
     * @return 移动端菜谱绑定关系
     */
    @Override
    public List<CookRecipeBindApp> selectCookRecipeBindAppList(CookRecipeBindApp cookRecipeBindApp) {
        return cookRecipeBindAppMapper.selectCookRecipeBindAppList(cookRecipeBindApp);
    }

    /**
     * 新增移动端菜谱绑定关系
     * 
     * @param cookRecipeBindApp 移动端菜谱绑定关系
     * @return 结果
     */
    @Override
    public int insertCookRecipeBindApp(CookRecipeBindApp cookRecipeBindApp) {
        cookRecipeBindApp.setCreateTime(DateUtils.getNowDate());
        try {
            return cookRecipeBindAppMapper.insertCookRecipeBindApp(cookRecipeBindApp);
        } catch (Exception e) {
            throw new ServiceException(e.getMessage());
        }
    }

    /**
     * 修改移动端菜谱绑定关系
     * 
     * @param cookRecipeBindApp 移动端菜谱绑定关系
     * @return 结果
     */
    @Override
    public int updateCookRecipeBindApp(CookRecipeBindApp cookRecipeBindApp) {
        cookRecipeBindApp.setUpdateTime(DateUtils.getNowDate());
        try {
            return cookRecipeBindAppMapper.updateCookRecipeBindApp(cookRecipeBindApp);
        } catch (Exception e) {
            throw new ServiceException(e.getMessage());
        }
    }

    /**
     * 批量删除移动端菜谱绑定关系
     * 
     * @param ids 需要删除的移动端菜谱绑定关系主键
     * @return 结果
     */
    @Override
    public int deleteCookRecipeBindAppByIds(Long[] ids) {
        return cookRecipeBindAppMapper.deleteCookRecipeBindAppByIds(ids);
    }

    /**
     * 删除移动端菜谱绑定关系信息
     * 
     * @param id 移动端菜谱绑定关系主键
     * @return 结果
     */
    @Override
    public int deleteCookRecipeBindAppById(Long id) {
        return cookRecipeBindAppMapper.deleteCookRecipeBindAppById(id);
    }
}
