package shop.alien.store.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import shop.alien.entity.store.StoreCuisineCombo;
import shop.alien.entity.store.dto.CuisineComboDto;
import shop.alien.mapper.StoreCuisineComboMapper;
import shop.alien.store.service.StoreCuisineComboService;

import java.util.List;

/**
 * 美食套餐表(辅助详情查询) 服务实现类
 *
 * @author auto-generated
 * @since 2025-01-01
 */
@Slf4j
@Service
@RequiredArgsConstructor
@Transactional
public class StoreCuisineComboServiceImpl extends ServiceImpl<StoreCuisineComboMapper, StoreCuisineCombo> implements StoreCuisineComboService {

    @Override
    public boolean saveBatch(List<StoreCuisineCombo> comboList) {
        log.info("StoreCuisineComboServiceImpl.saveBatch?comboList.size={}", comboList != null ? comboList.size() : 0);
        if (comboList == null || comboList.isEmpty()) {
            return false;
        }
        return super.saveBatch(comboList, comboList.size());
    }

    @Override
    public boolean deleteByComboId(Integer cid) {
        log.info("StoreCuisineComboServiceImpl.deleteByComboId?cid={}", cid);
        LambdaQueryWrapper<StoreCuisineCombo> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(StoreCuisineCombo::getCid, cid);
        return this.remove(queryWrapper);
    }

}

