package com.td.Dawa.sys.syssettingtask.service;

import com.td.Dawa.common.pojo.Result;
import com.td.Dawa.common.service.*;
import com.td.Dawa.sys.syssettingtask.pojo.SysSettingTask;
import com.td.Dawa.sys.syssettingtask.vo.SysSettingTaskVo;
import com.td.Dawa.sys.syssettingtask.repository.SysSettingTaskRepository;
import com.td.Dawa.util.RedisSettingMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

@Service
@Transactional
public class SysSettingTaskServiceImpl extends CommonServiceImpl<SysSettingTaskVo, SysSettingTask, String> implements SysSettingTaskService{

    @PersistenceContext
    private EntityManager em;
    @Autowired
    private SysSettingTaskRepository sysSettingTaskRepository;
    @Autowired
    private RedisSettingMap redisSettingMap;
    @Override
    public Result<SysSettingTaskVo> save(SysSettingTaskVo entityVo) {
        //调用父类
        Result<SysSettingTaskVo> result = super.save(entityVo);

        //更新系统设置时同步更新公用静态集合sysSettingTaskMap
        // SysSettingTaskUtil.setSysSettingTaskMap(result.getData());
        redisSettingMap.setSysSettingTaskMap(result.getData());
        return result;
    }
}
