package com.kiisoo.ic.generalize.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.kiisoo.ic.generalize.entity.CompanyStoreDO;
import com.kiisoo.ic.generalize.entity.PrivilageOrganizationalRelationVO;
import com.kiisoo.ic.generalize.entity.PrivilageOrganizational;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

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

@Repository
public interface RetailCompanyMapper extends BaseMapper<PrivilageOrganizational> {

    List<CompanyStoreDO> selectShopIdByRetail(@Param("orgId") Long orgId, @Param("shopIds") List<Long> shopIds);

    List<Long> selectSellerIdsByShop(@Param("orgId") Long orgId,@Param("shopIds") List<Long> shopIds,@Param("sellerId") Long sellerId);

    /**
     * 找到子公司
     */
    Set<Long> selectChildList(@Param("companys")  Set<Long> companys);

    void insertDomainOrgRelation(@Param("domainId")Long domainId, @Param("companyId")Long companyId);

    /**
     * 所以组织对应关系list
     */
    List<PrivilageOrganizationalRelationVO> selectAllOrgListByOrgIds(@Param("orgIds") List<Long> orgIds, @Param("regionId")Long regionId , @Param("companyId")Long companyId, @Param("customerId")Long customerId);

    /**
     * 根据店铺编码找到上级客户
     * @param storeCode 店铺编码
     * @return 返回客户信息
     * @author dexiang.jiang
     * @date 2020/05/07 21:00
     */
    List<Map<String,Object>> selectCustomerDOByStoreCode(@Param("storeCode") String storeCode);


}
