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

import com.xisc.pm.domain.entity.PmThickAddvBtTra;
import com.xisc.pm.domain.repository.PmThickAddvBtTraRepository;
import com.xisc.pm.infra.mapper.PmThickAddvBtTraMapper;
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;

/**
 * 钢板厚度余量基准表履历表(PmThickAddvBtTra)资源库
 *
 * @author 蒋雨航 yuhang.jiang02@hand-china.com
 * @since 2024-09-06 08:41:57
 */
@Component
public class PmThickAddvBtTraRepositoryImpl extends BaseRepositoryImpl<PmThickAddvBtTra> implements PmThickAddvBtTraRepository {
    @Resource
    private PmThickAddvBtTraMapper pmThickAddvBtTraMapper;

    @Override
    public List<PmThickAddvBtTra> selectList(PmThickAddvBtTra pmThickAddvBtTra) {
        return pmThickAddvBtTraMapper.selectList(pmThickAddvBtTra);
    }

    @Override
    public PmThickAddvBtTra selectByPrimary(Long traId) {
        PmThickAddvBtTra pmThickAddvBtTra = new PmThickAddvBtTra();
        pmThickAddvBtTra.setTraId(traId);
        List<PmThickAddvBtTra> pmThickAddvBtTras = pmThickAddvBtTraMapper.selectList(pmThickAddvBtTra);
        if (CollectionUtils.isEmpty(pmThickAddvBtTras)) {
            return null;
        }
        return pmThickAddvBtTras.get(0);
    }

}
