package com.cool.store.dao;

import com.cool.store.constants.CommonConstants;
import com.cool.store.entity.AcceptanceInfoDO;
import com.cool.store.mapper.AcceptanceInfoMapper;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

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

/**
 * @Auther: WangShuo
 * @Date: 2024/04/29/下午7:47
 * @Version 1.0
 * @注释:
 */
@Repository
public class AcceptanceInfoDAO {
    @Resource
    private AcceptanceInfoMapper acceptanceInfoMapper;

    public Long insertSelectiveAcceptanceInfo(AcceptanceInfoDO acceptanceInfoDO){
        if (Objects.isNull(acceptanceInfoDO)){
            return null;
        }
        acceptanceInfoMapper.insertSelective(acceptanceInfoDO);
        return acceptanceInfoDO.getId();
    }
    public List<AcceptanceInfoDO> selectAcceptanceInfoBySignatures(Integer subStage, Integer status){
        return acceptanceInfoMapper.selectShopIdListBySignatures(subStage,status);
    }
    public Integer updateAcceptanceInfo(AcceptanceInfoDO acceptanceInfoDO){
        if (Objects.isNull(acceptanceInfoDO)){
            return CommonConstants.ZERO;
        }
        return acceptanceInfoMapper.updateByShopIDSelective(acceptanceInfoDO);
    }
   public List<AcceptanceInfoDO> selectListNotNullEntryTime(){
        return acceptanceInfoMapper.selectListNotNullEntryTime();
   }
     public AcceptanceInfoDO selectByShopId (Long shopId){
        if (Objects.isNull(shopId)){
            return null;
        }
        return acceptanceInfoMapper.selectByShopId(shopId);
     }
    public List<AcceptanceInfoDO>  selectByShopIds (List<Long>  shopIds){
        if (CollectionUtils.isEmpty(shopIds)){
            return null;
        }
        return acceptanceInfoMapper.selectByShopIds(shopIds);
    }
    public List<AcceptanceInfoDO> selectByEntryTimeNull(){
        return acceptanceInfoMapper.selectByEntryTimeNull();
    }
}
