package com.bonus.canteen.core.order.common.service.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bonus.canteen.core.common.utils.JavaxValidateUtils;
import com.bonus.canteen.core.order.common.dto.OrderPreBookQueryDTO;
import com.bonus.canteen.core.order.common.mapper.OrderPreBookMapper;
import com.bonus.canteen.core.order.common.model.OrderPreBook;
import com.bonus.canteen.core.order.common.service.OrderPreBookService;
import com.bonus.canteen.core.order.common.vo.OrderPreBookVO;
import org.springframework.stereotype.Service;

import java.io.Serializable;
import java.lang.invoke.SerializedLambda;
import java.time.LocalDate;
import java.util.List;

@Service
public class OrderPreBookServiceImpl extends ServiceImpl<OrderPreBookMapper, OrderPreBook> implements OrderPreBookService {
//   public OrderPreBook getById(Serializable id) {
//      return id == null ? null : (OrderPreBook)super.getById(id);
//   }
//
//   public OrderPreBook insert(OrderPreBookAddDTO addDTO) {
//      JavaxValidateUtils.validate(addDTO);
//      OrderPreBook entity = addDTO.convertToEntity();
//      ((OrderPreBookMapper)this.baseMapper).insert(entity);
//      return entity;
//   }

   public List<OrderPreBookVO> listByParam(OrderPreBookQueryDTO param) {
      return ((OrderPreBookMapper)this.baseMapper).listByParam(param);
   }

//   public boolean existsByCustAndDate(Long custId, LocalDate orderDate, Integer orderType) {
//      return ((OrderPreBookMapper)this.baseMapper).exists((Wrapper)((LambdaQueryWrapper)((LambdaQueryWrapper)Wrappers.lambdaQuery(OrderPreBook.class).eq(OrderPreBook::getCustId, custId)).eq(OrderPreBook::getOrderDate, orderDate)).eq(OrderPreBook::getOrderType, orderType));
//   }
}
