package ink.wgink.service.department.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.pojo.dtos.ZTreeDTO;
import ink.wgink.pojo.dtos.department.DepartmentDTO;
import ink.wgink.pojo.pos.DepartmentPO;
import org.springframework.stereotype.Repository;

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

/**
 * When you feel like quitting. Think about why you started
 * 当你想要放弃的时候，想想当初你为何开始
 *
 * @ClassName: IUserDao
 * @Description: 用户
 * @Author: WangGeng
 * @Date: 2021/1/24 20:23
 * @Version: 1.0
 **/
@Repository
public interface IDepartmentDao 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
     * @throws UpdateException
     */
    void updateCode(Map<String, Object> params) throws UpdateException;

    /**
     * 更新部门状态
     *
     * @param params
     * @throws UpdateException
     */
    void updateState(Map<String, Object> params) throws UpdateException;

    /**
     * 组织部门详情
     *
     * @param params
     * @return
     * @throws SearchException
     */
    DepartmentDTO get(Map<String, Object> params) throws SearchException;

    /**
     * 组织部门列表
     *
     * @param params
     * @return
     * @throws SearchException
     */
    List<DepartmentDTO> list(Map<String, Object> params) throws SearchException;

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

    /**
     * 部门ID
     *
     * @param params
     * @return
     * @throws SearchException
     */
    List<String> listId(Map<String, Object> params) throws SearchException;

    /**
     * zTree组织部门列表
     *
     * @param params
     * @return
     * @throws SearchException
     */
    List<ZTreeDTO> listZTree(Map<String, Object> params) throws SearchException;

    /**
     * zTree组织部门详情
     *
     * @param params
     * @return
     * @throws SearchException
     */
    ZTreeDTO getZTree(Map<String, Object> params) throws SearchException;

    /**
     * 组织部门通过ID统计
     *
     * @param id
     * @return
     * @throws SearchException
     */
    Integer countByParentId(String id) throws SearchException;

    /**
     * 最后一个子组织部门
     *
     * @param parentId
     * @return
     * @throws SearchException
     */
    DepartmentDTO getLastByParentId(String parentId) throws SearchException;

    /**
     * 获取组织机构通过名称和上级名称
     *
     * @param params
     * @return
     * @throws SearchException
     */
    DepartmentDTO getByNameAndParentName(Map<String, Object> params) throws SearchException;

    /**
     * 获取组织机构详情（简单类型）
     *
     * @param params
     * @return
     * @throws SearchException
     */
    DepartmentPO getSimple(Map<String, Object> params) throws SearchException;

    /**
     * 获取组织机构列表（简单类型）
     *
     * @param params
     * @return
     * @throws SearchException
     */
    List<DepartmentPO> listPO(Map<String, Object> params) throws SearchException;

}
