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.MmPlateSmallPro;
import com.xisc.pm.domain.repository.MmPlateSmallProRepository;
import com.xisc.pm.infra.mapper.MmPlateSmallProMapper;

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

/**
 * 钢板小工序表(MmPlateSmallPro)资源库
 *
 * @author 蒋雨航 yuhang.jiang02@hand-china.com
 * @since 2024-08-15 16:30:08
 */
@Component
public class MmPlateSmallProRepositoryImpl extends BaseRepositoryImpl<MmPlateSmallPro> implements MmPlateSmallProRepository {
    @Resource
    private MmPlateSmallProMapper mmPlateSmallProMapper;

    @Override
    public List<MmPlateSmallPro> selectList(MmPlateSmallPro mmPlateSmallPro) {
        return mmPlateSmallProMapper.selectList(mmPlateSmallPro);
    }

    @Override
    public MmPlateSmallPro selectByPrimary(Long proPlateId) {
        MmPlateSmallPro mmPlateSmallPro = new MmPlateSmallPro();
        mmPlateSmallPro.setProPlateId(proPlateId);
        List<MmPlateSmallPro> mmPlateSmallPros = mmPlateSmallProMapper.selectList(mmPlateSmallPro);
        if (CollectionUtils.isEmpty(mmPlateSmallPros)) {
            return null;
        }
        return mmPlateSmallPros.get(0);
    }

}
