package com.bonus.canteen.alloc.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.alloc.mapper.AllocStallMapper;
import com.bonus.canteen.alloc.domain.AllocStall;
import com.bonus.canteen.alloc.service.IAllocStallService;

/**
 * 档口信息Service业务层处理
 * 
 * @author xsheng
 * @date 2025-04-03
 */
@Service
public class AllocStallServiceImpl implements IAllocStallService {
    @Autowired
    private AllocStallMapper allocStallMapper;

    /**
     * 查询档口信息
     * 
     * @param stallId 档口信息主键
     * @return 档口信息
     */
    @Override
    public AllocStall selectAllocStallByStallId(Long stallId) {
        return allocStallMapper.selectAllocStallByStallId(stallId);
    }

    /**
     * 查询档口信息列表
     * 
     * @param allocStall 档口信息
     * @return 档口信息
     */
    @Override
    public List<AllocStall> selectAllocStallList(AllocStall allocStall) {
        return allocStallMapper.selectAllocStallList(allocStall);
    }

    /**
     * 新增档口信息
     * 
     * @param allocStall 档口信息
     * @return 结果
     */
    @Override
    public int insertAllocStall(AllocStall allocStall) {
        allocStall.setCreateTime(DateUtils.getNowDate());
        try {
            return allocStallMapper.insertAllocStall(allocStall);
        } catch (Exception e) {
            throw new ServiceException("错误信息描述");
        }
    }

    /**
     * 修改档口信息
     * 
     * @param allocStall 档口信息
     * @return 结果
     */
    @Override
    public int updateAllocStall(AllocStall allocStall) {
        allocStall.setUpdateTime(DateUtils.getNowDate());
        try {
            return allocStallMapper.updateAllocStall(allocStall);
        } catch (Exception e) {
            throw new ServiceException("错误信息描述");
        }
    }

    /**
     * 批量删除档口信息
     * 
     * @param stallIds 需要删除的档口信息主键
     * @return 结果
     */
    @Override
    public int deleteAllocStallByStallIds(Long[] stallIds) {
        return allocStallMapper.deleteAllocStallByStallIds(stallIds);
    }

    /**
     * 删除档口信息信息
     * 
     * @param stallId 档口信息主键
     * @return 结果
     */
    @Override
    public int deleteAllocStallByStallId(Long stallId) {
        return allocStallMapper.deleteAllocStallByStallId(stallId);
    }
}
