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.PmSpecTableColumn;
import com.xisc.pm.domain.repository.PmSpecTableColumnRepository;
import com.xisc.pm.infra.mapper.PmSpecTableColumnMapper;

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

/**
 * 合同结构规格表(PmSpecTableColumn)资源库
 *
 * @author 纪文桃 wentao.ji01@hand-china.com
 * @since 2024-10-12 09:10:24
 */
@Component
public class PmSpecTableColumnRepositoryImpl extends BaseRepositoryImpl<PmSpecTableColumn> implements PmSpecTableColumnRepository {
    @Resource
    private PmSpecTableColumnMapper pmSpecTableColumnMapper;

    @Override
    public List<PmSpecTableColumn> selectList(PmSpecTableColumn pmSpecTableColumn) {
        return pmSpecTableColumnMapper.selectList(pmSpecTableColumn);
    }

    @Override
    public PmSpecTableColumn selectByPrimary(Long orderStructureId) {
        PmSpecTableColumn pmSpecTableColumn = new PmSpecTableColumn();
        pmSpecTableColumn.setOrderStructureId(orderStructureId);
        List<PmSpecTableColumn> pmSpecTableColumns = pmSpecTableColumnMapper.selectList(pmSpecTableColumn);
        if (CollectionUtils.isEmpty(pmSpecTableColumns)) {
            return null;
        }
        return pmSpecTableColumns.get(0);
    }
}
