package com.cool.store.dao;

import com.cool.store.entity.HyIntendDevZoneInfoDO;
import com.cool.store.entity.HyOpenAreaInfoDO;
import com.cool.store.mapper.HyIntendDevZoneInfoMapper;
import com.cool.store.mapper.HyOpenAreaInfoMapper;
import com.github.pagehelper.PageInfo;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
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:40
 * @Version 1.0
 */
@Repository
public class HyIntendDevZoneInfoDAO {

    @Resource
    HyIntendDevZoneInfoMapper hyIntendDevZoneInfoMapper;

    public int insertSelective( HyIntendDevZoneInfoDO record){
        return hyIntendDevZoneInfoMapper.insertSelective(record);
    }


    public int updateByPrimaryKeySelective(HyIntendDevZoneInfoDO record){
        return hyIntendDevZoneInfoMapper.updateByPrimaryKeySelective(record);
    }

    public HyIntendDevZoneInfoDO selectById(Long id){
        if (id==null){
            return null;
        }
        return hyIntendDevZoneInfoMapper.selectById(id);
    }

    public List<HyIntendDevZoneInfoDO> selectByIds(List<Long> ids){
        if (CollectionUtils.isEmpty(ids)){
            return new ArrayList<>();
        }
        return hyIntendDevZoneInfoMapper.selectByIds(ids);
    }


    public List<HyIntendDevZoneInfoDO> getHyIntendDevZoneInfoList(String type){
        if (StringUtils.isEmpty(type)){
            return new ArrayList<>();
        }
        return hyIntendDevZoneInfoMapper.getHyIntendDevZoneInfoList(type);
    }

    /**
     * 根据组织架构获取配置信息
     * @param regionIds
     * @return
     */
    public List<HyIntendDevZoneInfoDO> getZoneInfoByRegionIds(List<String> regionIds){
        if(CollectionUtils.isEmpty(regionIds)){
            return Lists.newArrayList();
        }
        return hyIntendDevZoneInfoMapper.getZoneInfoByRegionIds(regionIds);
    }

}
