package com.platform.yijia.service.impl;
import com.platform.yijia.dao.CustomerPointsMapper;
import com.platform.yijia.pojo.CustomerPoints;
import com.platform.yijia.service.CustomerPointsService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service("customerPointsService")
public class CustomerPointsServiceImpl implements CustomerPointsService {
    @Resource
    private CustomerPointsMapper customerPointsMapper;

    //根据小程序用户的openId查询客户积分信息
    @Override
    public CustomerPoints getCustomerPointsInfoByUnionId(CustomerPoints customerPoints) {
        return customerPointsMapper.getCustomerPointsInfoByUnionId(customerPoints);
    }

    //获取用户积分信息
    @Override
    public CustomerPoints getCustomerPointsInfo(CustomerPoints customerPoints) {
        return customerPointsMapper.getCustomerPointsInfo(customerPoints);
    }

    //插入用户积分信息
    @Override
    public void insertCustomerPointsInfo(CustomerPoints customerPoints) {
        customerPointsMapper.insertCustomerPointsInfo(customerPoints);
    }

    //更新用户积分信息
    @Override
    public void updateCustomerPointsInfo(CustomerPoints customerPoints) {
        customerPointsMapper.updateCustomerPointsInfo(customerPoints);
    }

    //判断该用户是否存在积分表
    @Override
    public boolean isExistCustomerPointsInfo(CustomerPoints customerPoints) {
        boolean boo = false;
        int i = customerPointsMapper.isExistCustomerPointsInfo(customerPoints);
        if(i >= 1){
            boo = true;
        }
        return boo;
    }
}
