package ink.wgink.module.dictionary.dao;

import ink.wgink.exceptions.RemoveException;
import ink.wgink.exceptions.SaveException;
import ink.wgink.exceptions.SearchException;
import ink.wgink.exceptions.UpdateException;
import ink.wgink.interfaces.init.IInitBaseTable;
import ink.wgink.module.dictionary.pojo.dtos.DataDTO;
import ink.wgink.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 IDataDao extends IInitBaseTable {

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

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

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

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

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

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

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

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

}
