package com.cool.store.dao;

import com.cool.store.dto.partner.ZoneCheckDTO;
import com.cool.store.entity.HyIntendDevelopementMappingDO;
import com.cool.store.mapper.HyIntendDevelopementMappingMapper;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

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

/**
 * @Author suzhuhong
 * @Date 2023/6/14 14:42
 * @Version 1.0
 */
@Repository
public class HyIntendDevMappingDAO {

    @Resource
    HyIntendDevelopementMappingMapper hyIntendDevelopementMappingMapper;


    public int insertSelective(HyIntendDevelopementMappingDO record){
        return hyIntendDevelopementMappingMapper.insertSelective(record);
    }

    public int updateByPrimaryKeySelective(HyIntendDevelopementMappingDO record){
        return hyIntendDevelopementMappingMapper.updateByPrimaryKeySelective(record);
    }

    public int deleteByOpenAreaIds(List<Long> openAreaIds,String type){
        if (CollectionUtils.isEmpty(openAreaIds)){
            return 0;
        }
        return hyIntendDevelopementMappingMapper.deleteByOpenAreaIds(openAreaIds,type);
    }

    public int deleteByMappingIds(List<Long> mappingIds,String type){
        if (CollectionUtils.isEmpty(mappingIds)){
            return 0;
        }
        return hyIntendDevelopementMappingMapper.deleteByMappingIds(mappingIds,type);
    }

    public List<ZoneCheckDTO> selectByMappingIdList(List<Long> idList){
        if (CollectionUtils.isEmpty(idList)){
            return new ArrayList<>();
        }
        return hyIntendDevelopementMappingMapper.selectByMappingIdList(idList);
    }

    public List<ZoneCheckDTO> selectByOpenAreaMappingIdList(List<Long> idList,String type,Long currentId){
        if (CollectionUtils.isEmpty(idList)){
            return new ArrayList<>();
        }
        return hyIntendDevelopementMappingMapper.selectByOpenAreaMappingIdList(idList,type,currentId);
    }

    public HyIntendDevelopementMappingDO selectByOpenAreaMappingId(Long id,String type){
        if (id==null){
            return null;
        }
        return hyIntendDevelopementMappingMapper.selectByOpenAreaMappingId(id,type);
    }

    public int batchInsert(List<HyIntendDevelopementMappingDO> recordList){
        if (CollectionUtils.isEmpty(recordList)){
            return 0;
        }
        return hyIntendDevelopementMappingMapper.batchInsert(recordList);
    }









}
