package cn.ysk.cashier.mybatis.service.impl;

import cn.ysk.cashier.mybatis.mapper.TbCashierCartMapper;
import cn.ysk.cashier.mybatis.mapper.TbOrderInfoMapper;
import cn.ysk.cashier.mybatis.service.MpCashierCartService;
import cn.ysk.cashier.mybatis.service.MpOrderInfoService;
import cn.ysk.cashier.pojo.order.TbCashierCart;
import cn.ysk.cashier.pojo.order.TbOrderInfo;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * (TbShopPermission)表服务实现类
 *
 * @author makejava
 * @since 2024-09-14 17:08:49
 */
@Service
public class MpOrderInfoServiceImpl extends ServiceImpl<TbOrderInfoMapper, TbOrderInfo> implements MpOrderInfoService {
    @Override
    public TbOrderInfo selectReturnOrderByOrderId(Integer orderId) {
        return getOne(new LambdaQueryWrapper<TbOrderInfo>()
                .eq(TbOrderInfo::getSource, orderId)
                .eq(TbOrderInfo::getOrderType, "return"));
    }

    @Override
    public boolean updateTableIdAndUseTypeById(Integer orderId, String useType, String tableId) {
        return update(new LambdaUpdateWrapper<TbOrderInfo>()
                .eq(TbOrderInfo::getId, orderId)
                .set(TbOrderInfo::getUseType, useType)
                .set(TbOrderInfo::getTableId, tableId));
    }
}

