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.PmCutPlaceBtTra;
import com.xisc.pm.domain.repository.PmCutPlaceBtTraRepository;
import com.xisc.pm.infra.mapper.PmCutPlaceBtTraMapper;

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

/**
 * 粗切位置决定基准表履历表(PmCutPlaceBtTra)资源库
 *
 * @author 纪文桃 wentao.ji01@hand-china.com
 * @since 2024-07-24 08:40:59
 */
@Component
public class PmCutPlaceBtTraRepositoryImpl extends BaseRepositoryImpl<PmCutPlaceBtTra> implements PmCutPlaceBtTraRepository {
    @Resource
    private PmCutPlaceBtTraMapper pmCutPlaceBtTraMapper;

    @Override
    public List<PmCutPlaceBtTra> selectList(PmCutPlaceBtTra pmCutPlaceBtTra) {
        return pmCutPlaceBtTraMapper.selectList(pmCutPlaceBtTra);
    }

    @Override
    public PmCutPlaceBtTra selectByPrimary(Long traId) {
        PmCutPlaceBtTra pmCutPlaceBtTra = new PmCutPlaceBtTra();
        pmCutPlaceBtTra.setTraId(traId);
        List<PmCutPlaceBtTra> pmCutPlaceBtTras = pmCutPlaceBtTraMapper.selectList(pmCutPlaceBtTra);
        if (CollectionUtils.isEmpty(pmCutPlaceBtTras)) {
            return null;
        }
        return pmCutPlaceBtTras.get(0);
    }
}
