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

import com.td.boss.common.pojo.Result;
import com.td.boss.common.service.*;
import com.td.boss.sys.syssetting.vo.SysSettingVo;
import com.td.boss.sys.syssettingtask.pojo.SysSettingTask;
import com.td.boss.sys.syssettingtask.vo.SysSettingTaskVo;
import com.td.boss.sys.syssettingtask.repository.SysSettingTaskRepository;
import com.td.boss.util.SysSettingTaskUtil;
import com.td.boss.util.SysSettingUtil;
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;

    @Override
    public Result<SysSettingTaskVo> save(SysSettingTaskVo entityVo) {
        //调用父类
        Result<SysSettingTaskVo> result = super.save(entityVo);

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

        return result;
    }
}
