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.PmProdLineSectionSpec;
import com.xisc.pm.domain.repository.PmProdLineSectionSpecRepository;
import com.xisc.pm.infra.mapper.PmProdLineSectionSpecMapper;

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

/**
 * 产线断面规格表(PmProdLineSectionSpec)资源库
 *
 * @author 纪文桃 wentao.ji01@hand-china.com
 * @since 2024-10-10 09:36:43
 */
@Component
public class PmProdLineSectionSpecRepositoryImpl extends BaseRepositoryImpl<PmProdLineSectionSpec> implements PmProdLineSectionSpecRepository {
    @Resource
    private PmProdLineSectionSpecMapper pmProdLineSectionSpecMapper;

    @Override
    public List<PmProdLineSectionSpec> selectList(PmProdLineSectionSpec pmProdLineSectionSpec) {
        return pmProdLineSectionSpecMapper.selectList(pmProdLineSectionSpec);
    }

    @Override
    public PmProdLineSectionSpec selectByPrimary(Long prodLineSectionId) {
        PmProdLineSectionSpec pmProdLineSectionSpec = new PmProdLineSectionSpec();
        pmProdLineSectionSpec.setProdLineSectionId(prodLineSectionId);
        List<PmProdLineSectionSpec> pmProdLineSectionSpecs = pmProdLineSectionSpecMapper.selectList(pmProdLineSectionSpec);
        if (CollectionUtils.isEmpty(pmProdLineSectionSpecs)) {
            return null;
        }
        return pmProdLineSectionSpecs.get(0);
    }
}
