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.PmWmWwBtTra;
import com.xisc.pm.domain.repository.PmWmWwBtTraRepository;
import com.xisc.pm.infra.mapper.PmWmWwBtTraMapper;

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

/**
 * 厚板产线_命令余材长度基准表-履历表(PmWmWwBtTra)资源库
 *
 * @author 纪文桃 wentao.ji01@hand-china.com
 * @since 2024-09-11 15:03:16
 */
@Component
public class PmWmWwBtTraRepositoryImpl extends BaseRepositoryImpl<PmWmWwBtTra> implements PmWmWwBtTraRepository {
    @Resource
    private PmWmWwBtTraMapper pmWmWwBtTraMapper;

    @Override
    public List<PmWmWwBtTra> selectList(PmWmWwBtTra pmWmWwBtTra) {
        return pmWmWwBtTraMapper.selectList(pmWmWwBtTra);
    }

    @Override
    public PmWmWwBtTra selectByPrimary(Long traId) {
        PmWmWwBtTra pmWmWwBtTra = new PmWmWwBtTra();
        pmWmWwBtTra.setTraId(traId);
        List<PmWmWwBtTra> pmWmWwBtTras = pmWmWwBtTraMapper.selectList(pmWmWwBtTra);
        if (CollectionUtils.isEmpty(pmWmWwBtTras)) {
            return null;
        }
        return pmWmWwBtTras.get(0);
    }
}
