
package com.tmerclub.cloud.product.service.impl;

import cn.hutool.core.collection.CollUtil;
import com.tmerclub.cloud.common.database.dto.PageDTO;
import com.tmerclub.cloud.common.database.util.PageUtil;
import com.tmerclub.cloud.common.database.vo.PageVO;
import com.tmerclub.cloud.common.product.vo.SkuLangVO;
import com.tmerclub.cloud.product.mapper.SkuLangMapper;
import com.tmerclub.cloud.product.model.SkuLang;
import com.tmerclub.cloud.product.service.SkuLangService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * sku-国际化表
 *
 * @author YXF
 * @date 2021-04-09 17:08:38
 */
@Service
public class SkuLangServiceImpl implements SkuLangService {

    @Autowired
    private SkuLangMapper skuLangMapper;

    @Override
    public PageVO<SkuLang> page(PageDTO pageDTO) {
        return PageUtil.doPage(pageDTO, () -> skuLangMapper.list());
    }

    @Override
    public List<SkuLangVO> getBySkuId(Long skuId) {
        return skuLangMapper.getBySkuId(skuId);
    }

    @Override
    public void save(SkuLang skuLang) {
        skuLangMapper.save(skuLang);
    }

    @Override
    public void update(SkuLang skuLang) {
        skuLangMapper.update(skuLang);
    }

    @Override
    public void deleteById(Long skuId) {
        skuLangMapper.deleteById(skuId);
    }

    @Override
    public void batchSave(List<SkuLang> skuLangList) {
        if (CollUtil.isEmpty(skuLangList)) {
            return;
        }
        skuLangMapper.batchSave(skuLangList);
    }
}
