package com.cool.store.dao;

import com.cool.store.entity.LineAuditInfoDO;
import com.cool.store.mapper.LineAuditInfoMapper;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Repository;

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

/**
 * @author zhangchenbiao
 * @FileName: LineAuditInfoDAO
 * @Description:
 * @date 2024-03-15 16:00
 */
@Repository
public class LineAuditInfoDAO {

    @Resource
    private LineAuditInfoMapper lineAuditInfoMapper;

    public Long addAuditInfo(LineAuditInfoDO auditInfo){
        lineAuditInfoMapper.insertSelective(auditInfo);
        return auditInfo.getId();
    }

    public LineAuditInfoDO getAuditInfo(Long auditId){
        return lineAuditInfoMapper.selectByPrimaryKey(auditId);
    }

    public List<LineAuditInfoDO> getLineAuditInfoList(List<Long> auditIds){
        if (CollectionUtils.isEmpty(auditIds)){
            return Lists.newArrayList();
        }
        return lineAuditInfoMapper.getLineAuditInfoList(auditIds);
    }


    public LineAuditInfoDO getAuditInfoByLineId(Long lineId){
        return lineAuditInfoMapper.getLineAuditInfo(lineId);
    }
}
