package com.engine.organization.mapper.comp;

import com.engine.organization.entity.company.po.CompPO;
import org.apache.ibatis.annotations.Param;

import java.util.Collection;
import java.util.List;

/**
 * @description:
 * @author:dxfeng
 * @createTime: 2022/05/16
 * @version: 1.0
 */
public interface CompMapper {
    /**
     * 列表查询
     *
     * @return
     */
    List<CompPO> listAll(@Param("orderSql") String orderSql);

    List<CompPO> listByFilter(@Param("CompanyPO") CompPO CompanyPO, @Param("orderSql") String orderSql);

    /**
     * 查询所有被引用的ID
     *
     * @return
     */
    List<String> listUsedId();

    List<String> listUsedIds();

    /**
     * 获取子层级数据
     *
     * @param ids
     * @return
     */
    List<CompPO> listChild(@Param("ids") Collection<Integer> ids);

    /**
     * 根据ID查询数据
     *
     * @param id
     * @return
     */
    CompPO listById(@Param("id") Integer id);

    /**
     * 根据ID批量查询数据
     *
     * @param ids
     * @return
     */
    List<CompPO> getCompsByIds(@Param("ids") Collection<Long> ids);

    /**
     * 获取顶级数据
     *
     * @return
     */
    List<CompPO> listParent();

    List<String> hasSubs();

    List<String> hasDetachSubs(@Param("companyIds") Collection<Long> companyIds);

    /**
     * 根据名称和上级查找ID
     *
     * @param subCompanyName
     * @param supSubComId
     * @return
     */
    Integer getIdByNameAndPid(@Param("subCompanyName") String subCompanyName, @Param("supSubComId") Integer supSubComId);

    /**
     * 获取最大排序
     *
     * @return
     */
    Integer getMaxShowOrder();

    Integer getIdBySubCompanyCode(@Param("subCompanyCode") String subCompanyCode);
}
