package com.ruoyi.cai.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.cai.domain.UserInfo;
import com.ruoyi.cai.dto.admin.vo.UserInfoAdminVo;
import com.ruoyi.cai.mapper.UserInfoMapper;
import com.ruoyi.cai.service.UserInfoService;
import com.ruoyi.common.core.domain.PageQuery;
import org.springframework.stereotype.Service;

@Service
public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo> implements UserInfoService {

    @Override
    public UserInfo getByUserId(Long userId) {
        return this.getOne(Wrappers.lambdaQuery(UserInfo.class).eq(UserInfo::getUserId,userId)
                .last("limit 1"));
    }

    @Override
    public Page<UserInfoAdminVo> pageAdmin(PageQuery pageQuery, UserInfoAdminVo bo) {
        return baseMapper.pageAdmin(pageQuery.build(),bo);
    }
}
