package com.cool.store.dao;

import com.cool.store.entity.ShopAuditInfoDO;
import com.cool.store.mapper.ShopAuditInfoMapper;
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: ShopAuditInfoDAO
 * @Description:
 * @date 2024-04-24 17:30
 */
@Repository
public class ShopAuditInfoDAO {

    @Resource
    private ShopAuditInfoMapper shopAuditInfoMapper;

    /**
     * 新增审核信息
     * @param auditInfo
     * @return
     */
    public Long addAuditInfo(ShopAuditInfoDO auditInfo) {
        shopAuditInfoMapper.insertSelective(auditInfo);
        return auditInfo.getId();
    }

    /**
     * 获取单个审核信息
     * @param auditId
     * @return
     */
    public ShopAuditInfoDO getAuditInfo(Long auditId) {
        return shopAuditInfoMapper.selectByPrimaryKey(auditId);
    }

    /**
     * 批量获取审核信息
     * @param auditIds
     * @return
     */
    public List<ShopAuditInfoDO> getAuditInfoList(List<Long> auditIds) {
        if(CollectionUtils.isEmpty(auditIds)){
            return Lists.newArrayList();
        }
        return shopAuditInfoMapper.getAuditInfoList(auditIds);
    }

    public Integer updateSelective(ShopAuditInfoDO shopAuditInfoDO) {
        return shopAuditInfoMapper.updateByPrimaryKeySelective(shopAuditInfoDO);
    }

    public List<ShopAuditInfoDO> getAuditList(Long shopId,Integer auditType) {

        return shopAuditInfoMapper.getAuditList(shopId,auditType);
    }
}
