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

import com.liangjian.dataplatform.member.dao.secondary.UserPointClearRuleRepository;
import com.liangjian.dataplatform.member.entity.po.secondary.UserPointClearRule;
import com.liangjian.dataplatform.member.service.IUserPointClearRuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

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

    @Autowired
    private UserPointClearRuleRepository userPointClearRuleRepository;

    @Override
    public UserPointClearRule queryPointClearRule() {
        return userPointClearRuleRepository.findLastPointClearRule();
    }

    @Override
    public boolean addPointClearRule(UserPointClearRule rule) {
        try {
            userPointClearRuleRepository.saveWithCycle(rule);
            return true;
        } catch (Exception ex) {
            ex.printStackTrace();
            return false;
        }
    }

}
