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.PmSlabMethod;
import com.xisc.pm.domain.repository.PmSlabMethodRepository;
import com.xisc.pm.infra.mapper.PmSlabMethodMapper;

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

/**
 * 生产线组板方式表(PmSlabMethod)资源库
 *
 * @author jie.yang04@hand-china.com
 * @since 2024-10-09 09:43:34
 */
@Component
public class PmSlabMethodRepositoryImpl extends BaseRepositoryImpl<PmSlabMethod> implements PmSlabMethodRepository {
    @Resource
    private PmSlabMethodMapper pmSlabMethodMapper;

    @Override
    public List<PmSlabMethod> selectList(PmSlabMethod pmSlabMethod) {
        return pmSlabMethodMapper.selectList(pmSlabMethod);
    }

    @Override
    public PmSlabMethod selectByPrimary(Long prodLineStatsId) {
        PmSlabMethod pmSlabMethod = new PmSlabMethod();
        pmSlabMethod.setProdLineStatsId(prodLineStatsId);
        List<PmSlabMethod> pmSlabMethods = pmSlabMethodMapper.selectList(pmSlabMethod);
        if (CollectionUtils.isEmpty(pmSlabMethods)) {
            return null;
        }
        return pmSlabMethods.get(0);
    }

}

