package com.ssm.manage.mapper;

import com.ssm.core.mapper.BaseMapper;
import com.ssm.manage.entity.RegionList;
import com.ssm.manage.entity.RegionThreeLevel;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import javax.validation.constraints.NotNull;
import java.util.Collection;
import java.util.List;
import java.util.Map;

/**
 * (RegionList)表数据库访问层
 *
 * @author makejava
 * @since 2023-12-16 11:26:09
 */
@Component
public interface RegionListMapper extends BaseMapper<RegionList> {


    List<Integer> selectByChildren(@Param("zhongkongDeptId") Long zhongkongDeptId);

    List<String> selectByChildrenByDeptName(@Param("deptNum") String deptNum);

    @MapKey("threeDeptId")
    Map<Integer, RegionThreeLevel> selectParentByIds(@Param("ids") Collection<Integer> ids);

    @MapKey("threeDeptNum")
    Map<String, RegionThreeLevel> selectParentByRegionNum(@Param("regionNums") Collection<String> regionNums);

    RegionThreeLevel selectParentById(@Param("id") @NotNull Integer id);
}
