package com.fdkankan.goods.service.impl;

import com.fdkankan.goods.entity.Goods;
import com.fdkankan.goods.mapper.IGoodsMapper;
import com.fdkankan.goods.service.IGoodsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fdkankan.goods.vo.ResponseGoods;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 商品主表 服务实现类
 * </p>
 *
 * @author 
 * @since 2021-12-24
 */
@Service
public class GoodsServiceImpl extends ServiceImpl<IGoodsMapper, Goods> implements IGoodsService {

    @Override
    public ResponseGoods getByGoodsId(Long goodsId) {
        Goods goods = this.getById(goodsId);
        ResponseGoods responseGoods = null;
        if (goods != null){
            responseGoods = new ResponseGoods();
            BeanUtils.copyProperties(goods, responseGoods);
            responseGoods.setGoodsStatus(goods.getGoodsStatus());
        }
        return responseGoods;
    }
}
