package com.cm.common.plugin.dao.datadictionary;

import com.cm.common.exception.RemoveException;
import com.cm.common.exception.SaveException;
import com.cm.common.exception.SearchException;
import com.cm.common.exception.UpdateException;
import com.cm.common.plugin.pojo.dtos.datadictionary.DataDictionaryDTO;
import com.cm.common.pojo.dtos.ZTreeDTO;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * @ClassName: IDictionaryDao
 * @Description: 字典
 * @Author: WangGeng
 * @Date: 2019/1/6 3:49 PM
 * @Version: 1.0
 **/
@Repository
public interface IDataDictionaryDao {

    /**
     * 新增字典
     *
     * @param params
     * @throws SaveException
     */
    void saveDictionary(Map<String, Object> params) throws SaveException;

    /**
     * 删除字典
     *
     * @param params
     * @throws RemoveException
     */
    void removeDictionary(Map<String, Object> params) throws RemoveException;

    /**
     * 修改字典
     *
     * @param params
     * @throws UpdateException
     */
    void updateDictionary(Map<String, Object> params) throws UpdateException;

    /**
     * 字典列表
     *
     * @param params
     * @return
     * @throws SearchException
     */
    List<DataDictionaryDTO> listDictionary(Map<String, Object> params) throws SearchException;

    /**
     * 字典详情
     *
     * @param params
     * @return
     * @throws SearchException
     */
    DataDictionaryDTO getDictionary(Map<String, Object> params) throws SearchException;

    /**
     * 获取最后一个字字典
     *
     * @param parentId
     * @return
     * @throws SearchException
     */
    DataDictionaryDTO getLastByParentId(String parentId) throws SearchException;

    /**
     * 字典ZTree列表
     *
     * @param params
     * @return
     * @throws SearchException
     */
    List<ZTreeDTO> listZTreeDictionary(Map<String, Object> params) throws SearchException;

    /**
     * 子列表个数
     *
     * @param id
     * @return
     * @throws SearchException
     */
    Integer countByParentId(String id) throws SearchException;

}
