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

import java.util.List;

import javax.annotation.Resource;

import org.apache.commons.collections.CollectionUtils;
import org.hzero.mybatis.base.impl.BaseRepositoryImpl;
import org.springframework.stereotype.Component;

import com.xisc.pm.app.service.autoboard.dto.PmPolicyStDTO;
import com.xisc.pm.domain.entity.PmPolicySteelGroup;
import com.xisc.pm.domain.repository.PmPolicySteelGroupRepository;
import com.xisc.pm.infra.mapper.PmPolicySteelGroupMapper;

/**
 * 策略信息与钢种组关系表(PmPolicySteelGroup)资源库
 *
 * @author 纪文桃 wentao.ji01@hand-china.com
 * @since 2024-10-16 10:47:23
 */
@Component
public class PmPolicySteelGroupRepositoryImpl extends BaseRepositoryImpl<PmPolicySteelGroup> implements PmPolicySteelGroupRepository {
    @Resource
    private PmPolicySteelGroupMapper pmPolicySteelGroupMapper;

    @Override
    public List<PmPolicySteelGroup> selectList(PmPolicySteelGroup pmPolicySteelGroup) {
        return pmPolicySteelGroupMapper.selectList(pmPolicySteelGroup);
    }

    @Override
    public PmPolicySteelGroup selectByPrimary(Long policyStGroupId) {
        PmPolicySteelGroup pmPolicySteelGroup = new PmPolicySteelGroup();
        pmPolicySteelGroup.setPolicyStGroupId(policyStGroupId);
        List<PmPolicySteelGroup> pmPolicySteelGroups = pmPolicySteelGroupMapper.selectList(pmPolicySteelGroup);
        if (CollectionUtils.isEmpty(pmPolicySteelGroups)) {
            return null;
        }
        return pmPolicySteelGroups.get(0);
    }

    @Override
    public List<PmPolicyStDTO> selectStNoList(List<Long> policyIdList , Long tenantId) {
        return pmPolicySteelGroupMapper.selectStNoList(policyIdList, tenantId);
    }
}
