package com.liangjian.dataplatform.member.service.impl;

import com.liangjian.dataplatform.member.dao.secondary.UserPointRmbRuleRepository;
import com.liangjian.dataplatform.member.entity.po.secondary.UserPointRmbRule;
import com.liangjian.dataplatform.member.service.IUserPointRmbRuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author: 黄树文
 * @Date: 2019/12/05
 */
@Service
public class UserPointRmbRuleService implements IUserPointRmbRuleService {

    @Autowired
    private UserPointRmbRuleRepository userPointRmbRuleRepository;

    @Override
    public UserPointRmbRule queryPointRmbRule() {
        return userPointRmbRuleRepository.findLastPointRmbRule();
    }

    @Override
    public boolean addPointRmbRule(UserPointRmbRule rule) {
        try {
            userPointRmbRuleRepository.saveWithCycle(rule);
            return true;
        } catch (Exception ex) {
            ex.printStackTrace();
            return false;
        }
    }

}
