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.PmSteelTypeGroup;
import com.xisc.pm.domain.repository.PmSteelTypeGroupRepository;
import com.xisc.pm.infra.mapper.PmSteelTypeGroupMapper;

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

/**
 * 钢种组信息维护(PmSteelTypeGroup)资源库
 *
 * @author 纪文桃 wentao.ji01@hand-china.com
 * @since 2024-10-10 13:31:26
 */
@Component
public class PmSteelTypeGroupRepositoryImpl extends BaseRepositoryImpl<PmSteelTypeGroup> implements PmSteelTypeGroupRepository {
    @Resource
    private PmSteelTypeGroupMapper pmSteelTypeGroupMapper;

    @Override
    public List<PmSteelTypeGroup> selectList(PmSteelTypeGroup pmSteelTypeGroup) {
        return pmSteelTypeGroupMapper.selectList(pmSteelTypeGroup);
    }

    @Override
    public PmSteelTypeGroup selectByPrimary(Long steelGroupId) {
        PmSteelTypeGroup pmSteelTypeGroup = new PmSteelTypeGroup();
        pmSteelTypeGroup.setSteelGroupId(steelGroupId);
        List<PmSteelTypeGroup> pmSteelTypeGroups = pmSteelTypeGroupMapper.selectList(pmSteelTypeGroup);
        if (CollectionUtils.isEmpty(pmSteelTypeGroups)) {
            return null;
        }
        return pmSteelTypeGroups.get(0);
    }
}
