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.PmContractLineSpec;
import com.xisc.pm.domain.repository.PmContractLineSpecRepository;
import com.xisc.pm.infra.mapper.PmContractLineSpecMapper;

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

/**
 * 合同指定产线断面表(PmContractLineSpec)资源库
 *
 * @author 纪文桃 wentao.ji01@hand-china.com
 * @since 2024-10-12 09:37:26
 */
@Component
public class PmContractLineSpecRepositoryImpl extends BaseRepositoryImpl<PmContractLineSpec> implements PmContractLineSpecRepository {
    @Resource
    private PmContractLineSpecMapper pmContractLineSpecMapper;

    @Override
    public List<PmContractLineSpec> selectList(PmContractLineSpec pmContractLineSpec) {
        return pmContractLineSpecMapper.selectList(pmContractLineSpec);
    }

    @Override
    public PmContractLineSpec selectByPrimary(Long orderSpectionId) {
        PmContractLineSpec pmContractLineSpec = new PmContractLineSpec();
        pmContractLineSpec.setOrderSpectionId(orderSpectionId);
        List<PmContractLineSpec> pmContractLineSpecs = pmContractLineSpecMapper.selectList(pmContractLineSpec);
        if (CollectionUtils.isEmpty(pmContractLineSpecs)) {
            return null;
        }
        return pmContractLineSpecs.get(0);
    }
}
