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.PmSubCheckChm;
import com.xisc.pm.domain.repository.PmSubCheckChmRepository;
import com.xisc.pm.infra.mapper.PmSubCheckChmMapper;

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

/**
 * 化学成分检测结果表(PmSubCheckChm)资源库
 *
 * @author BKGY
 * @since 2025-03-26 16:22:52
 */
@Component
public class PmSubCheckChmRepositoryImpl extends BaseRepositoryImpl<PmSubCheckChm> implements PmSubCheckChmRepository {
    @Resource
    private PmSubCheckChmMapper pmSubCheckChmMapper;

    @Override
    public List<PmSubCheckChm> selectList(PmSubCheckChm pmSubCheckChm) {
        return pmSubCheckChmMapper.selectList(pmSubCheckChm);
    }

    @Override
    public PmSubCheckChm selectByPrimary(Long id) {
        PmSubCheckChm pmSubCheckChm = new PmSubCheckChm();
        pmSubCheckChm.setId(id);
        List<PmSubCheckChm> pmSubCheckChms = pmSubCheckChmMapper.selectList(pmSubCheckChm);
        if (CollectionUtils.isEmpty(pmSubCheckChms)) {
            return null;
        }
        return pmSubCheckChms.get(0);
    }

    @Override
    public PmSubCheckChm selectByPonoAndOrderNo(PmSubCheckChm pmSubCheckChm) {
        return pmSubCheckChmMapper.selectByPonoAndOrderNo(pmSubCheckChm);
    }

}

