package ink.wgink.service.role.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.role.RoleDTO;
import ink.wgink.pojo.pos.RolePO;
import org.springframework.stereotype.Repository;

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

/**
 * When you feel like quitting. Think about why you started
 * 当你想要放弃的时候，想想当初你为何开始
 *
 * @ClassName: IRoleDao
 * @Description: 角色
 * @Author: WangGeng
 * @Date: 2021/1/31 18:52
 * @Version: 1.0
 **/
@Repository
public interface IRoleDao 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<RoleDTO> list(Map<String, Object> params) throws SearchException;

    /**
     * 角色详情
     *
     * @param params
     * @return
     * @throws SearchException
     */
    RoleDTO get(Map<String, Object> params) throws SearchException;

    /**
     * 获取最后一个字角色
     *
     * @param parentId
     * @return
     * @throws SearchException
     */
    RoleDTO 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;

    /**
     * 统计角色
     *
     * @param params
     * @return
     * @throws SearchException
     */
    Integer countRole(Map<String, Object> params) throws SearchException;

    /**
     * 角色列表
     *
     * @param params
     * @return
     * @throws SearchException
     */
    List<RolePO> listPO(Map<String, Object> params) throws SearchException;
}
