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.PmPlateTrimBtTra;
import com.xisc.pm.domain.repository.PmPlateTrimBtTraRepository;
import com.xisc.pm.infra.mapper.PmPlateTrimBtTraMapper;

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

/**
 * 钢板切边量基准表履历表(PmPlateTrimBtTra)资源库
 *
 * @author 纪文桃 wentao.ji01@hand-china.com
 * @since 2024-07-24 10:38:01
 */
@Component
public class PmPlateTrimBtTraRepositoryImpl extends BaseRepositoryImpl<PmPlateTrimBtTra> implements PmPlateTrimBtTraRepository {
    @Resource
    private PmPlateTrimBtTraMapper pmPlateTrimBtTraMapper;

    @Override
    public List<PmPlateTrimBtTra> selectList(PmPlateTrimBtTra pmPlateTrimBtTra) {
        return pmPlateTrimBtTraMapper.selectList(pmPlateTrimBtTra);
    }

    @Override
    public PmPlateTrimBtTra selectByPrimary(Long traId) {
        PmPlateTrimBtTra pmPlateTrimBtTra = new PmPlateTrimBtTra();
        pmPlateTrimBtTra.setTraId(traId);
        List<PmPlateTrimBtTra> pmPlateTrimBtTras = pmPlateTrimBtTraMapper.selectList(pmPlateTrimBtTra);
        if (CollectionUtils.isEmpty(pmPlateTrimBtTras)) {
            return null;
        }
        return pmPlateTrimBtTras.get(0);
    }
}
