package com.friday.custody.dao;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.friday.custody.dto.TenantInfoMonitorDto;
import com.friday.custody.dto.TrustInfoDto;
import com.friday.custody.dto.TrustNoMonitorDto;
import com.friday.custody.entity.TenantInfoEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 
 * 
 * @author lyb
 * @email k0051582@gmail.com
 * @date 2022-01-05 14:07:22
 */
@Mapper
public interface TenantInfoDao extends BaseMapper<TenantInfoEntity> {

    int insertBatch(List tenantEntitys);
    //根据租户查托管
    List<TrustInfoDto> queryTrustNoData(@Param("tenantName") String tenantName);
    //根据托管查租户
    List<TenantInfoMonitorDto> queryAdminByTrustNo(@Param("trustNo") String trustNo);
    //查询租户
    List<TrustNoMonitorDto> queryAllAdmin(@Param("tenantName") String tenantName);
    //查询官网信息
    TenantInfoEntity queryOfficialWebsiteByTenant(@Param("tenant") String tenant);

    default List<TenantInfoEntity> queryByAdmin(String admin){
        LambdaQueryWrapper<TenantInfoEntity> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(TenantInfoEntity::getTenantName, admin);
        List<TenantInfoEntity> entities = this.selectList(queryWrapper);
        return entities;
    }
}
