package com.hzs.sale.order.service.impl;

import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hzs.common.domain.sale.order.SaOrderSync;
import com.hzs.sale.order.mapper.SaOrderSyncMapper;
import com.hzs.sale.order.param.SaOrderSyncParam;
import com.hzs.sale.order.service.ISaOrderSyncService;
import com.hzs.sale.order.vo.SaOrderSyncVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 订单同步记录服务实现
 */
@Service
public class SaOrderSyncServiceImpl extends ServiceImpl<SaOrderSyncMapper, SaOrderSync> implements ISaOrderSyncService {

  @Override
  public List<SaOrderSyncVO> queryList(SaOrderSyncParam param, Integer pkCountry) {
    return baseMapper.queryList(param, pkCountry);
  }

  @Override
  public Boolean updateStatus(
          Long pkId, Integer status, Long userId, Integer pkCountry
  ) {
    LambdaUpdateWrapper<SaOrderSync> updateWrapper = new LambdaUpdateWrapper<>();
    updateWrapper.eq(SaOrderSync::getPkId, pkId);
    updateWrapper.set(SaOrderSync::getStatus, status);

    return this.update(updateWrapper);
  }
}