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.UserMember;
import com.ruoyi.cai.dto.admin.vo.UserMemberAdminVo;
import com.ruoyi.cai.mapper.UserMemberMapper;
import com.ruoyi.cai.service.UserMemberService;
import com.ruoyi.common.core.domain.PageQuery;
import org.springframework.stereotype.Service;

/**
 * 会员管理Service业务层处理
 *
 * @author 77
 * @date 2023-12-21
 */
@Service
public class UserMemberServiceImpl extends ServiceImpl<UserMemberMapper, UserMember> implements UserMemberService {

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

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