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

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.biz.vo.GroupsPageReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.biz.GroupsDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

/**
 * @Author: jinyd
 * @CreateTime: 2024/8/29  10:14
 * @Description:
 * @Version: 4.0
 */

@Mapper
public interface GroupsMapper extends BaseMapperX<GroupsDO> {

    default PageResult<GroupsDO> selectPage(GroupsPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<GroupsDO>()
                .likeIfPresent(GroupsDO::getName, reqVO.getName())
                .eqIfPresent(GroupsDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(GroupsDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(GroupsDO::getId));
    }

    Integer selectSystemTenant(@Param("tenantId") Long tenantId, @Param("loginPlatform") Integer loginPlatform);

    Integer selectSystemMenuCount(@Param("id") Long id, @Param("loginDevice") Integer loginDevice);
}
