package com.iamberry.wechat.service.integral;

import com.iamberry.wechat.core.entity.PageBean;
import com.iamberry.wechat.core.entity.ResultMsg;
import com.iamberry.wechat.core.entity.integral.IntegralConfig;
import com.iamberry.wechat.core.entity.integral.MemberIntegral;
import com.iamberry.wechat.core.entity.integral.RankRule;
import com.iamberry.wechat.core.entity.integral.UseIntegral;
import com.iamberry.wechat.face.integral.UseIntegralService;
import com.iamberry.wechat.service.mapper.UseIntegralMapper;
import com.iamberry.wechat.tools.NameUtils;
import com.iamberry.wechat.tools.ResultInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class UseIntegralServiceImpl implements UseIntegralService {
    @Autowired
    private UseIntegralMapper useIntegralMapper;

    /**
     * 获取会员信息.会员等级名称
     * @param openId
     * @return
     */
    @Override
    public MemberIntegral getMemberInfoAndRankName(String openId) {
        return useIntegralMapper.getMemberInfoAndRankName(openId);
    }

    /**
     * 获得的总积分数
     * @param userOpenId
     * @return
     */
    @Override
    public int getGainIntegralCount(String userOpenId) {
        return useIntegralMapper.getGainIntegralCount(userOpenId);
    }

    /**
     * 使用的总积分数
     * @param openid
     * @return
     */
    @Override
    public int getUseIntegralCount(String openid) {
        return useIntegralMapper.getUseIntegralCount(openid);
    }

    /**
     * 待入账的总积分数
     * @param userOpenId
     * @return
     */
    @Override
    public int getStayIntegralCount(String userOpenId) {
        return useIntegralMapper.getStayIntegralCount(userOpenId);
    }

    /**
     * 全部积分记录
     * @param useIntegral
     * @return
     */
    @Override
    public List<UseIntegral> listIntegralInfo(UseIntegral useIntegral) {
        return useIntegralMapper.listIntegralInfo(useIntegral);
    }

    @Override
    public List<IntegralConfig> listIntegralConfig(IntegralConfig integralConfig) {
        return useIntegralMapper.listIntegralConfig(integralConfig);
    }

    /**
     * 查询会员等级信息
     * @return
     */
    @Override
    public List<RankRule> getRankRule() {
        return useIntegralMapper.getRankRule();
    }
}
