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

import com.xisc.pm.domain.entity.PmPolicyOrderDtl;
import com.xisc.pm.domain.repository.PmPolicyOrderDtlRepository;
import com.xisc.pm.infra.mapper.PmPolicyOrderDtlMapper;
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;

/**
 * 策略合同分组明细(PmPolicyOrderDtl)资源库
 *
 * @author 纪文桃 wentao.ji01@hand-china.com
 * @since 2024-10-16 10:45:41
 */
@Component
@Deprecated
public class PmPolicyOrderDtlRepositoryImpl extends BaseRepositoryImpl<PmPolicyOrderDtl> implements PmPolicyOrderDtlRepository {
    @Resource
    private PmPolicyOrderDtlMapper pmPolicyOrderDtlMapper;

    @Override
    public List<PmPolicyOrderDtl> selectList(PmPolicyOrderDtl pmPolicyOrderDtl) {
        return pmPolicyOrderDtlMapper.selectList(pmPolicyOrderDtl);
    }

    @Override
    public PmPolicyOrderDtl selectByPrimary(Long testId) {
        PmPolicyOrderDtl pmPolicyOrderDtl = new PmPolicyOrderDtl();
        pmPolicyOrderDtl.setTestId(testId);
        List<PmPolicyOrderDtl> pmPolicyOrderDtls = pmPolicyOrderDtlMapper.selectList(pmPolicyOrderDtl);
        if (CollectionUtils.isEmpty(pmPolicyOrderDtls)) {
            return null;
        }
        return pmPolicyOrderDtls.get(0);
    }
}
