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

import com.xisc.pm.domain.entity.PmMoldSpecBt;
import com.xisc.pm.domain.repository.PmMoldSpecBtRepository;
import com.xisc.pm.infra.mapper.PmMoldSpecBtMapper;
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;

/**
 * 结晶器规格基准表(PmMoldSpecBt)资源库
 *
 * @author 纪文桃 wentao.ji01@hand-china.com
 * @since 2024-07-22 14:11:31
 */
@Component
public class PmMoldSpecBtRepositoryImpl extends BaseRepositoryImpl<PmMoldSpecBt> implements PmMoldSpecBtRepository {
    @Resource
    private PmMoldSpecBtMapper pmMoldSpecBtMapper;

    @Override
    public List<PmMoldSpecBt> selectList(PmMoldSpecBt pmMoldSpecBt) {
        return pmMoldSpecBtMapper.selectList(pmMoldSpecBt);
    }

    @Override
    public PmMoldSpecBt selectByPrimary(Long pmsbId) {
        PmMoldSpecBt pmMoldSpecBt = new PmMoldSpecBt();
        pmMoldSpecBt.setPmsbId(pmsbId);
        List<PmMoldSpecBt> pmMoldSpecBts = pmMoldSpecBtMapper.selectList(pmMoldSpecBt);
        if (CollectionUtils.isEmpty(pmMoldSpecBts)) {
            return null;
        }
        return pmMoldSpecBts.get(0);
    }
}
