package cn.iocoder.yudao.module.system.dal.mysql.user;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.system.controller.admin.user.vo.tenant.UserTenantRelatePageReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.user.UserTenantRelateDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 用户租户关系 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface UserTenantRelateMapper extends BaseMapperX<UserTenantRelateDO> {

    default PageResult<UserTenantRelateDO> selectPage(UserTenantRelatePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<UserTenantRelateDO>()
                .eqIfPresent(UserTenantRelateDO::getUserId, reqVO.getUserId())
                .eqIfPresent(UserTenantRelateDO::getTenantId, reqVO.getTenantId())
                .eqIfPresent(UserTenantRelateDO::getRole, reqVO.getRole())
                .eqIfPresent(UserTenantRelateDO::getActived, reqVO.getActived())
                .eqIfPresent(UserTenantRelateDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(UserTenantRelateDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(UserTenantRelateDO::getId));
    }

}