package com.fdkankan.ucenter.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.fdkankan.ucenter.entity.GoodsSku;
import com.fdkankan.ucenter.mapper.IGoodsSkuMapper;
import com.fdkankan.ucenter.service.IGoodsSkuService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 商品sku表 服务实现类
 * </p>
 *
 * @author 
 * @since 2022-07-14
 */
@Service
public class GoodsSkuServiceImpl extends ServiceImpl<IGoodsSkuMapper, GoodsSku> implements IGoodsSkuService {
    @Override
    public GoodsSku getBySku(String skuStr) {
        LambdaQueryWrapper<GoodsSku> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(GoodsSku::getSkuSn,skuStr);
        List<GoodsSku> list = this.list(wrapper);
        if(list !=null && list.size() >0){
            return list.get(0);
        }
        return null;
    }
}
