package com.ruoyi.xq.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.common.core.domain.PageQuery;
import com.ruoyi.xq.domain.UserInfo;
import com.ruoyi.xq.dto.admin.user.UserInfoAdminVo;
import com.ruoyi.xq.mapper.UserInfoMapper;
import com.ruoyi.xq.service.UserInfoService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * 用户信息Service业务层处理
 *
 * @author 77
 * @date 2024-03-04
 */
@RequiredArgsConstructor
@Service
public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper,UserInfo> implements UserInfoService {

    @Override
    public UserInfo getByUsercode(String usercode) {
        return this.getOne(Wrappers.lambdaQuery(UserInfo.class).eq(UserInfo::getUsercode, usercode));
    }

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

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