package com.cm.common.plugin.service.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.plugin.pojo.vos.datadictionary.DataDictionaryVO;
import com.cm.common.pojo.ListPage;
import com.cm.common.pojo.dtos.ZTreeDTO;
import com.cm.common.result.SuccessResult;
import com.cm.common.result.SuccessResultList;

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

/**
 * When you feel like quitting. Think about why you started
 * 当你想要放弃的时候，想想当初你为何开始
 *
 * @ClassName: IDictionaryService
 * @Description: 字典
 * @Author: WangGeng
 * @Date: 2019/11/18 14:09
 * @Version: 1.0
 **/
public interface IDataDictionaryService {
    /**
     * 字典新增
     *
     * @param dictionaryVO
     * @return
     * @throws Exception
     */
    SuccessResult saveDictionary(DataDictionaryVO dictionaryVO) throws Exception;

    /**
     * 字典新增
     *
     * @param token
     * @param dictionaryVO
     * @return
     * @throws Exception
     */
    SuccessResult saveDictionary(String token, DataDictionaryVO dictionaryVO) throws Exception;

    /**
     * 字典新增
     *
     * @param dictionaryVO
     * @return 新增ID
     * @throws Exception
     */
    String saveDictionaryReturnId(DataDictionaryVO dictionaryVO) throws Exception;

    /**
     * 字典新增
     *
     * @param token
     * @param dictionaryVO
     * @return 新增ID
     * @throws Exception
     */
    String saveDictionaryReturnId(String token, DataDictionaryVO dictionaryVO) throws Exception;

    /**
     * 字典删除
     *
     * @param ids
     * @return
     * @throws RemoveException
     */
    SuccessResult removeDictionary(String ids) throws RemoveException;

    /**
     * 字典删除
     *
     * @param token
     * @param ids
     * @return
     * @throws RemoveException
     */
    SuccessResult removeDictionary(String token, String ids) throws RemoveException;

    /**
     * 字典修改
     *
     * @param dictionaryId
     * @param dictionaryVO
     * @return
     * @throws Exception
     */
    SuccessResult updateDictionary(String dictionaryId, DataDictionaryVO dictionaryVO) throws Exception;

    /**
     * 字典修改
     *
     * @param token
     * @param dictionaryId
     * @param dictionaryVO
     * @return
     * @throws Exception
     */
    SuccessResult updateDictionary(String token, String dictionaryId, DataDictionaryVO dictionaryVO) throws Exception;

    /**
     * 通过ID获取字典
     *
     * @param dictionaryId
     * @return
     * @throws SearchException
     */
    DataDictionaryDTO getDictionaryById(String dictionaryId) throws SearchException;

    /**
     * 通过上级ID获取字典列表
     *
     * @param dictionaryParentId
     * @return
     * @throws SearchException
     */
    List<DataDictionaryDTO> listDictionaryByParentId(String dictionaryParentId) throws SearchException;

    /**
     * 通过上级ID获取字典全部列表
     *
     * @param dictionaryParentId
     * @return
     * @throws SearchException
     */
    List<DataDictionaryDTO> listDictionaryAllByParentId(String dictionaryParentId) throws SearchException;

    /**
     * 分页获取字典列表
     *
     * @param page
     * @return
     * @throws SearchException
     */
    SuccessResultList<List<DataDictionaryDTO>> listPageDictionary(ListPage page) throws SearchException;

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

    /**
     * 字典列表（通过字典编码）
     *
     * @param dictionaryCode
     * @return
     * @throws SearchException
     */
    List<DataDictionaryDTO> listDictionaryByDictionaryCode(String dictionaryCode) throws SearchException;
}
