package com.ga.core.mapper.dict;

import com.ga.core.vo.dict.DataDictionaryFullResp;
import com.ga.core.vo.dict.DataDictionaryResp;
import com.ga.core.vo.dict.DataDictionarySearchParam;
import com.ga.core.vo.dict.DataDictionaryVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface DataDictionaryMapper {

    /** 목록 조회 (data_dictionary + data_domain 조인, 페이징) */
    List<DataDictionaryResp> selectList(DataDictionarySearchParam param);

    /** 특정 테이블의 모든 컬럼 (sort_order 순, LEFT JOIN data_domain) */
    List<DataDictionaryResp> selectByTable(@Param("tableName") String tableName);

    /** VIEW v_data_dictionary_full 조회. tableName null 이면 전체 */
    List<DataDictionaryFullResp> selectFromView(@Param("tableName") String tableName);

    /** 사전에 등록된 distinct table_name 리스트 */
    List<String> selectTables();

    DataDictionaryResp selectById(@Param("dictId") Long dictId);

    int insert(DataDictionaryVO vo);

    int update(DataDictionaryVO vo);

    int delete(@Param("dictId") Long dictId);

    /** domain_code 존재 여부 확인 */
    int countDomainByCode(@Param("domainCode") String domainCode);
}
