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

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.dingding.DingUserTenantRelateDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 钉钉用户租户关系 Mapper
 *
 * @author zhaopq
 */
@Mapper
public interface DingUserTenantRelateMapper extends BaseMapperX<DingUserTenantRelateDO> {

    default PageResult<DingUserTenantRelateDO> selectPage(UserTenantRelatePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DingUserTenantRelateDO>()
                .eqIfPresent(DingUserTenantRelateDO::getUserId, reqVO.getUserId())
                .eqIfPresent(DingUserTenantRelateDO::getTenantId, reqVO.getTenantId())
                .orderByDesc(DingUserTenantRelateDO::getId));
    }

}