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.PmProdLineSection;
import com.xisc.pm.domain.repository.PmProdLineSectionRepository;
import com.xisc.pm.infra.mapper.PmProdLineSectionMapper;

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

/**
 * 产线断面关系表(PmProdLineSection)资源库
 *
 * @author 纪文桃 wentao.ji01@hand-china.com
 * @since 2024-10-10 09:19:38
 */
@Component
public class PmProdLineSectionRepositoryImpl extends BaseRepositoryImpl<PmProdLineSection> implements PmProdLineSectionRepository {
    @Resource
    private PmProdLineSectionMapper pmProdLineSectionMapper;

    @Override
    public List<PmProdLineSection> selectList(PmProdLineSection pmProdLineSection) {
        return pmProdLineSectionMapper.selectList(pmProdLineSection);
    }

    @Override
    public PmProdLineSection selectByPrimary(Long prodLineSectionId) {
        PmProdLineSection pmProdLineSection = new PmProdLineSection();
        pmProdLineSection.setProdLineSectionId(prodLineSectionId);
        List<PmProdLineSection> pmProdLineSections = pmProdLineSectionMapper.selectList(pmProdLineSection);
        if (CollectionUtils.isEmpty(pmProdLineSections)) {
            return null;
        }
        return pmProdLineSections.get(0);
    }
}
