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

import com.xisc.pm.domain.repository.PmQdToPoLineCombRepository;
import com.xisc.pm.domain.vo.QdToPoLineCombVO1;
import com.xisc.pm.infra.mapper.QdToPoLineCombMapper;
import org.apache.commons.collections.CollectionUtils;
import org.hzero.mybatis.base.impl.BaseRepositoryImpl;
import org.springframework.stereotype.Component;

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

/**
 * 合同处理产线组合(QdToPoLineComb)资源库
 *
 * @author 蒋雨航 yuhang.jiang02@hand-china.com
 * @since 2024-08-14 15:45:46
 */
@Component
public class PmQdToPoLineCombRepositoryImpl extends BaseRepositoryImpl<QdToPoLineCombVO1> implements PmQdToPoLineCombRepository {
    @Resource
    private QdToPoLineCombMapper qdToPoLineCombMapper;

    @Override
    public List<QdToPoLineCombVO1> selectList(QdToPoLineCombVO1 qdToPoLineCombVO1) {
        return qdToPoLineCombMapper.selectList(qdToPoLineCombVO1);
    }

    @Override
    public QdToPoLineCombVO1 selectByPrimary(Long polcId) {
        QdToPoLineCombVO1 qdToPoLineCombVO1 = new QdToPoLineCombVO1();
        qdToPoLineCombVO1.setPolcId(polcId);
        List<QdToPoLineCombVO1> qdToPoLineCombVO1s = qdToPoLineCombMapper.selectList(qdToPoLineCombVO1);
        if (CollectionUtils.isEmpty(qdToPoLineCombVO1s)) {
            return null;
        }
        return qdToPoLineCombVO1s.get(0);
    }

}
