package com.xisc.pm.infra.repository.impl;

import org.apache.commons.collections.CollectionUtils;
import org.hzero.mybatis.base.impl.BaseRepositoryImpl;
import org.springframework.stereotype.Component;
import com.xisc.pm.domain.entity.PmProdLineCoarseSocre;
import com.xisc.pm.domain.repository.PmProdLineCoarseSocreRepository;
import com.xisc.pm.infra.mapper.PmProdLineCoarseSocreMapper;

import javax.annotation.Resource;
import java.util.List;

/**
 * 产线粗分表(PmProdLineCoarseSocre)资源库
 *
 * @author 纪文桃 wentao.ji01@hand-china.com
 * @since 2024-10-11 09:06:10
 */
@Component
public class PmProdLineCoarseSocreRepositoryImpl extends BaseRepositoryImpl<PmProdLineCoarseSocre> implements PmProdLineCoarseSocreRepository {
    @Resource
    private PmProdLineCoarseSocreMapper pmProdLineCoarseSocreMapper;

    @Override
    public List<PmProdLineCoarseSocre> selectList(PmProdLineCoarseSocre pmProdLineCoarseSocre) {
        return pmProdLineCoarseSocreMapper.selectList(pmProdLineCoarseSocre);
    }

    @Override
    public PmProdLineCoarseSocre selectByPrimary(Long prodLineCoarseId) {
        PmProdLineCoarseSocre pmProdLineCoarseSocre = new PmProdLineCoarseSocre();
        pmProdLineCoarseSocre.setProdLineCoarseId(prodLineCoarseId);
        List<PmProdLineCoarseSocre> pmProdLineCoarseSocres = pmProdLineCoarseSocreMapper.selectList(pmProdLineCoarseSocre);
        if (CollectionUtils.isEmpty(pmProdLineCoarseSocres)) {
            return null;
        }
        return pmProdLineCoarseSocres.get(0);
    }
}
