package com.rf.psychological.param.service.impl;

import com.rf.psychological.config.Properties;
import com.rf.psychological.param.dao.model.ParamEntry;
import com.rf.psychological.param.dao.repository.ParamRepository;
import com.rf.psychological.param.service.ParamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

/**
 * @Author:zzf
 * @Date:2022/7/5:10:53
 * @Description:系统参数
 */
@Service

public class ParamServiceImpl implements ParamService {

    @Autowired
    private ParamRepository repository;

    //@Autowired
    //private RedisTemplate<String,Object> template;
    /**
     * 保存
     *
     * @param paramEntry
     * @return
     */
    @Override
    @CachePut(value = "param", key = "#paramEntry.paramName")
    public ParamEntry save(ParamEntry paramEntry) {
        return  this.repository.save(paramEntry);
    }

    /**
     * 查询，名称
     *
     * @param paramName
     * @return
     */
    @Override
    public ParamEntry findByParamName(String paramName) {
        return this.repository.findByParamName(paramName);
    }
}
