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.AreaDTO;
import ink.wgink.pojo.dtos.ZTreeDTO;
import org.springframework.stereotype.Repository;

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

/**
 * @ClassName: IAreaDao
 * @Description: 地区字典
 * @Author: WangGeng
 * @Date: 2019/1/6 3:49 PM
 * @Version: 1.0
 **/
@Repository
public interface IAreaDao 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 RemoveException
     */
    void delete(Map<String, Object> params) throws RemoveException;

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

    /**
     * 修改合并名称和短名称
     *
     * @param params
     * @throws UpdateException
     */
    void updateShortAndMergerName(Map<String, Object> params) throws UpdateException;


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

    /**
     * 分页
     *
     * @param params
     * @return
     * @throws SearchException
     */
    List<AreaDTO> listPage(Map<String, Object> params) throws SearchException;

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

    /**
     * 获取最后一个字地区字典
     *
     * @param areaParentId
     * @return
     * @throws SearchException
     */
    AreaDTO getLastByParentId(String areaParentId) 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;

    /**
     * 统计总数
     *
     * @param params
     * @return
     * @throws SearchException
     */
    Integer count(Map<String, Object> params) throws SearchException;

}
