package ink.wgink.service.group.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.group.GroupDTO;
import ink.wgink.pojo.pos.GroupPO;
import org.springframework.stereotype.Repository;

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

/**
 * @ClassName: IGroupDao
 * @Description: 组
 * @Author: wenc
 * @Date: 2019/1/6 3:49 PM
 * @Version: 1.0
 **/
@Repository
public interface IGroupDao 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<GroupDTO> list(Map<String, Object> params) throws SearchException;

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

    /**
     * 组详情
     *
     * @param params
     * @return
     * @throws SearchException
     */
    GroupPO getPO(Map<String, Object> params) throws SearchException;

    /**
     * 获取最后一个字组
     *
     * @param parentId
     * @return
     * @throws SearchException
     */
    GroupDTO 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
     */
    List<GroupPO> listPO(Map<String, Object> params);
}
