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

import java.util.List;
import com.bonus.common.core.exception.ServiceException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.bonus.canteen.core.supply.mapper.SupplyWarehouseFetchUserMapper;
import com.bonus.canteen.core.supply.domain.SupplyWarehouseFetchUser;
import com.bonus.canteen.core.supply.service.ISupplyWarehouseFetchUserService;

/**
 * 仓库绑定档口领料人Service业务层处理
 * 
 * @author xsheng
 * @date 2025-05-25
 */
@Service
public class SupplyWarehouseFetchUserServiceImpl implements ISupplyWarehouseFetchUserService {
    @Autowired
    private SupplyWarehouseFetchUserMapper supplyWarehouseFetchUserMapper;

    /**
     * 查询仓库绑定档口领料人
     * 
     * @param id 仓库绑定档口领料人主键
     * @return 仓库绑定档口领料人
     */
    @Override
    public SupplyWarehouseFetchUser selectSupplyWarehouseFetchUserById(Long id) {
        return supplyWarehouseFetchUserMapper.selectSupplyWarehouseFetchUserById(id);
    }

    /**
     * 查询仓库绑定档口领料人列表
     * 
     * @param supplyWarehouseFetchUser 仓库绑定档口领料人
     * @return 仓库绑定档口领料人
     */
    @Override
    public List<SupplyWarehouseFetchUser> selectSupplyWarehouseFetchUserList(SupplyWarehouseFetchUser supplyWarehouseFetchUser) {
        return supplyWarehouseFetchUserMapper.selectSupplyWarehouseFetchUserList(supplyWarehouseFetchUser);
    }

    /**
     * 新增仓库绑定档口领料人
     * 
     * @param supplyWarehouseFetchUser 仓库绑定档口领料人
     * @return 结果
     */
    @Override
    public int insertSupplyWarehouseFetchUser(SupplyWarehouseFetchUser supplyWarehouseFetchUser) {
        try {
            return supplyWarehouseFetchUserMapper.insertSupplyWarehouseFetchUser(supplyWarehouseFetchUser);
        } catch (Exception e) {
            throw new ServiceException(e.getMessage());
        }
    }

    /**
     * 修改仓库绑定档口领料人
     * 
     * @param supplyWarehouseFetchUser 仓库绑定档口领料人
     * @return 结果
     */
    @Override
    public int updateSupplyWarehouseFetchUser(SupplyWarehouseFetchUser supplyWarehouseFetchUser) {
        try {
            return supplyWarehouseFetchUserMapper.updateSupplyWarehouseFetchUser(supplyWarehouseFetchUser);
        } catch (Exception e) {
            throw new ServiceException(e.getMessage());
        }
    }

    /**
     * 批量删除仓库绑定档口领料人
     * 
     * @param ids 需要删除的仓库绑定档口领料人主键
     * @return 结果
     */
    @Override
    public int deleteSupplyWarehouseFetchUserByIds(Long[] ids) {
        return supplyWarehouseFetchUserMapper.deleteSupplyWarehouseFetchUserByIds(ids);
    }

    /**
     * 删除仓库绑定档口领料人信息
     * 
     * @param id 仓库绑定档口领料人主键
     * @return 结果
     */
    @Override
    public int deleteSupplyWarehouseFetchUserById(Long id) {
        return supplyWarehouseFetchUserMapper.deleteSupplyWarehouseFetchUserById(id);
    }
}
