package com.wzj.soopin.member.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wzj.soopin.member.domain.po.AccountBill;
import com.wzj.soopin.member.domain.po.MemberAccount;
import com.wzj.soopin.member.domain.bo.MemberAccountBO;
import com.wzj.soopin.member.domain.vo.MemberAccountVO;
import com.wzj.soopin.member.enums.AccountBillChangeTypeEnum;
import com.wzj.soopin.member.enums.AccountBillSourceEnum;
import com.wzj.soopin.member.mapper.MemberAccountMapper;
import com.wzj.soopin.member.service.IMemberAccountService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;

/**
 * 会员账户表Service业务层处理
 *
 *
 * @author zcc
 */
@Service
@RequiredArgsConstructor
public class MemberAccountServiceImpl extends ServiceImpl<MemberAccountMapper,MemberAccount> implements IMemberAccountService {


    @Override
    public MemberAccount getMemberAccount(Long memberId) {
        return baseMapper.selectOne(new QueryWrapper<MemberAccount>().lambda().eq(MemberAccount::getMemberId,memberId));
    }

    /**
     * 查询会员账户表列表
     *
     * @param query 查询条件
     * @param page 分页条件
     * @return 会员账户表
     */
    public IPage<MemberAccount> selectList(MemberAccountBO query, IPage page) {
        return baseMapper.selectPage(page,query.toWrapper());
    }

    @Override
    public IPage<MemberAccountVO> pageWithMember(Page<?> page, MemberAccountBO bo) {
        return baseMapper.selectAccountWithMember(page, bo);
    }

    @Override
    public Object getCount() {
        return baseMapper.getCount();
    }


}
