package com.blueland.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.blueland.bo.Org;
import com.blueland.bo.TreeEntity;
import com.blueland.model.TUcOrg;
import org.apache.ibatis.annotations.Param;

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

/**
 * @auther xcy
 * @create 2022-05-09 16:18
 */
public interface ITucOrgService extends IService<TUcOrg> {

    Page<Org> getOrgSubs(Org entity);

    List<Org> getTopOrg(String orgType);

    List<Org> getListNoPage(Org entity);

    Page<Org> getOrgPage(Org org);

    List<Org> getOrgChildLst(Org org);

    List<Org> getOrgChildLst(String orgId);

    List<Map<String, Object>> handleTreeData(Org entity, List<Org> orgList);

    List<Org> findOrgIdList(Org org);

    Org findOrgById(String orgId);

    List<TreeEntity> searchOrg(Org org);

    List<TreeEntity> getTree(String orgType, String type, String id, String orgId, String staffName);

    List<TreeEntity> judgeLeaf(List<TreeEntity> list, String orgType);

    String getfulldeptname(String deptId);

    void syncDept2CRM(Org model);

    List<Map<String, String>> getAllSellorg(String tenantid);

    Org get(Org bo);

    Org getByAppId(Org bo);

    List<Org> findList(Org bo);

    Page<Org> findPage(Org bo);

    /**
     * 根据部门id获取租户id
     * @param deptId
     * @return
     */
    String getTenantId(String deptId);

    /**
     * 根据部门id集合查询部门信息
     * @param deptIds
     * @return
     */
    List<Org> selectOrgByDeptIds(List<String> deptIds);

    /**
     * 根据ERP部门code集合查询部门信息
     * @param erpCodes
     * @return
     */
    List<Org> selectOrgByErpCodes(List<String> erpCodes);

    Integer countOrgById(String id, String appId);

    List<TUcOrg> handleOrg(Org org);

    void deleteOrgByAppId(String appId);

    /**
     * 获取顶级组织id
     * @return
     */
    String getTopOrgId();

    /**
     * 查询顶级销售组织id
     * @param deptCode
     * @return
     */
    String getSellOrgId(String deptCode);

    String getAppIdByParentId(String parentId);

    Org getByOgId(String orgId);

    Org getByOgIdAndType(String orgId, String type);
}
