package ink.wgink.service.position.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.position.PositionDTO;
import ink.wgink.pojo.pos.PositionPO;
import org.springframework.stereotype.Repository;

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

/**
 * @ClassName: IPositionDao
 * @Description: 职位
 * @Author: admin
 * @Date: 2019-04-11 22:31:12
 * @Version: 1.0
 **/
@Repository
public interface IPositionDao 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<PositionDTO> list(Map<String, Object> params) throws SearchException;

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

    /**
     * 获取最后一个子职位
     *
     * @param parentId
     * @return
     * @throws SearchException
     */
    PositionDTO 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 count(Map<String, Object> params) throws SearchException;

    /**
     * 职位列表
     *
     * @param params
     * @return
     * @throws SearchException
     */
    List<PositionPO> listPO(Map<String, Object> params) throws SearchException;

    /**
     * 上级职位
     *
     * @param params
     * @return
     * @throws SearchException
     */
    PositionDTO getParent(Map<String, Object> params) throws SearchException;

    /**
     * 上级职位列表
     *
     * @param params
     * @return
     * @throws SearchException
     */
    List<PositionDTO> listParent(Map<String, Object> params) throws SearchException;
}
