package com.yeejoin.amos.boot.module.hygf.api.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.yeejoin.amos.boot.module.hygf.api.config.UserEmpower;
import com.yeejoin.amos.boot.module.hygf.api.dto.CompanyDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.UnitInfo;
import org.apache.ibatis.annotations.Param;

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

/**
 * 经销商人员信息 Mapper 接口
 *
 * @author system_generator
 * @date 2023-07-07
 */
public interface UnitInfoMapper extends BaseMapper<UnitInfo> {

  //获取单位分页列表 @Param("offset") long offset,  @Param("pageSize") long  pageSize,
    IPage<CompanyDto> getCompanyDto(@Param("dto") CompanyDto dto);
    Map<String,Integer> getCompanyDtoCount(@Param("dto")CompanyDto dto);
    //List< Map<String,Object>> getuserList(@Param("userName") String userName,@Param("role") Long role,@Param("regionalCompaniesSeq") Long regionalCompaniesSeq,@Param("amosUnitId") Long amosUnitId);
    List< Map<String,Object>> getuserListByOrgCode(@Param("userName") String userName,@Param("role") Long role,@Param("regionalCompaniesSeq") Long regionalCompaniesSeq,@Param("amosOrgCode") String amosOrgCode);
    List< Map<String,Object>> getuserListAllByOrgCode(@Param("userName") String userName,@Param("role") Long role,@Param("regionalCompaniesSeq") Long regionalCompaniesSeq,@Param("amosOrgCode") String amosOrgCode);
  @UserEmpower(field ={},dealerField ={"hygf_personnel_business.amos_unit_org_code","hygf_personnel_business.regional_companies_code"} ,fieldConditions ={"eq","in"} ,relationship="and")
  List< Map<String,Object>> getuserListtelephone(@Param("userName") String userName,@Param("role") Long role,@Param("regionalCompaniesSeq") Long regionalCompaniesSeq,@Param("amosUnitId") Long amosUnitId);


    List< Map<String,Object>> getUserTelephoneByUserId(@Param("userId") String userId);

    @UserEmpower(field ={"hygf_regional_companies.regional_companies_code"} ,dealerField ={} ,fieldConditions ={"in"} ,relationship="and")
    List<UnitInfo>   getlistUnitInfo();


//    @UserEmpower(field ={"hygf_unit_info.regional_companies_code"} ,dealerField ={} ,fieldConditions ={"in"} ,relationship="and")
//     UnitInfo  selectById( Long unitInfoId);

   Integer getUserListHuiCount(String phone, String userName);
   Integer getUserListPauCount(String phone, String userName);

    Integer getUserListSubCount(String phone, String userName);

    Integer getUserListAliCount(String phone, String userName);
}
